Fix for reject waypoint trajectories mismatch joints #361
+179
−59
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.
When a joint is setting up execution of a waypoint trajectory, it will move to the first point of the trajectory using
move_to()
iffollow_trajectory(move_to_first_point=True)
.move_to_first_point
defaults to true. But it takes some time for the joint to reach the first point. With motion planning, you often incoporate the joint's initial position into the optimization. Furthermore, for model predictive control, you want the robot to start tracking the trajectory immediately. So you'd setmove_to_first_point=False
.There is an bug where the user-provided trajectory's first waypoint has a position that doesn't match the joint's actual position. In this bug, the trajectory is still accepted and the joint begins servo-ing fast to track the trajectory. Often, servo-ing fast causes the motor's current draw to spike and this trips motor protection filters at the low level. To the user, this looks like the joint jerks forward and suddenly stops. In this fix, we check that the first waypoint's position is within tolerance of the actual position of the joint, and reject the trajectory if it is not.
Part of the reason for this bug is that the firmware was handling this check in
TrajectoryManager.is_segment_valid()
, but that logic was eventually commented out because the extra computational time of the check caused communication with the uC to stutter.Added two additional fixes while writing unit tests:
req_calibration
shouldn't be an argument of Dynamixels. It's part of the parametersTesting
Use
python3 -m unittest test.test_robot
. Tested on 3004.