laser.h
Go to the documentation of this file.
1 
34 #ifndef MULTISENSE_ROS_LASER_H
35 #define MULTISENSE_ROS_LASER_H
36 
37 #include <mutex>
38 
39 #include <ros/ros.h>
40 #include <sensor_msgs/LaserScan.h>
41 #include <sensor_msgs/JointState.h>
42 #include <sensor_msgs/PointCloud2.h>
46 
47 #include <multisense_lib/MultiSenseChannel.hh>
48 
49 namespace multisense_ros {
50 
51 class Laser {
52 public:
54  const std::string& tf_prefix);
55  ~Laser();
56 
57  void scanCallback(const crl::multisense::lidar::Header& header);
59 
60  static const float EXPECTED_RATE;
61 
62 private:
63 
64  //
65  // Device stream control
66 
67  void subscribe();
68  void unsubscribe();
69  void stop();
70 
71  //
72  // Transform boadcasting
73  void publishStaticTransforms(const ros::Time& time);
74  void publishSpindleTransform(const float spindle_angle, const float velocity, const ros::Time& time);
75 
77 
78  void defaultTfPublisher(const ros::TimerEvent& event);
79 
80  //
81  // Query transforms
82 
83  tf2::Transform getSpindleTransform(float spindle_angle);
84 
85  //
86  // Calibration from sensor
87 
89 
92 
93  //
94  // Frames to Publish
95  std::string left_camera_optical_;
96  std::string motor_;
97  std::string spindle_;
98  std::string hokuyo_;
99 
100  //
101  // Scan publishing
102 
105  std::string frame_id_;
106 
107  //
108  // Raw data publishing
109 
114 
115  //
116  // Keep around for efficiency
117 
118  sensor_msgs::LaserScan laser_msg_;
119  sensor_msgs::PointCloud2 point_cloud_;
120  sensor_msgs::JointState joint_states_;
121 
122  //
123  // Subscriptions
124 
125  std::mutex sub_lock_;
126  int32_t subscribers_;
127 
128  //
129  // Timer used to publish the default laser transforms
130 
132 
133  //
134  // Spindle angle used when publishing the default transforms
135 
137 
138 
139  //
140  // Track publishing rates
141 
143 
144 
145 }; // class
146 
147 }// namespace
148 
149 
150 #endif
Laser(crl::multisense::Channel *driver, const std::string &tf_prefix)
Definition: laser.cpp:98
sensor_msgs::JointState joint_states_
Definition: laser.h:120
std::mutex sub_lock_
Definition: laser.h:125
void defaultTfPublisher(const ros::TimerEvent &event)
Definition: laser.cpp:459
crl::multisense::lidar::Calibration lidar_cal_
Definition: laser.h:88
sensor_msgs::LaserScan laser_msg_
Definition: laser.h:118
std::string hokuyo_
Definition: laser.h:98
std::string frame_id_
Definition: laser.h:105
ros::Publisher raw_lidar_cal_pub_
Definition: laser.h:112
float spindle_angle_
Definition: laser.h:136
ros::Publisher raw_lidar_data_pub_
Definition: laser.h:110
static const float EXPECTED_RATE
Definition: laser.h:60
void publishSpindleTransform(const float spindle_angle, const float velocity, const ros::Time &time)
Definition: laser.cpp:440
crl::multisense::Channel * driver_
Definition: laser.h:103
tf2_ros::StaticTransformBroadcaster static_tf_broadcaster_
Definition: laser.h:76
std::string motor_
Definition: laser.h:96
ros::Publisher joint_states_pub_
Definition: laser.h:113
sensor_msgs::PointCloud2 point_cloud_
Definition: laser.h:119
std::string spindle_
Definition: laser.h:97
ros::Publisher scan_pub_
Definition: laser.h:104
ros::Time previous_scan_time_
Definition: laser.h:142
int32_t subscribers_
Definition: laser.h:126
ros::Timer timer_
Definition: laser.h:131
void scanCallback(const crl::multisense::lidar::Header &header)
Definition: laser.cpp:349
tf2::Transform getSpindleTransform(float spindle_angle)
Definition: laser.cpp:447
ros::Publisher point_cloud_pub_
Definition: laser.h:111
void pointCloudCallback(const crl::multisense::lidar::Header &header)
Definition: laser.cpp:282
std::string left_camera_optical_
Definition: laser.h:95
tf2::Transform motor_to_camera_
Definition: laser.h:90
tf2::Transform laser_to_spindle_
Definition: laser.h:91
void publishStaticTransforms(const ros::Time &time)


multisense_ros
Author(s):
autogenerated on Sun Mar 14 2021 02:34:55