xv11_laser.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Eric Perko, Chad Rockey
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Case Western Reserve University nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 #include <sensor_msgs/LaserScan.h>
36 #include <boost/asio.hpp>
37 #include <boost/array.hpp>
38 #include <string>
39 
40 namespace xv_11_laser_driver {
41  class XV11Laser {
42  public:
43  uint16_t rpms;
44 
50  XV11Laser(const std::string& port, uint32_t baud_rate, uint32_t firmware, boost::asio::io_service& io);
51 
55  ~XV11Laser() {};
56 
61  void poll(sensor_msgs::LaserScan::Ptr scan);
62 
66  void close() { shutting_down_ = true; };
67 
68  private:
69  std::string port_;
70  uint32_t baud_rate_;
71  uint32_t firmware_;
72 
74  boost::asio::serial_port serial_;
75  uint16_t motor_speed_;
76  };
77 };
std::string port_
The serial port the driver is attached to.
Definition: xv11_laser.h:66
bool shutting_down_
Flag for whether the driver is supposed to be shutting down or not.
Definition: xv11_laser.h:73
uint32_t firmware_
The firmware version to check. Currently supports two different versions: 1 and 2.
Definition: xv11_laser.h:71
void close()
Close the driver down and prevent the polling loop from advancing.
Definition: xv11_laser.h:66
uint32_t baud_rate_
The baud rate for the serial connection.
Definition: xv11_laser.h:70
uint16_t rpms
RPMS derived from the rpm bytes in an XV11 packet.
Definition: xv11_laser.h:43
boost::asio::serial_port serial_
Actual serial port object for reading/writing to the XV11 Laser Scanner.
Definition: xv11_laser.h:74
uint16_t motor_speed_
current motor speed as reported by the XV11.
Definition: xv11_laser.h:75
XV11Laser(const std::string &port, uint32_t baud_rate, uint32_t firmware, boost::asio::io_service &io)
Constructs a new XV11Laser attached to the given serial port.
Definition: xv11_laser.cpp:38
void poll(sensor_msgs::LaserScan::Ptr scan)
Poll the laser to get a new scan. Blocks until a complete new scan is received or close is called...
Definition: xv11_laser.cpp:43
~XV11Laser()
Default destructor.
Definition: xv11_laser.h:55


xv_11_laser_driver
Author(s): Eric Perko, Chad Rockey, Rohan Agrawal, Steve 'dillo Okay
autogenerated on Mon Jun 10 2019 15:48:10