37 #include <sensor_msgs/LaserScan.h> 53 void update(
const sensor_msgs::LaserScan& input_scan)
55 sensor_msgs::LaserScan filtered_scan;
56 filtered_scan = input_scan;
58 double angle = filtered_scan.angle_min - filtered_scan.angle_increment;
59 geometry_msgs::PointStamped p_input;
60 p_input.header = input_scan.header;
62 for(
size_t i=0; i < filtered_scan.ranges.size(); i++)
64 angle += filtered_scan.angle_increment;
65 if(filtered_scan.ranges[i] >= filtered_scan.range_max)
continue;
67 p_input.point.x =
cos(angle) * filtered_scan.ranges[i];
68 p_input.point.y =
sin(angle) * filtered_scan.ranges[i];
70 geometry_msgs::PointStamped p_transformed;
74 ROS_ERROR(
"Received an exception trying to transform a point: %s", ex.what());
80 filtered_scan.ranges[i] = filtered_scan.range_max + 1.0;
107 int main(
int argc,
char** argv)
109 ros::init(argc, argv,
"laser_footprint_filter");
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())
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin(Spinner &spinner)
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)
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)