-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce waypoint trajectory RPCs #98
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello-binit
force-pushed
the
feature/firmware_protocol
branch
from
September 23, 2021 23:39
db35943
to
2eb11f1
Compare
hello-binit
force-pushed
the
feature/waypoint_traj_rpc
branch
from
September 24, 2021 03:35
eff95db
to
3c6fc3e
Compare
hello-binit
force-pushed
the
feature/waypoint_traj_rpc
branch
from
September 24, 2021 19:58
3c6fc3e
to
21daa37
Compare
aedsinger
approved these changes
Sep 30, 2021
Tested against hello-robot/stretch_firmware#8 . Ran test_stepper unittest and all works well as expected. |
Validate Waypoint trajectory segments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces methods to command the stepper motors into following a waypoint trajectory. A "waypoint trajectory" is a spline that a stepper joint attempts to track over time. The joint position spline is defined by an series of waypoints, where each waypoint consists of:
Between two waypoints is a segment of the spline. Given just time/pos, this segment is linear. Adding velocity, it's cubic, and with acceleration, it's quintic. Coefficients representing the segments are sent down to the stepper hardware. With full waypoints, each segment is defined by a quintic polynomial,
f(t) = a0 + a1*t + a2*t^2 + a3*t^3 + a4*t^4 + a5*t^5
; the coefficient array[a0, a1, a2, a3, a4, a5]
is part of what is sent down to the hardware. A sample trajectory (used in the unit tests) is visualized on Desmos, and used to calculate the coefficient arrays of the segments.This PR doesn't manage waypoints or compute segments from waypoints. It exposes an interface to the motors that accept the segments in a way that allows starting of a trajectory and preemption of the trajectory's next segment while a segment is actively being executed. The added methods are:
stepper.start_waypoint_trajectory([duration_s, a0, a1, a2, a3, a4, a5, segment_id])
stepper.set_next_trajectory_segment([duration_s, a0, a1, a2, a3, a4, a5, segment_id])
stepper.stop_waypoint_trajectory()
The benefit of waypoint trajectories is that the joints can be commanded with planned trajectories that coordinate the whole body of Stretch into performing some coordinated action (e.g. when the arm, lift, and mobile base must arrive to specific positions at specific times in order to perform a grasp).
Finally, note that the firmware does not check the "executability" of a given segment. The hardware will attempt to track a given segment, even if it's waypoints form a malformed segment (e.g. exceeding joint limits, exceeding joint dynamics).Firmware checking of segment feasibility is now done in hello-robot/stretch_firmware#6.TODO:
Merge in Bugfix/remove sync timestamps #77stepper.set_first_trajectory_segment()
insteadImprove howactive_id
is tracked.Add firmware checking of segment "executability" and error reporting. Merge in Validate Waypoint trajectory segments #103