Joint Damping and Friction
Every revolute and prismatic joint can have viscous damping and Coulomb friction, and a spherical joint can have viscous damping. They model bearings, seals and gears. They are passive: they only remove energy, they are not part of the generalized force you set, and they act whether or not the joint is controlled.
Set them with the standard URDF <dynamics> attributes. Both default to zero:
<joint name="knee" type="revolute">
<parent link="thigh"/>
<child link="shank"/>
<axis xyz="0 1 0"/>
<dynamics damping="0.5" friction="2.0"/>
</joint>| Joint type | damping | friction |
|---|---|---|
| revolute | ||
| prismatic | ||
| spherical | not supported (ignored) |
The MJCF loader reads the joint damping attribute but not frictionloss.
Both are measured at the joint, i.e., after any gear. If the joint is driven by an actuator, the actuator's output_damping and output_friction add to them (see Actuators).
Damping
Damping is the torque
For example, a free joint with inertia
and converges to the velocity
To read the current joint damping, call getJointDamping(). It returns a const raisim::VecDyn reference in generalized velocity order, with getDOF() entries. These are the values loaded from the model or last supplied to setJointDamping(); actuator output damping and PD gains are separate. Copy getJointDamping().e() into an Eigen::VectorXd to preserve a baseline before adding temporary damping, such as wheel braking.
To change the damping at runtime, call setJointDamping() with one coefficient per degree of freedom (getDOF() entries). The new values act from the next step. Leave the six entries of a floating base at zero: they are not joints, and their damping would not be integrated implicitly.
The URDF effort limit bounds only the commanded torque (PD plus feedforward). The damping torque is passive and is never clipped. Actuator torques (see Actuators) are not bounded by the effort limit either: they are limited by the operating regions of their motors and are added after the effort clamp.
Friction
Friction is Coulomb friction with stiction. It opposes the motion with the constant torque
Once the other torques exceed
RaiSim solves friction as a joint impulse bounded by
The joint's own friction is set in the model file; there is no C++ setter for it. The output_friction of an actuator can be changed at runtime by editing the definitions from getActuators() and passing them to setActuators().