Recently I try to implement a "velocity-resolved" controller to a robotic manipulator in drake simulation.In detail, given a desired velocity v_d
in task space, we calculate the joints' velocity q_dot
via v_d = J * q_dot
.
Hence I want to directly access to joint velocity in my multibody::plant(from urdf file). Here are some questions confusing me:
What kind of input does "plant->get_actuation_input_port()" refer to?
Dose it refer to"position", "velocity" or "torque"?
Is there a way to specify one of them?(The multibod::plant is imported from a urdf file)
Is it better if I directly "set angular rate" of joints in every time step?
Another way to directly access to velocity is setting angular rate of the joints; i.e.,
const multibody::RevoluteJoint<double>& joint_1 =
plant->GetJointByName<multibody::RevoluteJoint>("joint1");
for ( double t = FLAGS_sim_dt ; t < FLAGS_simulation_sec; t += FLAGS_sim_dt)
{
joint_1.set_angular_rate(&plant_context, v_d);
simulator.AdvanceTo(t);
}
In this way I can directly command the velocity but there is no controllerSystem
connect to the plant->get_actuation_input_port()
.
The actuation input port are torques.
If you set the joint velocity at every time step, you will be overwriting the physics. I don't think you want to do that. The current approach to accomplishing this goal is to use an InverseDynamicsController to regulate the actual velocity to the desired velocity. (This is a fairly accurate representation of what would happen on a real system).