frankaemika/franka_ros

Regarding the `setCommand()`

BolunDai0216 opened this issue · 2 comments

Hi,

I was looking into the joint_impedance_example_controller, and I noticed that during update(), two setCommand() are used, one from the cartesian_pose_handle_

cartesian_pose_handle_->setCommand(pose_desired);

and the other from the joint_handles_

for (size_t i = 0; i < 7; ++i) {
    joint_handles_[i].setCommand(tau_d_saturated[i]);
}

Are both of these commands executed on the robot? It seems to me that only the last one was executed, is that the case? Does the second setCommand() overwrite the first one?

Would it be possible for someone to help me understand this?

Thanks in advance!

@marcbone Would it be possible to help me with this one?

Hi, I hope this can still be useful for you.

Please check the documentation about "writing your own controller":

The idea behind offering the EffortJointInterface in combination with a motion generator interface is to expose the internal motion generators to the user. The calculated desired joint pose corresponding to a motion generator command is available in the robot state one time step later. One use case for this combination would be following a Cartesian trajectory using your own joint-level torque controller. In this case you would claim the combination EffortJointInterface + FrankaCartesianPoseInterface, stream your trajectory into the FrankaCartesianPoseInterface, and compute your joint-level torque commands based on the resulting desired joint pose (q_d) from the robot state. This allows to use the robot’s built-in inverse kinematics instead of having to solve it on your own.