28 #include <control_msgs/FollowJointTrajectoryAction.h> 45 traj_client_ =
new TrajClient(
"r_arm_controller/joint_trajectory_action",
true);
50 ROS_INFO(
"Waiting for the joint_trajectory_action server");
86 control_msgs::FollowJointTrajectoryGoal goal;
88 goal.trajectory.joint_names.push_back(
"ShoulderJRotate");
89 goal.trajectory.joint_names.push_back(
"ShoulderJSwing");
90 goal.trajectory.joint_names.push_back(
"ElbowJSwing");
91 goal.trajectory.joint_names.push_back(
"ElbowJRotate");
92 goal.trajectory.joint_names.push_back(
"wrj2");
93 goal.trajectory.joint_names.push_back(
"wrj1");
96 goal.trajectory.points.resize(3);
101 goal.trajectory.points[ind].positions.resize(6);
102 goal.trajectory.points[ind].positions[0] = 0.0;
103 goal.trajectory.points[ind].positions[1] = 0.0;
104 goal.trajectory.points[ind].positions[2] = 1.57;
105 goal.trajectory.points[ind].positions[3] = -0.78;
106 goal.trajectory.points[ind].positions[4] = 0.0;
107 goal.trajectory.points[ind].positions[5] = 0.0;
110 goal.trajectory.points[ind].velocities.resize(6);
111 goal.trajectory.points[ind].velocities[0] = 0.0;
112 goal.trajectory.points[ind].velocities[1] = 0.0;
113 goal.trajectory.points[ind].velocities[2] = 0.0;
114 goal.trajectory.points[ind].velocities[3] = 0.0;
115 goal.trajectory.points[ind].velocities[4] = 0.0;
116 goal.trajectory.points[ind].velocities[5] = 0.0;
119 goal.trajectory.points[ind].time_from_start =
ros::Duration(10.0);
123 goal.trajectory.points[ind].positions.resize(6);
124 goal.trajectory.points[ind].positions[0] = 0.4;
125 goal.trajectory.points[ind].positions[1] = 0.78;
126 goal.trajectory.points[ind].positions[2] = 0.78;
127 goal.trajectory.points[ind].positions[3] = 0.78;
128 goal.trajectory.points[ind].positions[4] = 0.1;
129 goal.trajectory.points[ind].positions[5] = 0.1;
132 goal.trajectory.points[ind].velocities.resize(6);
133 goal.trajectory.points[ind].velocities[0] = 0.3;
134 goal.trajectory.points[ind].velocities[1] = 0.0;
135 goal.trajectory.points[ind].velocities[2] = 0.0;
136 goal.trajectory.points[ind].velocities[3] = 0.0;
137 goal.trajectory.points[ind].velocities[4] = 0.0;
138 goal.trajectory.points[ind].velocities[5] = 0.0;
141 goal.trajectory.points[ind].time_from_start =
ros::Duration(16.0);
144 goal.trajectory.points[ind].positions.resize(6);
145 goal.trajectory.points[ind].positions[0] = 0.6;
146 goal.trajectory.points[ind].positions[1] = 0.48;
147 goal.trajectory.points[ind].positions[2] = 0.78;
148 goal.trajectory.points[ind].positions[3] = 0.78;
149 goal.trajectory.points[ind].positions[4] = 0.1;
150 goal.trajectory.points[ind].positions[5] = 0.1;
153 goal.trajectory.points[ind].velocities.resize(6);
154 goal.trajectory.points[ind].velocities[0] = 0.0;
155 goal.trajectory.points[ind].velocities[1] = 0.0;
156 goal.trajectory.points[ind].velocities[2] = 0.0;
157 goal.trajectory.points[ind].velocities[3] = 0.0;
158 goal.trajectory.points[ind].velocities[4] = 0.0;
159 goal.trajectory.points[ind].velocities[5] = 0.0;
162 goal.trajectory.points[ind].time_from_start =
ros::Duration(20.0);
174 int main(
int argc,
char **argv)
177 ros::init(argc, argv,
"shadow_trajectory_driver");
bool waitForServer(const ros::Duration &timeout=ros::Duration(0, 0)) const
int main(int argc, char **argv)
actionlib::SimpleActionClient< control_msgs::FollowJointTrajectoryAction > TrajClient
actionlib::SimpleClientGoalState getState()
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void startTrajectory(control_msgs::FollowJointTrajectoryGoal goal)
control_msgs::FollowJointTrajectoryGoal arm_movement()
void sendGoal(const Goal &goal, SimpleDoneCallback done_cb=SimpleDoneCallback(), SimpleActiveCallback active_cb=SimpleActiveCallback(), SimpleFeedbackCallback feedback_cb=SimpleFeedbackCallback())
TrajClient * traj_client_
SimpleClientGoalState getState() const