gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.18k stars 479 forks source link

Add api to freeze joint at current configuration #1095

Open osrf-migration opened 10 years ago

osrf-migration commented 10 years ago

Original report (archived issue) by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


This has been requested multiple times on gazebo answers. The function would set the high and low stops to the current joint position.

// Get the current joint position
gazebo::math::Angle currentPosition = joint->GetAngle(0);
joint->SetHighStop(0, currentPosition);
joint->SetLowStop(0, currentPosition);
osrf-migration commented 10 years ago

Original comment by Jeongseok Lee (Bitbucket: jlee02, GitHub: jslee02).


There are two possible ways to lock a joint in generalized coordinate based physics engines: (a) Adding upper/lower joint limit constraints (as you described above) (b) Changing the joint actuation type from dynamic to kinematic

In (a), to make the joint to stay at the configuration, the constraint solver should compute appropriate constraint forces for every simulation steps. Since the constraint is not hard constraint, it may cause constraint errors or jittering.

Whereas in (b), the joint can be treated as kinematic joint, which means the dynamics engine does not compute forward dynamics for the joint but compute inverse dynamics. Inverse dynamics calculates joint torque given joint state and acceleration. This method does not lead any constraint error and does not need to compute constraint force. Gerneralized coordinate based physics engines (like DART or Simbody) can implement this functionality by hybrid (forward + inverse) dynamics algorithm.

I think (b) would be efficient and accurate way to implement joint lock for generalized coordinate based physics engines unless the user want to add control input to the kinematic joint. It would be nice to create the joint lock function as virtual function so that the each physic engine can override it.

osrf-migration commented 8 years ago

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).