ros melodic tf to tf2 migration
Currently running ros melodic/ubuntu 18.0 and compiling this global planner code (which was written for ros indigo) gives the error message:
error: no matching function for call to ‘costmap_2d::Costmap2DROS::getRobotPose(tf::Stamped<tf::Transform>&)’
if(dynamic_costmap_->getStaticROSCostmap()->getRobotPose(robot_pose))
Snippet of code as follows:
try
{
geometry_msgs::Twist prev_vel = current_plan_.velocities.at(i - 2);
if(prev_vel.linear.x == 0 && replanning_start_vel.linear.x == 0)
{
ROS_DEBUG("turn in place. update pose with amcl");
tf::Stamped<tf::Transform> robot_pose;
if(dynamic_costmap_->getStaticROSCostmap()->getRobotPose(robot_pose))
{
conti_pose.pose.position.x = robot_pose.getOrigin().getX();
conti_pose.pose.position.y = robot_pose.getOrigin().getY();
}
}
}
i'm suspecting this is because of the migration from tf to tf2. However i am really new to ROS and coding in general. I have tried reading the tf ros wiki, but it's really complicated and seems like i have to get a full understanding behind the workings of tf.
So i was wondering if there is any quick fix or how can i rewrite this particular part of the code?