MRPT  2.0.3
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
mrpt::hwdrivers::CIbeoLuxETH::doProcess
void doProcess() override
This function acquire a laser scan from the device.
Definition: CIbeoLuxETH.cpp:374
mrpt::hwdrivers::CIbeoLuxETH::m_stopAngle
double m_stopAngle
Definition: CIbeoLuxETH.h:82
CClientTCPSocket.h
mrpt::hwdrivers::CIbeoLuxETH::m_vAngle
float m_vAngle
Definition: CIbeoLuxETH.h:96
mrpt::comms::CClientTCPSocket
A TCP socket that can be connected to a TCP server, implementing MRPT's CStream interface for passing...
Definition: CClientTCPSocket.h:34
mrpt::hwdrivers::CIbeoLuxETH::~CIbeoLuxETH
~CIbeoLuxETH() override
Destructor.
Definition: CIbeoLuxETH.cpp:44
mrpt::hwdrivers::CIbeoLuxETH::m_run
bool m_run
Definition: CIbeoLuxETH.h:86
mrpt::hwdrivers::CIbeoLuxETH::lastScanNumber
unsigned int lastScanNumber
Definition: CIbeoLuxETH.h:97
mrpt::hwdrivers::CIbeoLuxETH::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: CIbeoLuxETH.cpp:268
mrpt::hwdrivers::CIbeoLuxETH::dataCollectionThread
std::thread dataCollectionThread
Definition: CIbeoLuxETH.h:88
mrpt::hwdrivers::CIbeoLuxETH::m_startAngle
double m_startAngle
Definition: CIbeoLuxETH.h:81
mrpt::hwdrivers::CIbeoLuxETH
This "software driver" implements the communication protocol for interfacing a Ibeo Lux laser scanner...
Definition: CIbeoLuxETH.h:42
mrpt::hwdrivers::CIbeoLuxETH::m_angleResolution
double m_angleResolution
Definition: CIbeoLuxETH.h:80
mrpt::hwdrivers
Contains classes for various device interfaces.
Definition: C2DRangeFinderAbstract.h:19
mrpt::hwdrivers::CIbeoLuxETH::m_observations
std::vector< mrpt::obs::CObservation3DRangeScan > m_observations
Definition: CIbeoLuxETH.h:94
mrpt::hwdrivers::CIbeoLuxETH::dataCollection
void dataCollection()
Definition: CIbeoLuxETH.cpp:54
CObservation3DRangeScan.h
mrpt::math::distance
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
Definition: geometry.cpp:1807
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::CIbeoLuxETH::convertLayerToRad
double convertLayerToRad(int scanlayer)
Definition: CIbeoLuxETH.cpp:240
mrpt::hwdrivers::CIbeoLuxETH::makeCommandHeader
void makeCommandHeader(unsigned char *buffer)
Definition: CIbeoLuxETH.cpp:289
mrpt::hwdrivers::CIbeoLuxETH::initialize
void initialize() override
This method can or cannot be implemented in the derived class, depending on the need for it.
Definition: CIbeoLuxETH.cpp:360
mrpt::hwdrivers::CIbeoLuxETH::m_beamApperture
double m_beamApperture
Definition: CIbeoLuxETH.h:85
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::hwdrivers::CIbeoLuxETH::convertToCartesian
mrpt::poses::CPoint3D convertToCartesian(float vrad, float hrad, float distance)
Definition: CIbeoLuxETH.cpp:217
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
CGenericSensor.h
mrpt::hwdrivers::CGenericSensor
A generic interface for a wide-variety of sensors designed to be used in the application RawLogGrabbe...
Definition: CGenericSensor.h:70
mrpt::hwdrivers::CIbeoLuxETH::makeStopCommand
void makeStopCommand(unsigned char *buffer)
Definition: CIbeoLuxETH.cpp:329
mrpt::hwdrivers::CIbeoLuxETH::m_maxRange
double m_maxRange
Definition: CIbeoLuxETH.h:84
mrpt::hwdrivers::CIbeoLuxETH::convertTicksToHRad
double convertTicksToHRad(int hticks, int hticksPerRotation)
Definition: CIbeoLuxETH.cpp:235
mrpt::hwdrivers::CIbeoLuxETH::m_port
unsigned int m_port
Definition: CIbeoLuxETH.h:77
mrpt::hwdrivers::CIbeoLuxETH::m_ip
std::string m_ip
Definition: CIbeoLuxETH.h:76
CPoint3D.h
CPose3D.h
mrpt::hwdrivers::CIbeoLuxETH::m_client
mrpt::comms::CClientTCPSocket m_client
Definition: CIbeoLuxETH.h:78
mrpt::hwdrivers::CIbeoLuxETH::CIbeoLuxETH
CIbeoLuxETH(std::string _ip=std::string("10.152.36.93"), unsigned int _port=12002)
Constructor.
Definition: CIbeoLuxETH.cpp:36
mrpt::hwdrivers::CIbeoLuxETH::start
void start()
mrpt::hwdrivers::CIbeoLuxETH::curScanNumber
unsigned int curScanNumber
Definition: CIbeoLuxETH.h:98
mrpt::hwdrivers::CIbeoLuxETH::vwinkel
float vwinkel
Definition: CIbeoLuxETH.h:93
mrpt::hwdrivers::CIbeoLuxETH::m_scanFrequency
unsigned int m_scanFrequency
Definition: CIbeoLuxETH.h:79
mrpt::hwdrivers::CIbeoLuxETH::m_sensorPose
mrpt::poses::CPose3D m_sensorPose
Definition: CIbeoLuxETH.h:83
mrpt::poses::CPoint3D
A class used to store a 3D point.
Definition: CPoint3D.h:31
mrpt::hwdrivers::CIbeoLuxETH::m_newObs
bool m_newObs
Definition: CIbeoLuxETH.h:95
mrpt::hwdrivers::CIbeoLuxETH::makeTypeCommand
void makeTypeCommand(unsigned char *buffer)
Definition: CIbeoLuxETH.cpp:340
mrpt::hwdrivers::CIbeoLuxETH::makeStartCommand
void makeStartCommand(unsigned char *buffer)
Definition: CIbeoLuxETH.cpp:318



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 29 13:06:46 UTC 2020