Browse Source

Fix an error in the program trajectories code

There was something missing after the follow trajectory command and it was the push command and a time sleep to work.
pull/8/head
hello-jesus 1 year ago
committed by GitHub
parent
commit
d488ab938a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      stretch_body/tutorial_splined_trajectories.md

+ 4
- 1
stretch_body/tutorial_splined_trajectories.md View File

@ -61,6 +61,7 @@ Programming a splined trajectory is straightforward. For example, try the follow
import stretch_body.robot import stretch_body.robot
r=stretch_body.robot.Robot() r=stretch_body.robot.Robot()
r.startup() r.startup()
#r.arm.motor.disable_sync_mode() **If you want to try running the code with this command you'll need to coment the r.push_command() and it will work as well
#Define the waypoints #Define the waypoints
times = [0.0, 10.0, 20.0] times = [0.0, 10.0, 20.0]
@ -73,6 +74,8 @@ for waypoint in zip(times, positions, velocities):
#Begin execution #Begin execution
r.arm.follow_trajectory() r.arm.follow_trajectory()
r.push_command()
time.sleep(0.1)
#Wait unti completion #Wait unti completion
while r.arm.is_trajectory_active(): while r.arm.is_trajectory_active():
@ -87,7 +90,7 @@ This will cause the arm to move from its current position to 0.45m, then back to
* This will execute a Cubic spline as we did not pass in accelerations to in `r.arm.trajectory.add` * This will execute a Cubic spline as we did not pass in accelerations to in `r.arm.trajectory.add`
* The call to `r.arm.follow_trajectory` is non-blocking and the trajectory generation is handled by a background thread of the Robot class * The call to `r.arm.follow_trajectory` is non-blocking and the trajectory generation is handled by a background thread of the Robot class
If you're interested in exploring the trajectory API further the [code for the `stretch_trajectory_jog.py`](https://github.com/hello-robot/stretch_body/blob/master/tools/bin/stretch_trajectory_jog.py) is a great reference to get started.
If you're interested in exploring the trajectory API further. the [code for the `stretch_trajectory_jog.py`](https://github.com/hello-robot/stretch_body/blob/master/tools/bin/stretch_trajectory_jog.py) is a great reference to get started.
## Advanced: Controller Parameters ## Advanced: Controller Parameters

Loading…
Cancel
Save