51 nh_private_(nh_private)
53 ROS_INFO (
"Starting LaserScanDensifier");
62 ROS_ERROR(
"LaserScanDensifier has step parameter set to %d, must be > 0! Not initiating subscriptions...",
step_);
67 case 0:
ROS_INFO(
"LaserScanDensifier started with mode %d: copy data points",
mode_);
69 case 1:
ROS_INFO(
"LaserScanDensifier started with mode %d: interpolate data points",
mode_);
71 default:
ROS_WARN(
"LaserScanDensifier started with unsupported mode %d. Defaulting to mode 0: copy data points",
mode_);
87 ROS_INFO (
"Destroying LaserScanDensifier");
92 sensor_msgs::LaserScan::Ptr scan_dense;
93 scan_dense = boost::make_shared<sensor_msgs::LaserScan>();
97 scan_dense->header = scan_msg->header;
98 scan_dense->range_min = scan_msg->range_min;
99 scan_dense->range_max = scan_msg->range_max;
100 scan_dense->angle_min = scan_msg->angle_min;
101 scan_dense->angle_max = scan_msg->angle_max;
102 scan_dense->angle_increment = scan_msg->angle_increment /
step_;
103 scan_dense->time_increment = scan_msg->time_increment;
104 scan_dense->scan_time = scan_msg->scan_time;
106 scan_dense->ranges.clear();
107 scan_dense->intensities.clear();
109 for (
size_t i = 0; i < scan_msg->ranges.size()-1; i++)
113 scan_dense->ranges.insert(scan_dense->ranges.end(),
step_, scan_msg->ranges[i]);
114 scan_dense->intensities.insert(scan_dense->intensities.end(),
step_, scan_msg->intensities[i]);
118 double delta_range = (scan_msg->ranges[i+1]-scan_msg->ranges[i])/
step_;
119 double delta_intensities = (scan_msg->intensities[i+1]-scan_msg->intensities[i])/
step_;
120 for (
int k = 0; k <
step_; k++) {
121 scan_dense->ranges.insert(scan_dense->ranges.end(), 1, scan_msg->ranges[i]+k*delta_range);
122 scan_dense->intensities.insert(scan_dense->intensities.end(), 1, scan_msg->intensities[i]+k*delta_intensities);
129 scan_dense->ranges.push_back(scan_msg->ranges.back());
130 scan_dense->intensities.push_back(scan_msg->intensities.back());
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)