Using laser_filter node.
Hello, I'm trying to get the "scan_to_cloud_filter_chain", located in the laser_filter node, to execute but it keeps giving me the error :
[ WARN] [1317231063.120226126]: Use of default '~target_frame' parameter in scan_to_cloud_filter_chain has been deprecated. Default currently set to 'base_link' please set explicitly as appropriate.
When I get this error nothing appears in Rviz.
I am using the laser scan data provided by ROS. This data is located on the same page as the Laser Filtering tutorial.
This is the tutorial I am following Laser filtering using the filtering nodes
Here is the source code take directly from the laser_filter node :
#include <ros/ros.h>
#include <sensor_msgs/PointCloud.h>
#include <sensor_msgs/LaserScan.h>
#include <float.h>
// Laser projection
#include <laser_geometry/laser_geometry.h>
// TF
#include <tf/transform_listener.h>
#include "tf/message_filter.h"
#include "message_filters/subscriber.h"
//Filters
#include "filters/filter_chain.h"
class ScanToCloudFilterChain
{
public:
// ROS related
laser_geometry::LaserProjection projector_; // Used to project laser scans
double laser_max_range_; // Used in laser scan projection
int window_;
bool high_fidelity_; // High fidelity (interpolating time across scan)
std::string target_frame_; // Target frame for high fidelity result
std::string scan_topic_, cloud_topic_;
ros::NodeHandle nh;
ros::NodeHandle private_nh;
// TF
tf::TransformListener tf_;
message_filters::Subscriber<sensor_msgs::LaserScan> sub_;
tf::MessageFilter<sensor_msgs::LaserScan> filter_;
double tf_tolerance_;
filters::FilterChain<sensor_msgs::PointCloud> cloud_filter_chain_;
filters::FilterChain<sensor_msgs::LaserScan> scan_filter_chain_;
ros::Publisher cloud_pub_;
// Timer for displaying deprecation warnings
ros::Timer deprecation_timer_;
bool using_scan_topic_deprecated_;
bool using_cloud_topic_deprecated_;
bool using_default_target_frame_deprecated_;
bool using_laser_max_range_deprecated_;
bool using_filter_window_deprecated_;
bool using_scan_filters_deprecated_;
bool using_cloud_filters_deprecated_;
bool using_scan_filters_wrong_deprecated_;
bool using_cloud_filters_wrong_deprecated_;
////////////////////////////////////////////////////////////////////////////////
ScanToCloudFilterChain () : laser_max_range_ (DBL_MAX), private_nh("~"), filter_(tf_, "", 50),
cloud_filter_chain_("sensor_msgs::PointCloud"), scan_filter_chain_("sensor_msgs::LaserScan")
{
private_nh.param("high_fidelity", high_fidelity_, false);
private_nh.param("notifier_tolerance", tf_tolerance_, 0.03);
private_nh.param("target_frame", target_frame_, std::string ("base_link"));
// DEPRECATED with default value
using_default_target_frame_deprecated_ = !private_nh.hasParam("target_frame");
// DEPRECATED
using_scan_topic_deprecated_ = private_nh.hasParam("scan_topic");
using_cloud_topic_deprecated_ = private_nh.hasParam("cloud_topic");
using_laser_max_range_deprecated_ = private_nh.hasParam("laser_max_range");
using_filter_window_deprecated_ = private_nh.hasParam("filter_window");
using_cloud_filters_deprecated_ = private_nh.hasParam("cloud_filters/filter_chain");
using_scan_filters_deprecated_ = private_nh.hasParam("scan_filters/filter_chain");
using_cloud_filters_wrong_deprecated_ = private_nh.hasParam("cloud_filters/cloud_filter_chain");
using_scan_filters_wrong_deprecated_ = private_nh.hasParam("scan_filters/scan_filter_chain");
private_nh.param("filter_window", window_, 2);
private_nh.param("laser_max_range", laser_max_range_, DBL_MAX);
private_nh.param("scan_topic", scan_topic_, std::string("tilt_scan"));
private_nh.param("cloud_topic", cloud_topic_, std::string("tilt_laser_cloud_filtered"));
filter_.setTargetFrame(target_frame_);
filter_.registerCallback(boost::bind(&ScanToCloudFilterChain::scanCallback, this, _1));
filter_.setTolerance(ros::Duration(tf_tolerance_));
if (using_scan_topic_deprecated_)
sub_.subscribe(nh, scan_topic_, 50);
else
sub_.subscribe(nh, "scan", 50);
filter_.connectInput(sub_);
if (using_cloud_topic_deprecated_)
cloud_pub_ = nh.advertise<sensor_msgs::PointCloud> (cloud_topic_, 10);
else
cloud_pub_ = nh.advertise<sensor_msgs::PointCloud> ("cloud_filtered", 10);
std::string cloud_filter_xml;
if (using_cloud_filters_deprecated_)
cloud_filter_chain_.configure("cloud_filters/filter_chain", private_nh);
else if (using_cloud_filters_wrong_deprecated_)
cloud_filter_chain_.configure("cloud_filters/cloud_filter_chain", private_nh);
else
cloud_filter_chain_.configure("cloud_filter_chain", private_nh);
if (using_scan_filters_deprecated_)
scan_filter_chain_.configure("scan_filter/filter_chain", private_nh);
else if (using_scan_filters_wrong_deprecated_)
scan_filter_chain_.configure("scan_filters/scan_filter_chain", private_nh);
else
scan_filter_chain_.configure("scan_filter_chain", private_nh);
deprecation_timer_ = nh.createTimer(ros::Duration(5.0), boost::bind(&ScanToCloudFilterChain::deprecation_warn, this, _1));
}
// We use a deprecation warning on a timer to avoid warnings getting lost in the noise
void deprecation_warn(const ros::TimerEvent& e)
{
if (using_scan_topic_deprecated_)
ROS_WARN("Use of '~scan_topic' parameter in scan_to_cloud_filter_chain has been deprecated.");
if (using_cloud_topic_deprecated_)
ROS_WARN("Use of '~cloud_topic' parameter in scan_to_cloud_filter_chain has been deprecated.");
if (using_laser_max_range_deprecated_)
ROS_WARN("Use of ...