Ask Your Question
2

Effort on Joint Trajectory Controller

asked 2016-09-20 05:32:10 -0500

wilsonz91 gravatar image

Hi,

I would like to ask for some clarification on the use of Joint Trajectory Controller:

I have been able to use it for tracking of sinusoidal wave by specifying position only and tracking trajectories by specifying both position and velocity when used with Gazebo. However, increasing the damping term of the joint in urdf results in unexpected behavior. Using JointEffortController does results in behavior that is expected.

I thought that using JointTrajectoryController by specifying the effort will results in the same behaviour as JointEffortController but the error 'Size mismatch between trajectory point and permutation vector' throws up when I specify the effort only. It seems that I have to specify the position at all times.

Could someone please advice further on what it is that I am missing out on JointTrajectoryController and why does the damping term results in erratic behavior?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-12-30 05:20:34 -0500

You don't have to specify positions all the time, but make sure to resize the variables, Have a look at following implementation,

  control_msgs::FollowJointTrajectoryGoal goal;
  goal.trajectory.joint_names.push_back("shoulder_pan_joint");
  goal.trajectory.joint_names.push_back("shoulder_lift_joint");
  goal.trajectory.joint_names.push_back("elbow_joint");
  goal.trajectory.joint_names.push_back("wrist_1_joint");
  goal.trajectory.joint_names.push_back("wrist_2_joint");
  goal.trajectory.joint_names.push_back("wrist_3_joint");
  goal.trajectory.points.resize(1); // important

  goal.trajectory.points[0].effort.resize(N_JOINT);
  goal.trajectory.points[0].positions.resize(N_JOINT);
  goal.trajectory.points[0].velocities.resize(N_JOINT);
  goal.trajectory.points[0].accelerations.resize(N_JOINT);

  for(size_t i = 0; i < N_JOINT; i++)
  {
    goal.trajectory.points[0].effort[i] = tau(i,0);
    goal.trajectory.points[0].positions[i] = 0;
    goal.trajectory.points[0].velocities[i] = 0;
    goal.trajectory.points[0].accelerations[i] = 0;
  }

  goal.trajectory.points[0].time_from_start = ros::Duration(1.0);
  goal.trajectory.header.frame_id = "base_Link";
  goal.trajectory.header.stamp = ros::Time::now()+ ros::Duration(0.001);
  traj_client_->sendGoalAndWait(goal, ros::Duration(0,0), ros::Duration(0,0));
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

4 followers

Stats

Asked: 2016-09-20 05:32:10 -0500

Seen: 455 times

Last updated: Dec 30 '20