HI,
I have saved a rosbag with the goal topic of an action:
...
messages: 1
compression: none [1/1 chunks]
types: control_msgs/FollowJointTrajectoryActionGoal [cff5c1d533bf2f82dd0138d57f4304bb]
topics: /robot_joint_trajectory_action_controller/follow_joint_trajectory/goal 1 msg : control_msgs/FollowJointTrajectoryActionGoal
What I was trying to do was to copy this 1 message to a variable so I can call the service with this saved goal within my cpp node:
rosbag::Bag bag;
bag.open("test.bag", rosbag::bagmode::Read);
std::vector topics;
topics.push_back(std::string("/robot_joint_trajectory_action_controller/follow_joint_trajectory/goal"));
rosbag::View view(bag, rosbag::TopicQuery(topics));
foreach(rosbag::MessageInstance const m, view)
{
control_msgs::FollowJointTrajectoryActionGoal::ConstPtr s = m.instantiate();
if (s != NULL){
goal=s;
}
}
bag.close();
//ac.sendGoal(goal);
//wait for the action to return
bool finished_before_timeout = ac.waitForResult(ros::Duration(30.0));
if (finished_before_timeout)
{
actionlib::SimpleClientGoalState state = ac.getState();
ROS_INFO("Action finished: %s",state.toString().c_str());
}
else{
ROS_INFO("Action did not finish before the time out.");
}
Of course i cannot do s=goal. How to do this?
Thanks!
↧