Make Joint::jointGeneralizedForceTarget return data from the right component #276
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before #259, and particularly 5bf1b4b, we were handling differently what was stored in the
JointForce
component. Now, the force is filled by what the ign-physics plugin provides. Before, we were storing the command. In presence of friction or when the joint limit is reached, the command and the real joint force do not match.This PR makes
gazebo::Joint::jointGeneralizedForceTarget
return theJointForceCmd
instead. The trade off here is that this component is cleared after the first application, therefore getting the target is valid only before the nextGazeboSimulator::run()
call.Until now, there have always been a mismatch about how the force target was handled wrt to the position, velocity, etc. This PR reduces the gap. It does not fill it entirely because the other targets will persist even after the run. However, this behaviour matches what happens in reality, since the force command is only applied once. Instead, when a joint controller is enabled, the position, velocity, etc. targets remain valid.