laser.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2022, Autonics Co.,Ltd.
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
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided
15 * with the distribution.
16 *
17 * * Neither the name of the Autonics Co.,Ltd 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 HOLDER 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 
36 
37 #ifndef LASER_H
38 #define LASER_H
39 
40 #include <ros/ros.h>
41 #include "std_msgs/String.h"
42 #include <sensor_msgs/LaserScan.h>
43 
46 
47 #include "socket.hpp"
48 #include "parser.hpp"
49 
50 #define CONNECT_ATTEMPT_CNT 999
51 
52 class AutoLaser
53 {
54 public:
55  AutoLaser();
56  ~AutoLaser();
57 
58  int laserInit(void);
59  int run(void);
60 
61 
62 private:
63  bool checkConnection();
64 
65  void watchingDisconnection(void);
66  std::string itostr(int i);
67  std::string ftostr(float i);
68  unsigned char hexToChar(unsigned int value);
69 
70  int laserSendCommand(const std::string str);
71  int getLaserData(sensor_msgs::LaserScan::Ptr scan_msg);
72  void comSubCallback(const std_msgs::String::ConstPtr& msg);
74  int getLscData(void);
75  void login(std::string password);
76 
80 
83 
86 
87  sensor_msgs::LaserScan::Ptr scan_msg;
89 
91  std::vector<unsigned char> rcv_msg_;
92 
93  std::string topic_name;
94 };
95 
96 #endif
msg
void selfTest(diagnostic_updater::DiagnosticStatusWrapper &status)
Definition: laser.cpp:187
~AutoLaser()
Definition: laser.cpp:50
Definition: parser.hpp:63
int laserSendCommand(const std::string str)
Definition: laser.cpp:109
void watchingDisconnection(void)
Definition: laser.cpp:241
unsigned char hexToChar(unsigned int value)
Definition: laser.cpp:77
ros::Publisher pub_scan
Definition: laser.h:84
diagnostic_updater::Updater diagnostic_topic_updater
Definition: laser.h:79
bool checkConnection()
Definition: laser.cpp:171
sensor_msgs::LaserScan::Ptr scan_msg
Definition: laser.h:87
int laserInit(void)
Definition: laser.cpp:257
ros::NodeHandle n
Definition: laser.h:77
void login(std::string password)
Definition: laser.cpp:101
std::vector< unsigned char > rcv_msg_
Definition: laser.h:91
ros::NodeHandle priv_nh
Definition: laser.h:78
ros::Subscriber sub_cmd
Definition: laser.h:85
Lsc_t lsc
Definition: laser.h:88
std::string itostr(int i)
Definition: laser.cpp:55
void comSubCallback(const std_msgs::String::ConstPtr &msg)
Definition: laser.cpp:94
int getLscData(void)
Definition: laser.cpp:201
std::string topic_name
Definition: laser.h:93
bool rcv_msg_flag_
Definition: laser.h:90
AutoLaser()
Definition: laser.cpp:45
Socket socket
Definition: laser.h:81
int getLaserData(sensor_msgs::LaserScan::Ptr scan_msg)
Definition: laser.cpp:218
int run(void)
Definition: laser.cpp:313
std::string ftostr(float i)
Definition: laser.cpp:66
Parser p
Definition: laser.h:82


lsc_ros_driver
Author(s): Autonics-lidar
autogenerated on Thu Jan 12 2023 03:08:46