Transforming robot_pose_ekf/odom to another frame - problem
Hi all,
I am currently trying to take the output of robot_pose_ekf/odom (a geometry_msgs/PoseWithCovarianceStamped) and transform this to another frame (not the world frame). I have tried the following:
void odomCallback(const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped>& msg);
tf::TransformListener tf_;
tf::MessageFilter<geometry_msgs::PoseWithCovarianceStamped> * tf_filter_;
message_filters::Subscriber<geometry_msgs::PoseWithCovarianceStamped> odom_sub_;
Within my Node's constructor:
std::string target_frame_("minefield");
tf_filter_ = new tf::MessageFilter<geometry_msgs::PoseWithCovarianceStamped>(odom_sub_, tf_, target_frame_, 10);
tf_filter_->registerCallback( boost::bind(&Robot::odomCallback, this, _1) );
And the callback:
void Robot::odomCallback(const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped>& msg)
{
cout << "msg->header.frame_id: " << msg->header.frame_id << endl;
x_ = msg->pose.pose.position.x;
y_ = msg->pose.pose.position.y;
yaw_ = tf::getYaw(msg->pose.pose.orientation);
}
And the error message:
/usr/include/boost/function/function_template.hpp:1064:16: instantiated from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = boost::_bi::bind_t<void, boost::_mfi::mf1<void, Robot, const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&>, boost::_bi::list2<boost::_bi::value<Robot*>, boost::arg<1> > >, R = void, T0 = const boost::shared_ptr<const geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/opt/ros/hydro/include/message_filters/simple_filter.h:75:85: instantiated from ‘message_filters::Connection message_filters::SimpleFilter<M>::registerCallback(const C&) [with C = boost::_bi::bind_t<void, boost::_mfi::mf1<void, Robot, const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&>, boost::_bi::list2<boost::_bi::value<Robot*>, boost::arg<1> > >, M = geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> >]’
/home/dime/hratc2014_workspace_3.1/src/bb_nav/src/bb_rwalk_simple.cpp:240:79: instantiated from here
/usr/include/boost/bind/bind.hpp:313:9: error: no match for call to ‘(boost::_mfi::mf1<void, Robot, const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&>) (Robot*&, const boost::shared_ptr<const geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&)’
/usr/include/boost/bind/mem_fn_template.hpp:136:65: note: candidates are:
/usr/include/boost/bind/mem_fn_template.hpp:163:7: note: R boost::_mfi::mf1<R, T, A1>::operator()(T*, A1) const [with R = void, T = Robot, A1 = const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&]
/usr/include/boost/bind/mem_fn_template.hpp:163:7: note: no known conversion for argument 2 from ‘const boost::shared_ptr<const geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >’ to ‘const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&’
/usr/include/boost/bind/mem_fn_template.hpp:168:25: note: template<class U> R boost::_mfi::mf1::operator()(U&, A1) const [with U = U, R = void, T = Robot, A1 = const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&]
/usr/include/boost/bind/mem_fn_template.hpp:176:25: note: template<class U> R boost::_mfi::mf1::operator()(const U&, A1) const [with U = U, R = void, T = Robot, A1 = const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&]
/usr/include/boost/bind/mem_fn_template.hpp:184:7: note: R boost::_mfi::mf1<R, T, A1>::operator()(T&, A1) const [with R = void, T = Robot, A1 = const boost::shared_ptr<geometry_msgs::PoseWithCovarianceStamped_<std::allocator<void> > >&]
/usr/include/boost ...
What is the actual error? I'm not sure it's relevant, but you went from nav_msgs::Odometry to geometry_msgs::PoseWithCovarianceStamped::ConstPtr&. Try geometry_msgs::PoseWithCovarianceStamped. Can you post the actual PoseWithCovarianceStamped code that isn't working?