/arm_left_controller/follow_joint_trajectory
#
Caution
This documentation page has been auto-generated.
It may be missing some details.
/arm_left_controller/follow_joint_trajectory
Quick Facts
- Category
- Message type
Quick snippets#
$ rostopic pub /arm_left_controller/follow_joint_trajectory/goal control_msgs/FollowJointTrajectoryActionGoal # press Tab to complete the message prototype
How to use in your code#
#!/usr/bin/env python
import rospy
import actionlib
from control_msgs.msg import *
if __name__ == "__main__":
client = actionlib.SimpleActionClient("/arm_left_controller/follow_joint_trajectory", control_msgs.msg.FollowJointTrajectoryAction)
client.wait_for_server()
# check http://docs.ros.org/en/api/control_msgs/html/action/FollowJointTrajectory.html
# for the possible goal parameters
goal = control_msgs.msg.FollowJointTrajectoryGoal(param1=..., param2=...)
client.send_goal(goal)
client.wait_for_result()
rospy.loginfo("Action returned: %s" % client.get_result())
#include <ros/ros.h>
#include <actionlib/client/simple_action_client.h>
#include <actionlib/client/terminal_state.h>
#include <control_msgs/FollowJointTrajectoryAction.h>
int main (int argc, char **argv)
{
ros::init(argc, argv, "arm_left_controller_follow_joint_trajectory_action_client");
// create the action client
// true causes the client to spin its own thread
actionlib::SimpleActionClient<:control_msgs::FollowJointTrajectoryAction> ac("/arm_left_controller/follow_joint_trajectory", true);
ROS_INFO("Waiting for action server to start.");
// wait for the action server to start
ac.waitForServer(); //will wait for infinite time
ROS_INFO("Action server started, sending goal.");
// send a goal to the action
control_msgs::FollowJointTrajectoryGoal goal;
// check http://docs.ros.org/en/api/control_msgs/html/action/FollowJointTrajectory.html
// for the possible goal parameters
// goal.... = ...;
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.");
ac.cancelGoal();
}
return 0;
}