Robotics Library  0.6.2
SickLms200.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009, Markus Rickert
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 // POSSIBILITY OF SUCH DAMAGE.
25 //
26 
27 #ifndef _RL_HAL_SICKLMS200_H_
28 #define _RL_HAL_SICKLMS200_H_
29 
30 #include <rl/util/Timer.h>
31 
32 #include "Device.h"
33 #include "Lidar.h"
34 #include "types.h"
35 
36 namespace rl
37 {
38  namespace hal
39  {
40  class Serial;
41 
42  class SickLms200 : public Lidar
43  {
44  public:
45  enum BaudRate
46  {
52 #if defined(WIN32) || defined(__QNX__)
54 #else // defined(WIN32) || defined(__QNX__)
58 #endif // defined(WIN32) || defined(__QNX__)
59  };
60 
61  enum Measuring
62  {
69  };
70 
72  {
75  };
76 
77  enum Variant
78  {
89  };
90 
94  SickLms200(
95  const ::std::string& device = "/dev/ttyS0",
100  const ::std::string& password = "SICK_LMS"
101  );
102 
103  virtual ~SickLms200();
104 
105  void close();
106 
107  void dumpConfiguration();
108 
109  void dumpStatus();
110 
111  BaudRate getBaudRate() const;
112 
113  void getDistances(::rl::math::Vector& distances) const;
114 
115  ::std::size_t getDistancesCount() const;
116 
117  ::rl::math::Real getDistancesMaximum(const ::std::size_t& i) const;
118 
119  ::rl::math::Real getDistancesMinimum(const ::std::size_t& i) const;
120 
121  Measuring getMeasuring() const;
122 
123  Monitoring getMonitoring() const;
124 
126 
128 
130 
131  ::std::string getType();
132 
133  Variant getVariant() const;
134 
135  void open();
136 
137  void reset();
138 
139  void setBaudRate(const BaudRate& baudRate);
140 
141  void setMeasuring(const Measuring& measuring);
142 
143  void setMonitoring(const Monitoring& monitoring);
144 
145  void setVariant(const Variant& variant);
146 
147  void start();
148 
149  void step();
150 
151  void stop();
152 
153  protected:
154 
155  private:
156  uint16_t crc(const uint8_t* buf, const ::std::size_t& len) const;
157 
158  ::std::size_t recv(uint8_t* buf, const ::std::size_t& len, const uint8_t& command);
159 
160  void send(uint8_t* buf, const ::std::size_t& len);
161 
162  bool waitAck();
163 
165 
166  uint8_t configuration;
167 
168  uint8_t data[812];
169 
171 
173 
175 
176  ::std::string password;
177 
179 
181 
183  };
184  }
185 }
186 
187 #endif // _RL_HAL_SICKLMS200_H_
rl::hal::SickLms200::configuration
uint8_t configuration
Definition: SickLms200.h:166
rl::hal::SickLms200::password
::std::string password
Definition: SickLms200.h:176
rl::hal::SickLms200::Monitoring
Monitoring
Definition: SickLms200.h:72
rl::hal::SickLms200::send
void send(uint8_t *buf, const ::std::size_t &len)
Definition: SickLms200.cpp:920
rl::hal::SickLms200::VARIANT_100_100
@ VARIANT_100_100
Angle = 100 degrees, resolution = 1 degree.
Definition: SickLms200.h:84
rl::hal::SickLms200::BAUDRATE_500000BPS
@ BAUDRATE_500000BPS
500,000 bps.
Definition: SickLms200.h:57
rl::hal::SickLms200::getDistances
void getDistances(::rl::math::Vector &distances) const
Definition: SickLms200.cpp:304
types.h
rl::hal::SickLms200::VARIANT_100_50
@ VARIANT_100_50
Angle = 100 degrees, resolution = 0.5 degrees.
Definition: SickLms200.h:82
rl::hal::SickLms200::getStartAngle
::rl::math::Real getStartAngle() const
Definition: SickLms200.cpp:560
rl::hal::SickLms200::variant
Variant variant
Definition: SickLms200.h:182
rl::hal::SickLms200::measuring
Measuring measuring
Definition: SickLms200.h:172
rl::hal::SickLms200::MEASURING_320M
@ MEASURING_320M
Definition: SickLms200.h:68
rl::hal::SickLms200::VARIANT_180_100
@ VARIANT_180_100
Angle = 180 degrees, resolution = 1 degree.
Definition: SickLms200.h:88
rl::hal::SickLms200::getMeasuring
Measuring getMeasuring() const
Definition: SickLms200.cpp:519
rl::hal::SickLms200::recv
::std::size_t recv(uint8_t *buf, const ::std::size_t &len, const uint8_t &command)
Definition: SickLms200.cpp:799
rl::hal::SickLms200::getResolution
::rl::math::Real getResolution() const
Definition: SickLms200.cpp:535
rl::hal::SickLms200::MEASURING_32M
@ MEASURING_32M
Definition: SickLms200.h:65
rl::hal::SickLms200::MEASURING_16M
@ MEASURING_16M
Definition: SickLms200.h:64
rl::hal::SickLms200::setMonitoring
void setMonitoring(const Monitoring &monitoring)
Definition: SickLms200.cpp:1119
rl::hal::SickLms200::open
void open()
Definition: SickLms200.cpp:634
rl::hal::SickLms200::MEASURING_80M
@ MEASURING_80M
Definition: SickLms200.h:66
rl::hal::SickLms200::~SickLms200
virtual ~SickLms200()
Definition: SickLms200.cpp:75
rl::hal::SickLms200::serial
Serial * serial
Definition: SickLms200.h:178
rl::hal::SickLms200::getMonitoring
Monitoring getMonitoring() const
Definition: SickLms200.cpp:527
rl::hal::SickLms200::getDistancesCount
::std::size_t getDistancesCount() const
Definition: SickLms200.cpp:448
Timer.h
rl::hal::Lidar
Definition: Lidar.h:37
rl::hal::SickLms200::getVariant
Variant getVariant() const
Definition: SickLms200.cpp:626
rl::hal::Serial
Definition: Serial.h:46
rl::hal::SickLms200::MEASURING_160M
@ MEASURING_160M
Definition: SickLms200.h:67
rl::hal::SickLms200::Measuring
Measuring
Definition: SickLms200.h:62
rl::hal::SickLms200
Definition: SickLms200.h:43
rl::hal::SickLms200::setBaudRate
void setBaudRate(const BaudRate &baudRate)
Definition: SickLms200.cpp:947
rl::hal::SickLms200::waitAck
bool waitAck()
Definition: SickLms200.cpp:1285
Device.h
rl::hal::SickLms200::monitoring
Monitoring monitoring
Definition: SickLms200.h:174
rl::hal::SickLms200::getBaudRate
BaudRate getBaudRate() const
Definition: SickLms200.cpp:298
rl::hal::SickLms200::SickLms200
SickLms200(const ::std::string &device="/dev/ttyS0", const BaudRate &baudRate=BAUDRATE_9600BPS, const Monitoring &monitoring=MONITORING_SINGLE, const Variant &variant=VARIANT_180_50, const Measuring &measuring=MEASURING_8M, const ::std::string &password="SICK_LMS")
Definition: SickLms200.cpp:43
rl::hal::SickLms200::VARIANT_100_25
@ VARIANT_100_25
Angle = 100 degrees, resolution = 0.25 degrees.
Definition: SickLms200.h:80
rl::hal::SickLms200::baudRate
BaudRate baudRate
Definition: SickLms200.h:164
rl::hal::SickLms200::timer
::rl::util::Timer timer
Definition: SickLms200.h:180
rl::hal::SickLms200::BAUDRATE_19200BPS
@ BAUDRATE_19200BPS
19,200 bps.
Definition: SickLms200.h:50
rl::hal::SickLms200::data
uint8_t data[812]
Definition: SickLms200.h:168
rl::hal::SickLms200::BAUDRATE_9600BPS
@ BAUDRATE_9600BPS
9,600 bps.
Definition: SickLms200.h:48
rl::hal::SickLms200::BaudRate
BaudRate
Definition: SickLms200.h:46
rl::hal::SickLms200::VARIANT_180_50
@ VARIANT_180_50
Angle = 180 degrees, resolution = 0.5 degrees.
Definition: SickLms200.h:86
rl::hal::SickLms200::start
void start()
Definition: SickLms200.cpp:1224
rl::hal::SickLms200::getStopAngle
::rl::math::Real getStopAngle() const
Definition: SickLms200.cpp:583
rl::hal::SickLms200::getDistancesMaximum
::rl::math::Real getDistancesMaximum(const ::std::size_t &i) const
Definition: SickLms200.cpp:477
rl::hal::SickLms200::getType
::std::string getType()
Definition: SickLms200.cpp:606
rl::hal::SickLms200::BAUDRATE_38400BPS
@ BAUDRATE_38400BPS
38,400 bps.
Definition: SickLms200.h:55
rl::hal::SickLms200::close
void close()
Definition: SickLms200.cpp:81
rl::hal::SickLms200::setVariant
void setVariant(const Variant &variant)
Definition: SickLms200.cpp:1163
rl::hal::SickLms200::MEASURING_8M
@ MEASURING_8M
Definition: SickLms200.h:63
rl::math::Vector
::Eigen::Matrix< Real, ::Eigen::Dynamic, 1 > Vector
Definition: Vector.h:41
rl::hal::SickLms200::setMeasuring
void setMeasuring(const Measuring &measuring)
Definition: SickLms200.cpp:1021
rl::hal::SickLms200::stop
void stop()
Definition: SickLms200.cpp:1274
rl::hal::SickLms200::MONITORING_CONTINUOUS
@ MONITORING_CONTINUOUS
Definition: SickLms200.h:73
rl::hal::SickLms200::step
void step()
Definition: SickLms200.cpp:1235
rl::hal::SickLms200::dumpStatus
void dumpStatus()
Definition: SickLms200.cpp:199
rl::hal::SickLms200::crc
uint16_t crc(const uint8_t *buf, const ::std::size_t &len) const
Definition: SickLms200.cpp:111
rl::util::Timer
Definition: Timer.h:46
rl::hal::SickLms200::dumpConfiguration
void dumpConfiguration()
Definition: SickLms200.cpp:134
Lidar.h
rl::math::Real
double Real
Definition: Real.h:34
rl::hal::SickLms200::desired
BaudRate desired
Definition: SickLms200.h:170
rl::hal::SickLms200::reset
void reset()
Definition: SickLms200.cpp:898
rl::hal::SickLms200::getDistancesMinimum
::rl::math::Real getDistancesMinimum(const ::std::size_t &i) const
Definition: SickLms200.cpp:510
rl::hal::SickLms200::MONITORING_SINGLE
@ MONITORING_SINGLE
Definition: SickLms200.h:74
rl::hal::SickLms200::Variant
Variant
Definition: SickLms200.h:78
rl
Definition: Ati.cpp:35