Robotics Library  0.7.0
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 <array>
31 #include <cstdint>
32 
33 #include "CyclicDevice.h"
34 #include "Device.h"
35 #include "Lidar.h"
36 #include "Serial.h"
37 
38 namespace rl
39 {
40  namespace hal
41  {
45  class SchmersalLss300 : public CyclicDevice, public Lidar
46  {
47  public:
48  enum BaudRate
49  {
58 #if 0
59 
60  BAUDRATE_125000BPS,
62  BAUDRATE_208333BPS,
64  BAUDRATE_312500BPS
65 #endif
66  };
67 
69  {
72  };
73 
78  const ::std::string& device = "/dev/ttyS0",
81  const ::std::string& password = "PASS_LSS"
82  );
83 
84  virtual ~SchmersalLss300();
85 
86  void close();
87 
88  BaudRate getBaudRate() const;
89 
91 
92  ::std::size_t getDistancesCount() const;
93 
94  ::rl::math::Real getDistancesMaximum(const ::std::size_t& i) const;
95 
96  ::rl::math::Real getDistancesMinimum(const ::std::size_t& i) const;
97 
98  Monitoring getMonitoring() const;
99 
101 
103 
105 
106  ::std::string getType();
107 
108  void open();
109 
110  void reset();
111 
112  void setBaudRate(const BaudRate& baudRate);
113 
114  void setMonitoring(const Monitoring& monitoring);
115 
116  void start();
117 
118  void step();
119 
120  void stop();
121 
122  protected:
123 
124  private:
125  ::std::uint16_t crc(const ::std::uint8_t* buf, const ::std::size_t& len) const;
126 
127  ::std::size_t recv(::std::uint8_t* buf, const ::std::size_t& len, const ::std::uint8_t& command);
128 
129  void send(::std::uint8_t* buf, const ::std::size_t& len);
130 
131  bool waitAck();
132 
134 
135  ::std::array< ::std::uint8_t, 1013> data;
136 
138 
140 
141  ::std::string password;
142 
144  };
145  }
146 }
147 
148 #endif // RL_HAL_SCHMERSALLSS300_H
rl::hal::SchmersalLss300::reset
void reset()
Definition: SchmersalLss300.cpp:370
rl::hal::SchmersalLss300::getType
::std::string getType()
Definition: SchmersalLss300.cpp:200
rl::hal::SchmersalLss300::start
void start()
Definition: SchmersalLss300.cpp:528
rl::hal::SchmersalLss300::baudRate
BaudRate baudRate
Definition: SchmersalLss300.h:133
rl::hal::SchmersalLss300::getDistances
::rl::math::Vector getDistances() const
Definition: SchmersalLss300.cpp:119
rl::hal::SchmersalLss300::getStopAngle
::rl::math::Real getStopAngle() const
Definition: SchmersalLss300.cpp:192
rl::hal::SchmersalLss300::setMonitoring
void setMonitoring(const Monitoring &monitoring)
Definition: SchmersalLss300.cpp:478
rl::hal::SchmersalLss300::getStartAngle
::rl::math::Real getStartAngle() const
Definition: SchmersalLss300.cpp:184
rl::hal::SchmersalLss300::crc
::std::uint16_t crc(const ::std::uint8_t *buf, const ::std::size_t &len) const
Definition: SchmersalLss300.cpp:90
rl::hal::SchmersalLss300::BaudRate
BaudRate
Definition: SchmersalLss300.h:49
rl::hal::SchmersalLss300::setBaudRate
void setBaudRate(const BaudRate &baudRate)
Definition: SchmersalLss300.cpp:415
rl::hal::SchmersalLss300::waitAck
bool waitAck()
Definition: SchmersalLss300.cpp:570
Serial.h
rl::hal::SchmersalLss300::BAUDRATE_38400BPS
@ BAUDRATE_38400BPS
38,400 bps.
Definition: SchmersalLss300.h:55
rl::hal::SchmersalLss300::BAUDRATE_57600BPS
@ BAUDRATE_57600BPS
57,600 bps.
Definition: SchmersalLss300.h:57
rl::hal::SchmersalLss300::BAUDRATE_9600BPS
@ BAUDRATE_9600BPS
9,600 bps.
Definition: SchmersalLss300.h:51
rl::math::Vector
::Eigen::Matrix< Real, ::Eigen::Dynamic, 1 > Vector
Definition: Vector.h:42
rl::hal::SchmersalLss300::BAUDRATE_19200BPS
@ BAUDRATE_19200BPS
19,200 bps.
Definition: SchmersalLss300.h:53
rl::hal::SchmersalLss300::~SchmersalLss300
virtual ~SchmersalLss300()
Definition: SchmersalLss300.cpp:65
rl::hal::SchmersalLss300::serial
Serial serial
Definition: SchmersalLss300.h:143
rl::hal::Lidar
Definition: Lidar.h:37
rl::hal::SchmersalLss300::getBaudRate
BaudRate getBaudRate() const
Definition: SchmersalLss300.cpp:113
rl::hal::Serial
Definition: Serial.h:48
rl::hal::CyclicDevice
Definition: CyclicDevice.h:39
rl::hal::SchmersalLss300::Monitoring
Monitoring
Definition: SchmersalLss300.h:69
rl::hal::SchmersalLss300::monitoring
Monitoring monitoring
Definition: SchmersalLss300.h:139
rl::hal::SchmersalLss300::getResolution
::rl::math::Real getResolution() const
Definition: SchmersalLss300.cpp:176
rl::hal::SchmersalLss300::close
void close()
Definition: SchmersalLss300.cpp:70
rl::hal::SchmersalLss300::MONITORING_SINGLE
@ MONITORING_SINGLE
Definition: SchmersalLss300.h:71
Device.h
rl::hal::SchmersalLss300::open
void open()
Definition: SchmersalLss300.cpp:232
rl::hal::SchmersalLss300::recv
::std::size_t recv(::std::uint8_t *buf, const ::std::size_t &len, const ::std::uint8_t &command)
Definition: SchmersalLss300.cpp:304
rl::hal::SchmersalLss300::getMonitoring
Monitoring getMonitoring() const
Definition: SchmersalLss300.cpp:168
rl::hal::SchmersalLss300::MONITORING_CONTINUOUS
@ MONITORING_CONTINUOUS
Definition: SchmersalLss300.h:70
rl::hal::SchmersalLss300::password
::std::string password
Definition: SchmersalLss300.h:141
rl::hal::SchmersalLss300::getDistancesCount
::std::size_t getDistancesCount() const
Definition: SchmersalLss300.cpp:146
rl::hal::SchmersalLss300::stop
void stop()
Definition: SchmersalLss300.cpp:559
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:40
rl::hal::SchmersalLss300::step
void step()
Definition: SchmersalLss300.cpp:539
rl::hal::SchmersalLss300::desired
BaudRate desired
Definition: SchmersalLss300.h:137
rl::hal::SchmersalLss300::getDistancesMinimum
::rl::math::Real getDistancesMinimum(const ::std::size_t &i) const
Definition: SchmersalLss300.cpp:160
CyclicDevice.h
rl::hal::SchmersalLss300::getDistancesMaximum
::rl::math::Real getDistancesMaximum(const ::std::size_t &i) const
Definition: SchmersalLss300.cpp:152
Lidar.h
rl::math::Real
double Real
Definition: Real.h:42
rl::hal::SchmersalLss300::data
::std::array< ::std::uint8_t, 1013 > data
Definition: SchmersalLss300.h:135
rl::hal::SchmersalLss300::send
void send(::std::uint8_t *buf, const ::std::size_t &len)
Definition: SchmersalLss300.cpp:388
rl::hal::SchmersalLss300
Schmersal LSS 300 safety laser scanner.
Definition: SchmersalLss300.h:46
rl
Robotics Library.
Definition: AnalogInput.cpp:30