Change slotcar control to explicitly open loop #43
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.
Bug fix
Supersedes #40, closes #37
Fixed bug
Do explicit open loop control instead of relying on undefined behavior (that broke in the ignition-gazebo version 5.1).
Fix applied
We currently rely on reading the Linear / AngularVelocityCmd components to know what is the current robot's speed, this is equivalent to doing open loop control since the components used to have the command sent in the previous iteration.
However, it was actually an incorrect behavior since those components are supposed to be set to zero before the following simulation step, as is done here.
Switching to closed loop simulation as proposed in #40 doesn't work for dartsim because the high friction caused by our way of moving the robots (move it as a box, sliding it on the floor) causes the velocities to be very low and the robot to barely move, as discussed in ign-gazebo #966(comment).
For these reasons, the only way to have the robots to have the same behavior with both physics engines as before is to switch to an explicit open loop control, where we save the velocities of the previous step and use them to compute the updated velocities in the following step.