36 const std::string& topic,
37 const std::string& frame_id,
39 const Degree& x_axis_rotation,
40 std::unique_ptr<vScanner> scanner)
41 : nh_(nh), frame_id_(frame_id), skip_(skip), scanner_(
std::move(scanner)), x_axis_rotation_(x_axis_rotation)
60 return static_cast<double>(deg) * M_PI / 180.0;
83 uint16_t expected_size =
85 if (expected_size != laserscan.
measures_.size())
98 ros_message.range_min = 0;
99 ros_message.range_max = 10;
100 ros_message.ranges.insert(ros_message.ranges.end(),
103 std::transform(ros_message.ranges.begin(), ros_message.ranges.end(), ros_message.ranges.begin(), [](
float f) {
115 uint16_t skip_counter = 0;
123 if (skip_counter ==
skip_)
130 ROS_WARN_STREAM(
"Could not build a coherent message: " << e.what() <<
" Skipping this message.");
143 ROS_WARN_STREAM(
"Could not build ROS message: " << e.what() <<
" Skipping this message.");
146 if (++skip_counter >
skip_)
Class to model angles in degrees from user's perspective.
Class to hold the data for one laserscan without depencies to ROS.
struct psen_scan::LaserScan LaserScan
Class to hold the data for one laserscan without depencies to ROS.
void publish(const boost::shared_ptr< M > &message) const
std::vector< uint16_t > measures_
#define ROS_FATAL_STREAM(args)
PSENscanInternalAngle const min_scan_angle_
double degToRad(const Degree °)
Convert angle in deg to rad.
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
sensor_msgs::LaserScan buildRosMessage(const LaserScan &laserscan)
Creates a ROS message from an LaserScan, which contains one scanning round.
#define ROS_WARN_STREAM(args)
PSENscanInternalAngle const max_scan_angle_
PSENscanInternalAngle resolution_
ROSScannerNode(ros::NodeHandle &nh, const std::string &topic, const std::string &frame_id, const uint16_t &skip, const Degree &x_axis_rotation, std::unique_ptr< vScanner > scanner)
Construct a new ROSScannerNode::ROSScannerNode object.
Class to model angles in PSENscan internal format (tenth of degrees)
void processingLoop()
endless loop for processing incoming UDP data from the laser scanner
uint16_t const NUMBER_OF_SAMPLES_FULL_SCAN_MASTER
std::unique_ptr< vScanner > scanner_