Robotics Library  0.6.2
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 <rl/util/Timer.h>
31 
32 #include "Device.h"
33 #include "Lidar.h"
34 #include "Serial.h"
35 #include "types.h"
36 
37 namespace rl
38 {
39  namespace hal
40  {
41  class SickS300 : public Lidar
42  {
43  public:
44  SickS300(
45  const ::std::string& device = "/dev/ttyS0",
47  );
48 
49  virtual ~SickS300();
50 
51  void close();
52 
53  void getDistances(::rl::math::Vector& distances) const;
54 
55  ::std::size_t getDistancesCount() const;
56 
57  ::rl::math::Real getDistancesMaximum(const ::std::size_t& i) const;
58 
59  ::rl::math::Real getDistancesMinimum(const ::std::size_t& i) const;
60 
62 
63  ::std::size_t getScanNumber() const;
64 
66 
68 
69  ::std::size_t getTelegramNumber() const;
70 
71  void open();
72 
73  void start();
74 
75  void step();
76 
77  void stop();
78 
79  protected:
80 
81  private:
82  uint16_t crc(const uint8_t* buf, const ::std::size_t& len) const;
83 
84  ::std::size_t recv(uint8_t* buf);
85 
86  uint8_t data[2048];
87 
89  };
90  }
91 }
92 
93 #endif // _RL_HAL_SICKS300_H_
rl::hal::SickS300::recv
::std::size_t recv(uint8_t *buf)
Definition: SickS300.cpp:223
rl::hal::SickS300::stop
void stop()
Definition: SickS300.cpp:396
rl::hal::SickS300::crc
uint16_t crc(const uint8_t *buf, const ::std::size_t &len) const
Definition: SickS300.cpp:108
types.h
rl::hal::SickS300::open
void open()
Definition: SickS300.cpp:215
rl::hal::SickS300::getResolution
::rl::math::Real getResolution() const
Definition: SickS300.cpp:176
Serial.h
rl::hal::SickS300::start
void start()
Definition: SickS300.cpp:382
Timer.h
rl::hal::Lidar
Definition: Lidar.h:37
rl::hal::Serial
Definition: Serial.h:46
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:167
rl::hal::SickS300::data
uint8_t data[2048]
Definition: SickS300.h:86
rl::hal::SickS300::getStartAngle
::rl::math::Real getStartAngle() const
Definition: SickS300.cpp:193
Device.h
rl::hal::SickS300::step
void step()
Definition: SickS300.cpp:388
rl::hal::SickS300::getDistances
void getDistances(::rl::math::Vector &distances) const
Definition: SickS300.cpp:121
rl::hal::SickS300::serial
Serial serial
Definition: SickS300.h:88
rl::hal::SickS300
Definition: SickS300.h:42
rl::hal::SickS300::getTelegramNumber
::std::size_t getTelegramNumber() const
Definition: SickS300.cpp:209
rl::hal::Serial::BaudRate
BaudRate
Definition: Serial.h:49
rl::hal::SickS300::getScanNumber
::std::size_t getScanNumber() const
Definition: SickS300.cpp:184
rl::math::Vector
::Eigen::Matrix< Real, ::Eigen::Dynamic, 1 > Vector
Definition: Vector.h:41
rl::hal::SickS300::SickS300
SickS300(const ::std::string &device="/dev/ttyS0", const Serial::BaudRate &baudRate=Serial::BAUDRATE_9600BPS)
Definition: SickS300.cpp:76
rl::hal::SickS300::getDistancesMaximum
::rl::math::Real getDistancesMaximum(const ::std::size_t &i) const
Definition: SickS300.cpp:158
rl::hal::SickS300::getStopAngle
::rl::math::Real getStopAngle() const
Definition: SickS300.cpp:201
rl::hal::SickS300::getDistancesCount
::std::size_t getDistancesCount() const
Definition: SickS300.cpp:150
Lidar.h
rl::math::Real
double Real
Definition: Real.h:34
rl::hal::Serial::BAUDRATE_9600BPS
@ BAUDRATE_9600BPS
9,600 bps.
Definition: Serial.h:63
rl::hal::SickS300::~SickS300
virtual ~SickS300()
Definition: SickS300.cpp:93
rl
Definition: Ati.cpp:35