Skip to Content
VectorLib

Motions

Turns, swings, move to point or pose, pure pursuit, and the motion queue.

Every LemLib motion is here with LemLib's algorithm and defaults. Each returns a builder: set only the parameters you need, then .await it.

Async by default, like LemLib

As in LemLib, a motion runs in the background. The .await returns once the motion has started (after any motion already running finishes). Wait on it explicitly, or pass .run_async(false) to block until it ends.

chassis.move_to_point(0.0, 48.0, 4000).await;  // starts, returns after 10 ms
chassis.wait_until(10.0).await;                 // 10 inches travelled
intake.set_voltage(12.0).ok();
chassis.wait_until_done().await;

chassis.turn_to_heading(90.0, 1000).run_async(false).await; // blocks until done

cancel_motion() stops the running motion and moves on to the next queued one; cancel_all_motions() also clears the queue.

Turning and swinging

chassis.turn_to_heading(90.0, 1000).await;
chassis.turn_to_point(45.0, -45.0, 1000).forwards(false).max_speed(60).await;
chassis.turn_to_heading(-90.0, 1500).direction(AngularDirection::CcwCounterclockwise).await;
chassis.swing_to_heading(135.0, DriveSide::Left, 1000).await; // left side holds still
chassis.swing_to_point(20.0, 20.0, DriveSide::Right, 1500).await;

Driving to a point or a pose

chassis.move_to_point(20.0, 15.0, 4000).forwards(false).await;
chassis.move_to_pose(20.0, 15.0, 90.0, 4000).lead(0.3).max_speed(80.0).await;

// motion chaining: exit early at speed and flow into the next motion
chassis.move_to_point(24.0, 24.0, 2000).min_speed(40.0).early_exit_range(4.0).await;

Following a path

Paths are path.jerryio files in your project's static/ folder, embedded with asset!. As in TitanTron, you can also pass a Vec<Pose>.

vectorlib::asset!(SKILLS_PATH = "skills.txt"); // static/skills.txt

chassis.follow(&SKILLS_PATH, 15.0, 4000).forwards(false).await;

Parameters and their defaults

Prop

Type

On this page