Main MRPT website
>
C++ reference
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
mrpt
hwdrivers
CIbeoLuxETH.h
Go to the documentation of this file.
1
/* +---------------------------------------------------------------------------+
2
| The Mobile Robot Programming Toolkit (MRPT) C++ library |
3
| |
4
| http://www.mrpt.org/ |
5
| |
6
| Copyright (C) 2005-2010 University of Malaga |
7
| |
8
| This software was written by the Machine Perception and Intelligent |
9
| Robotics Lab, University of Malaga (Spain). |
10
| Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11
| |
12
| This file is part of the MRPT project. |
13
| |
14
| MRPT is free software: you can redistribute it and/or modify |
15
| it under the terms of the GNU General Public License as published by |
16
| the Free Software Foundation, either version 3 of the License, or |
17
| (at your option) any later version. |
18
| |
19
| MRPT is distributed in the hope that it will be useful, |
20
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
| GNU General Public License for more details. |
23
| |
24
| You should have received a copy of the GNU General Public License |
25
| along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26
| |
27
+---------------------------------------------------------------------------+ */
28
#ifndef CIbeoLuxETH_H
29
#define CIbeoLuxETH_H
30
31
#include <
mrpt/hwdrivers/CGenericSensor.h
>
32
#include <
mrpt/poses/CPose3D.h
>
33
#include <
mrpt/poses/CPoint3D.h
>
34
#include <
mrpt/slam/CObservation3DRangeScan.h
>
35
#include <
mrpt/utils/CClientTCPSocket.h
>
36
37
namespace
mrpt
38
{
39
namespace
hwdrivers
40
{
41
using namespace
std;
42
using namespace
mrpt::hwdrivers;
43
using namespace
mrpt::utils;
44
using namespace
mrpt::slam;
45
46
/** This "software driver" implements the communication protocol for interfacing a Ibeo Lux laser scanners through an ethernet controller.
47
* This class does not need to be bind, i.e. you do not need to call C2DRangeFinderAbstract::bindIO.
48
* Connection is established when user call the turnOn() method. You can pass to the class's constructor the Lux's ip address and port.
49
* Device will NOT be configured. Configuration has to be done seperately.
50
*
51
* To get a laser scan you must proceed like that :
52
* \code
53
* CIbeoLuxETH laser(string("192.168.0.10"), 1234);
54
* laser.turnOn();
55
* bool isOutObs, hardwareError;
56
* CObservation2DRangeScan outObs;
57
* laser.doProcessSimple(isOutObs, outObs, hardwareError);
58
* \endcode
59
*
60
* \note This class was contributed by Adrien Barral - Robopec (France)
61
* \note And modified by Jan Girlich - University of Hamburg
62
* \ingroup mrpt_hwdrivers_grp
63
*/
64
class
HWDRIVERS_IMPEXP
CIbeoLuxETH
:
public
mrpt::hwdrivers::CGenericSensor
65
{
66
DEFINE_GENERIC_SENSOR
(
CIbeoLuxETH
)
67
68
public
:
69
/** Constructor.
70
* Note that there is default arguments, here you can customize IP Adress and TCP Port of your device.
71
*/
72
CIbeoLuxETH
(
string
_ip=
string
(
"10.152.36.93"
),
unsigned
int
_port=12002);
73
/** Destructor.
74
* Close communcation with the device, and free memory.
75
*/
76
virtual
~
CIbeoLuxETH
();
77
/** This function acquire a laser scan from the device. If an error occured, hardwareError will be set to true.
78
* The new laser scan will be stored in the outObservation argument.
79
*
80
* \exception This method throw exception if the frame received from the LMS 100 contain the following bad parameters :
81
* * Status is not OK
82
* * Data in the scan aren't DIST1 (may be RSSIx or DIST2).
83
*/
84
void
doProcess();
85
void
initialize();
86
void
start();
87
void
makeCommandHeader(
unsigned
char
* buffer);
88
void
makeStartCommand(
unsigned
char
* buffer);
89
void
makeStopCommand(
unsigned
char
* buffer);
90
void
makeTypeCommand(
unsigned
char
* buffer);
91
92
private
:
93
string
m_ip
;
94
unsigned
int
m_port
;
95
CClientTCPSocket
m_client
;
96
unsigned
int
m_scanFrequency
;
// in hertz
97
double
m_angleResolution
;
// in degrees
98
double
m_startAngle
;
// degrees
99
double
m_stopAngle
;
// degrees
100
CPose3D
m_sensorPose
;
101
double
m_maxRange
;
102
double
m_beamApperture
;
103
bool
m_run
;
104
void
dataCollection();
105
mrpt::system::TThreadHandle
dataCollectionThread
;
106
float
convertLayerToRad(
int
scanlayer);
107
float
convertTicksToHRad(
int
hticks,
int
hticksPerRotation);
108
CPoint3D
convertToCartesian(
float
vrad,
float
hrad,
float
distance
);
109
float
vwinkel
;
110
vector<CObservation3DRangeScan>
m_observations
;
111
bool
m_newObs
;
112
float
m_vAngle
;
113
unsigned
int
lastScanNumber
;
114
unsigned
int
curScanNumber
;
115
116
protected
:
117
/** Load sensor pose on the robot, or keep the default sensor pose.
118
*/
119
void
loadConfig_sensorSpecific(
const
mrpt::utils::CConfigFileBase
&configSource,
120
const
std::string &iniSection );
121
122
};
123
}
124
}
125
126
#endif
Page generated by
Doxygen 1.8.3
for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013