MRPT  2.0.0
CIbeoLuxETH.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 #pragma once
10 
14 #include <mrpt/poses/CPoint3D.h>
15 #include <mrpt/poses/CPose3D.h>
16 
17 #include <thread>
18 
19 namespace mrpt::hwdrivers
20 {
21 /** This "software driver" implements the communication protocol for interfacing
22  * a Ibeo Lux laser scanners through an ethernet controller.
23  * This class does not need to be bind, i.e. you do not need to call
24  * C2DRangeFinderAbstract::bindIO.
25  * Connection is established when user call the turnOn() method. You can
26  * pass to the class's constructor the Lux's ip address and port.
27  * Device will NOT be configured. Configuration has to be done seperately.
28  *
29  * To get a laser scan you must proceed like that :
30  * \code
31  * CIbeoLuxETH laser(string("192.168.0.10"), 1234);
32  * laser.turnOn();
33  * bool isOutObs, hardwareError;
34  * CObservation2DRangeScan outObs;
35  * laser.doProcessSimple(isOutObs, outObs, hardwareError);
36  * \endcode
37  *
38  * \note This class was contributed by Adrien Barral - Robopec (France)
39  * \note And modified by Jan Girlich - University of Hamburg
40  * \ingroup mrpt_hwdrivers_grp
41  */
43 {
45 
46  public:
47  /** Constructor.
48  * Note that there is default arguments, here you can customize IP Adress
49  * and TCP Port of your device.
50  */
52  std::string _ip = std::string("10.152.36.93"),
53  unsigned int _port = 12002);
54  /** Destructor.
55  * Close communcation with the device, and free memory.
56  */
57  ~CIbeoLuxETH() override;
58  /** This function acquire a laser scan from the device. If an error occured,
59  * hardwareError will be set to true.
60  * The new laser scan will be stored in the outObservation argument.
61  *
62  * \exception This method throw exception if the frame received from the
63  * LMS 100 contain the following bad parameters :
64  * * Status is not OK
65  * * Data in the scan aren't DIST1 (may be RSSIx or DIST2).
66  */
67  void doProcess() override;
68  void initialize() override;
69  void start();
70  void makeCommandHeader(unsigned char* buffer);
71  void makeStartCommand(unsigned char* buffer);
72  void makeStopCommand(unsigned char* buffer);
73  void makeTypeCommand(unsigned char* buffer);
74 
75  private:
76  std::string m_ip;
77  unsigned int m_port;
79  unsigned int m_scanFrequency; // in hertz
80  double m_angleResolution; // in degrees
81  double m_startAngle; // degrees
82  double m_stopAngle; // degrees
84  double m_maxRange{200.0};
86  bool m_run;
87  void dataCollection();
88  std::thread dataCollectionThread;
89  double convertLayerToRad(int scanlayer);
90  double convertTicksToHRad(int hticks, int hticksPerRotation);
92  float vrad, float hrad, float distance);
93  float vwinkel{0.0};
94  std::vector<mrpt::obs::CObservation3DRangeScan> m_observations;
95  bool m_newObs;
96  float m_vAngle;
97  unsigned int lastScanNumber;
98  unsigned int curScanNumber;
99 
100  protected:
101  /** Load sensor pose on the robot, or keep the default sensor pose.
102  */
104  const mrpt::config::CConfigFileBase& configSource,
105  const std::string& iniSection) override;
106 };
107 } // namespace mrpt::hwdrivers
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
mrpt::poses::CPoint3D convertToCartesian(float vrad, float hrad, float distance)
double convertLayerToRad(int scanlayer)
void makeTypeCommand(unsigned char *buffer)
void makeStartCommand(unsigned char *buffer)
void makeCommandHeader(unsigned char *buffer)
double convertTicksToHRad(int hticks, int hticksPerRotation)
Contains classes for various device interfaces.
~CIbeoLuxETH() override
Destructor.
Definition: CIbeoLuxETH.cpp:44
mrpt::poses::CPose3D m_sensorPose
Definition: CIbeoLuxETH.h:83
This "software driver" implements the communication protocol for interfacing a Ibeo Lux laser scanner...
Definition: CIbeoLuxETH.h:42
CIbeoLuxETH(std::string _ip=std::string("10.152.36.93"), unsigned int _port=12002)
Constructor.
Definition: CIbeoLuxETH.cpp:36
This class allows loading and storing values and vectors of different types from a configuration text...
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.
void doProcess() override
This function acquire a laser scan from the device.
void initialize() override
This method can or cannot be implemented in the derived class, depending on the need for it...
std::vector< mrpt::obs::CObservation3DRangeScan > m_observations
Definition: CIbeoLuxETH.h:94
A class used to store a 3D point.
Definition: CPoint3D.h:31
#define DEFINE_GENERIC_SENSOR(class_name)
This declaration must be inserted in all CGenericSensor classes definition, within the class declarat...
std::thread dataCollectionThread
Definition: CIbeoLuxETH.h:88
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
A TCP socket that can be connected to a TCP server, implementing MRPT&#39;s CStream interface for passing...
void makeStopCommand(unsigned char *buffer)
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
Definition: geometry.cpp:1807
mrpt::comms::CClientTCPSocket m_client
Definition: CIbeoLuxETH.h:78



Page generated by Doxygen 1.8.14 for MRPT 2.0.0 Git: b38439d21 Tue Mar 31 19:58:06 2020 +0200 at miƩ abr 1 00:50:30 CEST 2020