ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I am not exactly sure what you really want to achieve but I have done something similar in my project.
I use actionlib to send goals to the robot and wait until the goal have been reached. Then I recorded the position of the robot for later analysis. You can see a part of the code below. It of cause requires that the whole navigation stack is running.
goal.target_pose.header.frame_id = "/map";
goal.target_pose.header.stamp = ros::Time::now();
goal.target_pose.pose.position.x = 1.5;
goal.target_pose.pose.position.y = -7.0;
angle = tf::createQuaternionFromRPY(0.0, 0.0, -M_PI_2 );
goal.target_pose.pose.orientation.x = (float)angle.x();
goal.target_pose.pose.orientation.y = (float)angle.y();
goal.target_pose.pose.orientation.z = (float)angle.z();
goal.target_pose.pose.orientation.w = (float)angle.w();
ROS_INFO("Sending goal");
ac.sendGoal(goal);
ac.waitForResult();
try {
listener.waitForTransform("/odom", "/base_link", ros::Time::now(), ros::Duration(0.5));
listener.lookupTransform("/odom", "/base_link", ros::Time::now(), transform);
}
catch( tf::TransformException ex ) {
ROS_ERROR("%s", ex.what() );
}
ROS_INFO("Ground truth: %f %f", transform.getOrigin().x(), transform.getOrigin().y());