ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Thank for the suggestion
I solved in this way and it works, I don't know if it is the best solution
geometry_msgs::PoseStamped current_position()
{
ros::Time now = ros::Time::now();
geometry_msgs::PoseStamped pose;
pose.header.stamp = now;
pose.header.frame_id = "/base_link";
pose.pose = pose_zero;
tf::StampedTransform my_transform;
try {
mRosTransformListener->waitForTransform("/base_link", "/map", (now+ros::Duration(1.0)), ros::Duration(10.0) );
mRosTransformListener->lookupTransform("/base_link", "/map", now, my_transform);
}
catch (tf::TransformException ex) { ROS_ERROR("%s",ex.what()); }
if (mRosTransformListener->frameExists("/map"))
ROS_INFO ("/map exist");
if (mRosTransformListener->frameExists("/base_link"))
ROS_INFO ("/base_link exist");
try {
mRosTransformListener->transformPose("/map", pose, pose);
}
catch (tf::TransformException ex) { ROS_ERROR("%s",ex.what()); }
ROS_INFO("pose %f %f %f", pose.pose.position.x, pose.pose.position.y, pose.pose.position.z);
return pose;
}
Thank you again for you support
2 | No.2 Revision |
Thank for the suggestion
I solved in this way and it works, I don't know if it is the best solution
geometry_msgs::PoseStamped current_position()
}
Thank you again for you support