MRPT  2.0.4
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
CClientTCPSocket.h
mrpt::comms::CClientTCPSocket
A TCP socket that can be connected to a TCP server, implementing MRPT's CStream interface for passing...
Definition: CClientTCPSocket.h:35
mrpt::hwdrivers::CSICKTim561Eth::m_beamApperture
double m_beamApperture
Definition: CSICKTim561Eth_2050101.h:93
mrpt::hwdrivers::CSICKTim561Eth::m_cmd
std::string m_cmd
Definition: CSICKTim561Eth_2050101.h:85
mrpt::hwdrivers::CSICKTim561Eth::CSICKTim561Eth
CSICKTim561Eth(std::string _ip=std::string("192.168.0.1"), unsigned int _port=2111)
Constructor.
Definition: CSICKTim561Eth_2050101.cpp:37
mrpt::hwdrivers::CSICKTim561Eth::doProcessSimple
void doProcessSimple(bool &outThereIsObservation, mrpt::obs::CObservation2DRangeScan &outObservation, bool &hardwareError) override
This function acquire a laser scan from the device.
Definition: CSICKTim561Eth_2050101.cpp:470
mrpt::obs::CObservation2DRangeScan
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
Definition: CObservation2DRangeScan.h:55
mrpt::hwdrivers::CSICKTim561Eth::m_sensorPose
mrpt::poses::CPose3D m_sensorPose
Definition: CSICKTim561Eth_2050101.h:91
mrpt::hwdrivers::CSICKTim561Eth::roughPrint
void roughPrint(char *msg)
mrpt::hwdrivers::CSICKTim561Eth::setSensorPose
void setSensorPose(const mrpt::poses::CPose3D &_pose)
A method to set the sensor pose on the robot.
Definition: CSICKTim561Eth_2050101.cpp:541
mrpt::hwdrivers::CSICKTim561Eth::m_maxRange
double m_maxRange
Definition: CSICKTim561Eth_2050101.h:92
mrpt::hwdrivers
Contains classes for various device interfaces.
Definition: C2DRangeFinderAbstract.h:20
mrpt::hwdrivers::CSICKTim561Eth::loadConfig_sensorSpecific
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.
Definition: CSICKTim561Eth_2050101.cpp:65
DEFINE_GENERIC_SENSOR
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
Definition: CGenericSensor.h:302
mrpt::hwdrivers::CSICKTim561Eth::m_port
unsigned int m_port
Definition: CSICKTim561Eth_2050101.h:82
mrpt::hwdrivers::CSICKTim561Eth::m_startAngle
double m_startAngle
Definition: CSICKTim561Eth_2050101.h:89
mrpt::hwdrivers::CSICKTim561Eth::generateCmd
void generateCmd(const char *cmd)
Definition: CSICKTim561Eth_2050101.cpp:377
mrpt::hwdrivers::C2DRangeFinderAbstract
This is the base, abstract class for "software drivers" interfaces to 2D scanners (laser range finder...
Definition: C2DRangeFinderAbstract.h:42
mrpt::hwdrivers::CSICKTim561Eth::checkIsConnected
bool checkIsConnected()
Definition: CSICKTim561Eth_2050101.cpp:90
mrpt::hwdrivers::CSICKTim561Eth::m_client
mrpt::comms::CClientTCPSocket m_client
Definition: CSICKTim561Eth_2050101.h:83
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:45
mrpt::hwdrivers::CSICKTim561Eth::m_turnedOn
bool m_turnedOn
Definition: CSICKTim561Eth_2050101.h:84
mrpt::hwdrivers::CSICKTim561Eth::sendCommand
void sendCommand(const char *cmd)
Definition: CSICKTim561Eth_2050101.cpp:368
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:87
mrpt::hwdrivers::CSICKTim561Eth::turnOn
bool turnOn() override
This method must be called before trying to get a laser scan.
Definition: CSICKTim561Eth_2050101.cpp:163
cmd
TCLAP::CmdLine cmd("system_control_rate_timer_example")
mrpt::hwdrivers::CSICKTim561Eth::m_connected
bool m_connected
Definition: CSICKTim561Eth_2050101.h:86
mrpt::hwdrivers::CSICKTim561Eth::doProcess
void doProcess() override
This method must be called periodically.
Definition: CSICKTim561Eth_2050101.cpp:508
mrpt::hwdrivers::CSICKTim561Eth
Definition: CSICKTim561Eth_2050101.h:18
mrpt::hwdrivers::CSICKTim561Eth::initialize
void initialize() override
Initialize the sensor according to the parameters previously read in the configuration file.
Definition: CSICKTim561Eth_2050101.cpp:53
mrpt::hwdrivers::CSICKTim561Eth::decodeLogIn
bool decodeLogIn(char *msg)
mrpt::hwdrivers::CSICKTim561Eth::decodeScan
bool decodeScan(char *buf, mrpt::obs::CObservation2DRangeScan &outObservation)
Definition: CSICKTim561Eth_2050101.cpp:388
mrpt::hwdrivers::CSICKTim561Eth::~CSICKTim561Eth
~CSICKTim561Eth() override
Deconstructor.
Definition: CSICKTim561Eth_2050101.cpp:48
mrpt::hwdrivers::CSICKTim561Eth::m_stopAngle
double m_stopAngle
Definition: CSICKTim561Eth_2050101.h:90
mrpt::hwdrivers::CSICKTim561Eth::m_scanFrequency
unsigned int m_scanFrequency
Definition: CSICKTim561Eth_2050101.h:87
mrpt::hwdrivers::CSICKTim561Eth::m_angleResolution
double m_angleResolution
Definition: CSICKTim561Eth_2050101.h:88
mrpt::hwdrivers::CSICKTim561Eth::turnOff
bool turnOff() override
This method could be called manually to stop communication with the device.
Definition: CSICKTim561Eth_2050101.cpp:155
mrpt::hwdrivers::CSICKTim561Eth::rebootDev
bool rebootDev()
This method could be called manually to reboot the device.
Definition: CSICKTim561Eth_2050101.cpp:114
mrpt::hwdrivers::CSICKTim561Eth::decodeScanCfg
bool decodeScanCfg(std::istringstream &stream)
mrpt::hwdrivers::CSICKTim561Eth::m_ip
std::string m_ip
Definition: CSICKTim561Eth_2050101.h:81
C2DRangeFinderAbstract.h



Page generated by Doxygen 1.8.18 for MRPT 2.0.4 at Thu Sep 24 07:14:18 UTC 2020