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



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 814d80880 Fri Aug 24 01:51:28 2018 +0200 at mar 26 may 2026 12:30:59 CEST