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