MRPT  1.9.9
CSICKTim561Eth_2050101.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
14 
15 namespace mrpt::hwdrivers
16 {
18 {
20  public:
21  /** Constructor.
22  * Note that there is default arguments, here you can customize IP Adress
23  * and TCP Port of your device
24  */
26  std::string _ip = std::string("192.168.0.1"),
27  unsigned int _port = 2111);
28  /** Deconstructor.
29  * Close communication with the device, and free memory.
30  */
31  ~CSICKTim561Eth() override;
32 
33  /** This function acquire a laser scan from the device. If an error occured,
34  * hardwareError will be set to true.
35  * The new laser scan will be stored in the outObservation argument.
36  *
37  * \exception This method throw exception if the frame received from the
38  * TIM 561 contain the following bad parameters:
39  * * Status is not OK
40  * * Data in the scan aren't DIST1(may be RSSIx or DIST2).
41  */
42  void doProcessSimple(
43  bool& outThereIsObservation,
44  mrpt::obs::CObservation2DRangeScan& outObservation,
45  bool& hardwareError) override;
46 
47  /**
48  * This method must be called before trying to get a laser scan.
49  */
50  bool turnOn() override;
51 
52  /**
53  * This method could be called manually to stop communication with the
54  * device. Method is also called by destructor.
55  */
56  bool turnOff() override;
57 
58  /**
59  * This method could be called manually to reboot the device.
60  */
61  bool rebootDev();
62 
63  /**
64  * A method to set the sensor pose on the robot.
65  * Equivalent to setting the sensor pose via loading it from a config file.
66  */
67  void setSensorPose(const mrpt::poses::CPose3D& _pose);
68 
69  /**
70  * This method must be called periodically. Period depend on the
71  * process_rate in the configuration file.
72  */
73  void doProcess() override;
74 
75  /** Initialize the sensor according to the parameters previously read
76  * in the configuration file.
77  */
78  void initialize() override;
79 
80  private:
81  std::string m_ip;
82  unsigned int m_port;
84  bool m_turnedOn{false};
85  std::string m_cmd;
86  bool m_connected{false};
87  unsigned int m_scanFrequency; // Scanning Hertz
88  double m_angleResolution; // Degrees [0.0001, 1]
89  double m_startAngle; // the minimum startAngle is -45 degree
90  double m_stopAngle; // the maximum stopAngle is 225 degree
92  double m_maxRange{10.0}; // 10 meter is the range official suggested
93  double m_beamApperture; // the range bewteen m_startAngle to m_stopAngle
94 
95  void generateCmd(const char* cmd); // According to communication protocol
96  bool checkIsConnected(); // Check the status about Lidar connection
97  bool decodeLogIn(char* msg);
98  bool decodeScanCfg(std::istringstream& stream);
99  bool decodeScan(
100  char* buf, mrpt::obs::CObservation2DRangeScan& outObservation);
101  void sendCommand(const char* cmd);
102  void roughPrint(char* msg);
103 
104  protected:
105  /** Load sensor pose on the robot, or keep the default sensor pose.
106  */
108  const mrpt::config::CConfigFileBase& configSource,
109  const std::string& iniSection) override;
110 };
111 } // namespace mrpt::hwdrivers
Contains classes for various device interfaces.
void setSensorPose(const mrpt::poses::CPose3D &_pose)
A method to set the sensor pose on the robot.
bool decodeScan(char *buf, mrpt::obs::CObservation2DRangeScan &outObservation)
void doProcessSimple(bool &outThereIsObservation, mrpt::obs::CObservation2DRangeScan &outObservation, bool &hardwareError) override
This function acquire a laser scan from the device.
This class allows loading and storing values and vectors of different types from a configuration text...
bool decodeScanCfg(std::istringstream &stream)
void doProcess() override
This method must be called periodically.
bool turnOn() override
This method must be called before trying to get a laser scan.
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
This is the base, abstract class for "software drivers" interfaces to 2D scanners (laser range finder...
bool rebootDev()
This method could be called manually to reboot the device.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
void initialize() override
Initialize the sensor according to the parameters previously read in the configuration file...
A TCP socket that can be connected to a TCP server, implementing MRPT's CStream interface for passing...
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection) override
Load sensor pose on the robot, or keep the default sensor pose.
bool turnOff() override
This method could be called manually to stop communication with the device.
~CSICKTim561Eth() override
Deconstructor.
CSICKTim561Eth(std::string _ip=std::string("192.168.0.1"), unsigned int _port=2111)
Constructor.
mrpt::comms::CClientTCPSocket m_client



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020