1. OpenSourceRoboticsFoundation
  2. Simulation
  3. gazebo
  4. Issues
Issue #485 new

Update Joint::GetForce to return accumulated result of SetForce at every timestep

John Hsu
created an issue

Currently, Joint::GetForce uses Joint::forceApplied, which temporarily stores forces applied to the joint when Joint::SetForce is called. Proposing modifying this function to accumulate Joint::forceApplied when Joint::SetForce is called, and clear on every timestep advance.

Comments (10)

  1. John Hsu reporter

    I think the call to dJointAddHingeTorque in Joint::SetForce is correct as is. The question I have is the Joint::GetForce call seemed to me a bit vague on what it should do right now. Current documentation dictates it should return accumulated force applied through use of Joint::SetForce (within a time step). But as is in the pull request, there is also a potential for race conditions on when the value is queried, unless we buffer the total force applied from the previous time step as the return value, and in addition assume there are no other ways of adding forces to a joint.

  2. Nathan Koenig

    It seems strange the ::SetForce does not actually set the force, but rather adds to the current force.

    I would propose the following:

    • Joint::SetForce() - sets the force on a joint

    • Joint::AddForce() - add a force to the joint

    • Joint::GetForce() - Gets the total force on a joint

    • Joint::GetAddedForce() - Get the force applied during the last Joint::AddForce

    Does that seem logical, and doable?

  3. Log in to comment