Ask Your Question
0

Transforming robot_pose_ekf/odom to another frame - problem

asked 2014-04-30 14:32:39 -0500

dime gravatar image

updated 2014-05-01 06:39:56 -0500

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 ...
(more)
edit retag flag offensive close merge delete

Comments

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?

Tom Moore gravatar image Tom Moore  ( 2014-05-01 04:33:06 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2014-05-02 07:38:54 -0500

Tom Moore gravatar image

updated 2014-05-02 07:40:04 -0500

Looking at your code, the MessageFilter tutorial, and this part of the error:

/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> > >&’

I think your callback function may be missing a const (leaving unformatted so I can use bold):

void odomCallback(const boost::shared_ptr<const geometry_msgs::PoseWithCovarianceStamped>& msg);

There may be another issue, but start with that.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-04-30 14:32:39 -0500

Seen: 433 times

Last updated: May 02 '14