Robotics Library  0.6.2
SchmersalLss300.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_SCHMERSALLSS300_H_
28 #define _RL_HAL_SCHMERSALLSS300_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 SchmersalLss300 : public Lidar
43  {
44  public:
45  enum BaudRate
46  {
55 #if 0
56 
57  BAUDRATE_125000BPS,
59  BAUDRATE_208333BPS,
61  BAUDRATE_312500BPS
62 #endif
63  };
64 
66  {
69  };
70 
75  const ::std::string& device = "/dev/ttyS0",
78  const ::std::string& password = "PASS_LSS"
79  );
80 
81  virtual ~SchmersalLss300();
82 
83  void close();
84 
85  BaudRate getBaudRate() const;
86 
87  void getDistances(::rl::math::Vector& distances) const;
88 
89  ::std::size_t getDistancesCount() const;
90 
91  ::rl::math::Real getDistancesMaximum(const ::std::size_t& i) const;
92 
93  ::rl::math::Real getDistancesMinimum(const ::std::size_t& i) const;
94 
95  Monitoring getMonitoring() const;
96 
98 
100 
102 
103  ::std::string getType();
104 
105  void open();
106 
107  void reset();
108 
109  void setBaudRate(const BaudRate& baudRate);
110 
111  void setMonitoring(const Monitoring& monitoring);
112 
113  void start();
114 
115  void step();
116 
117  void stop();
118 
119  protected:
120 
121  private:
122  uint16_t crc(const uint8_t* buf, const ::std::size_t& len) const;
123 
124  ::std::size_t recv(uint8_t* buf, const ::std::size_t& len, const uint8_t& command);
125 
126  void send(uint8_t* buf, const ::std::size_t& len);
127 
128  bool waitAck();
129 
131 
132  uint8_t configuration;
133 
134  uint8_t data[1013];
135 
137 
139 
140  ::std::string password;
141 
143 
145  };
146  }
147 }
148 
149 #endif // _RL_HAL_SCHMERSALLSS300_H_
rl::hal::SchmersalLss300::reset
void reset()
Definition: SchmersalLss300.cpp:375
rl::hal::SchmersalLss300::getType
::std::string getType()
Definition: SchmersalLss300.cpp:205
rl::hal::SchmersalLss300::start
void start()
Definition: SchmersalLss300.cpp:533
rl::hal::SchmersalLss300::data
uint8_t data[1013]
Definition: SchmersalLss300.h:134
rl::hal::SchmersalLss300::baudRate
BaudRate baudRate
Definition: SchmersalLss300.h:130
rl::hal::SchmersalLss300::getStopAngle
::rl::math::Real getStopAngle() const
Definition: SchmersalLss300.cpp:197
rl::hal::SchmersalLss300::setMonitoring
void setMonitoring(const Monitoring &monitoring)
Definition: SchmersalLss300.cpp:483
rl::hal::SchmersalLss300::getStartAngle
::rl::math::Real getStartAngle() const
Definition: SchmersalLss300.cpp:189
rl::hal::SchmersalLss300::BaudRate
BaudRate
Definition: SchmersalLss300.h:46
rl::hal::SchmersalLss300::setBaudRate
void setBaudRate(const BaudRate &baudRate)
Definition: SchmersalLss300.cpp:420
types.h
rl::hal::SchmersalLss300::waitAck
bool waitAck()
Definition: SchmersalLss300.cpp:575
rl::hal::SchmersalLss300::BAUDRATE_38400BPS
@ BAUDRATE_38400BPS
38,400 bps.
Definition: SchmersalLss300.h:52
rl::hal::SchmersalLss300::BAUDRATE_57600BPS
@ BAUDRATE_57600BPS
57,600 bps.
Definition: SchmersalLss300.h:54
rl::hal::SchmersalLss300::BAUDRATE_9600BPS
@ BAUDRATE_9600BPS
9,600 bps.
Definition: SchmersalLss300.h:48
rl::hal::SchmersalLss300::BAUDRATE_19200BPS
@ BAUDRATE_19200BPS
19,200 bps.
Definition: SchmersalLss300.h:50
rl::hal::SchmersalLss300::~SchmersalLss300
virtual ~SchmersalLss300()
Definition: SchmersalLss300.cpp:70
Timer.h
rl::hal::Lidar
Definition: Lidar.h:37
rl::hal::SchmersalLss300::getBaudRate
BaudRate getBaudRate() const
Definition: SchmersalLss300.cpp:119
rl::hal::Serial
Definition: Serial.h:46
rl::hal::SchmersalLss300::Monitoring
Monitoring
Definition: SchmersalLss300.h:66
rl::hal::SchmersalLss300::serial
Serial * serial
Definition: SchmersalLss300.h:142
rl::hal::SchmersalLss300::monitoring
Monitoring monitoring
Definition: SchmersalLss300.h:138
rl::hal::SchmersalLss300::getDistances
void getDistances(::rl::math::Vector &distances) const
Definition: SchmersalLss300.cpp:125
rl::hal::SchmersalLss300::getResolution
::rl::math::Real getResolution() const
Definition: SchmersalLss300.cpp:181
rl::hal::SchmersalLss300::close
void close()
Definition: SchmersalLss300.cpp:76
rl::hal::SchmersalLss300::configuration
uint8_t configuration
Definition: SchmersalLss300.h:132
rl::hal::SchmersalLss300::crc
uint16_t crc(const uint8_t *buf, const ::std::size_t &len) const
Definition: SchmersalLss300.cpp:96
rl::hal::SchmersalLss300::MONITORING_SINGLE
@ MONITORING_SINGLE
Definition: SchmersalLss300.h:68
Device.h
rl::hal::SchmersalLss300::open
void open()
Definition: SchmersalLss300.cpp:237
rl::hal::SchmersalLss300::getMonitoring
Monitoring getMonitoring() const
Definition: SchmersalLss300.cpp:173
rl::hal::SchmersalLss300::MONITORING_CONTINUOUS
@ MONITORING_CONTINUOUS
Definition: SchmersalLss300.h:67
rl::hal::SchmersalLss300::password
::std::string password
Definition: SchmersalLss300.h:140
rl::hal::SchmersalLss300::getDistancesCount
::std::size_t getDistancesCount() const
Definition: SchmersalLss300.cpp:151
rl::hal::SchmersalLss300::send
void send(uint8_t *buf, const ::std::size_t &len)
Definition: SchmersalLss300.cpp:393
rl::hal::SchmersalLss300::stop
void stop()
Definition: SchmersalLss300.cpp:564
rl::hal::SchmersalLss300::SchmersalLss300
SchmersalLss300(const ::std::string &device="/dev/ttyS0", const BaudRate &baudRate=BAUDRATE_9600BPS, const Monitoring &monitoring=MONITORING_SINGLE, const ::std::string &password="PASS_LSS")
Definition: SchmersalLss300.cpp:42
rl::hal::SchmersalLss300::step
void step()
Definition: SchmersalLss300.cpp:544
rl::hal::SchmersalLss300::desired
BaudRate desired
Definition: SchmersalLss300.h:136
rl::hal::SchmersalLss300::getDistancesMinimum
::rl::math::Real getDistancesMinimum(const ::std::size_t &i) const
Definition: SchmersalLss300.cpp:165
rl::hal::SchmersalLss300::timer
::rl::util::Timer timer
Definition: SchmersalLss300.h:144
rl::math::Vector
::Eigen::Matrix< Real, ::Eigen::Dynamic, 1 > Vector
Definition: Vector.h:41
rl::hal::SchmersalLss300::getDistancesMaximum
::rl::math::Real getDistancesMaximum(const ::std::size_t &i) const
Definition: SchmersalLss300.cpp:157
rl::hal::SchmersalLss300::recv
::std::size_t recv(uint8_t *buf, const ::std::size_t &len, const uint8_t &command)
Definition: SchmersalLss300.cpp:309
rl::util::Timer
Definition: Timer.h:46
Lidar.h
rl::math::Real
double Real
Definition: Real.h:34
rl::hal::SchmersalLss300
Definition: SchmersalLss300.h:43
rl
Definition: Ati.cpp:35