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 
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)
GLuint buffer
Definition: glext.h:3917
void doProcess()
This function acquire a laser scan from the device.
double convertTicksToHRad(int hticks, int hticksPerRotation)
Contains classes for various device interfaces.
mrpt::poses::CPose3D m_sensorPose
Definition: CIbeoLuxETH.h:84
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection)
Load sensor pose on the robot, or keep the default sensor pose.
This "software driver" implements the communication protocol for interfacing a Ibeo Lux laser scanner...
Definition: CIbeoLuxETH.h:43
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 initialize()
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:95
GLsizei const GLchar ** string
Definition: glext.h:4101
A class used to store a 3D point.
Definition: CPoint3D.h:31
virtual ~CIbeoLuxETH()
Destructor.
Definition: CIbeoLuxETH.cpp:46
#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:89
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:86
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:1891
mrpt::comms::CClientTCPSocket m_client
Definition: CIbeoLuxETH.h:79



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020