Robotics Library  0.7.0
SickS300.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_SICKS300_H
28 #define RL_HAL_SICKS300_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 SickS300 : public CyclicDevice, public Lidar
46  {
47  public:
48  SickS300(
49  const ::std::string& device = "/dev/ttyS0",
51  );
52 
53  virtual ~SickS300();
54 
55  void close();
56 
58 
59  ::std::size_t getDistancesCount() const;
60 
61  ::rl::math::Real getDistancesMaximum(const ::std::size_t& i) const;
62 
63  ::rl::math::Real getDistancesMinimum(const ::std::size_t& i) const;
64 
66 
67  ::std::size_t getScanNumber() const;
68 
70 
72 
73  ::std::size_t getTelegramNumber() const;
74 
75  void open();
76 
77  void start();
78 
79  void step();
80 
81  void stop();
82 
83  protected:
84 
85  private:
86  ::std::uint16_t crc(const ::std::uint8_t* buf, const ::std::size_t& len) const;
87 
88  ::std::size_t recv(::std::uint8_t* buf);
89 
90  ::std::array< ::std::uint8_t, 2048> data;
91 
93  };
94  }
95 }
96 
97 #endif // RL_HAL_SICKS300_H
rl::hal::SickS300::stop
void stop()
Definition: SickS300.cpp:399
rl::hal::SickS300::open
void open()
Definition: SickS300.cpp:218
rl::hal::SickS300::getResolution
::rl::math::Real getResolution() const
Definition: SickS300.cpp:179
Serial.h
rl::hal::SickS300::start
void start()
Definition: SickS300.cpp:385
rl::hal::SickS300::crc
::std::uint16_t crc(const ::std::uint8_t *buf, const ::std::size_t &len) const
Definition: SickS300.cpp:108
rl::math::Vector
::Eigen::Matrix< Real, ::Eigen::Dynamic, 1 > Vector
Definition: Vector.h:42
rl::hal::Lidar
Definition: Lidar.h:37
rl::hal::Serial
Definition: Serial.h:48
rl::hal::CyclicDevice
Definition: CyclicDevice.h:39
rl::hal::SickS300::close
void close()
Definition: SickS300.cpp:98
rl::hal::SickS300::getDistancesMinimum
::rl::math::Real getDistancesMinimum(const ::std::size_t &i) const
Definition: SickS300.cpp:170
rl::hal::SickS300::recv
::std::size_t recv(::std::uint8_t *buf)
Definition: SickS300.cpp:226
rl::hal::SickS300::getStartAngle
::rl::math::Real getStartAngle() const
Definition: SickS300.cpp:196
Device.h
rl::hal::SickS300::step
void step()
Definition: SickS300.cpp:391
rl::hal::SickS300::serial
Serial serial
Definition: SickS300.h:92
rl::hal::SickS300
Sick S300 safety laser scanner.
Definition: SickS300.h:46
rl::hal::SickS300::getTelegramNumber
::std::size_t getTelegramNumber() const
Definition: SickS300.cpp:212
rl::hal::Serial::BaudRate
BaudRate
Definition: Serial.h:51
rl::hal::SickS300::getScanNumber
::std::size_t getScanNumber() const
Definition: SickS300.cpp:187
CyclicDevice.h
rl::hal::SickS300::SickS300
SickS300(const ::std::string &device="/dev/ttyS0", const Serial::BaudRate &baudRate=Serial::BAUDRATE_9600BPS)
Definition: SickS300.cpp:75
rl::hal::SickS300::getDistancesMaximum
::rl::math::Real getDistancesMaximum(const ::std::size_t &i) const
Definition: SickS300.cpp:161
rl::hal::SickS300::getStopAngle
::rl::math::Real getStopAngle() const
Definition: SickS300.cpp:204
rl::hal::SickS300::getDistancesCount
::std::size_t getDistancesCount() const
Definition: SickS300.cpp:153
Lidar.h
rl::math::Real
double Real
Definition: Real.h:42
rl::hal::Serial::BAUDRATE_9600BPS
@ BAUDRATE_9600BPS
9,600 bps.
Definition: Serial.h:65
rl::hal::SickS300::data
::std::array< ::std::uint8_t, 2048 > data
Definition: SickS300.h:90
rl::hal::SickS300::getDistances
::rl::math::Vector getDistances() const
Definition: SickS300.cpp:121
rl::hal::SickS300::~SickS300
virtual ~SickS300()
Definition: SickS300.cpp:93
rl
Robotics Library.
Definition: AnalogInput.cpp:30