Autonomous Guide

Every auton command, with explanation, example, and usage tips.

Auton Skeleton

Use the selector to register routines. The selected routine runs in autonomous().

void pre_auton() {
  vexcodeInit();
  drive.init();
  selector.add("DriveToPoint", auton_drive_to_point);
  selector.show();
}

void autonomous() {
  selector.run_selected();
}

Core Motion Commands

drive_distance

What it does: Drives straight a given distance (inches).

When to use: Short straight moves before turns or scoring.

drive.drive_distance(24, 60);

Explanation: Drives forward 24 inches, limiting speed to 60%.

turn_to_heading

What it does: Turns to an absolute heading (degrees).

When to use: Aligning to a known field heading.

drive.turn_to_heading(90, 50);

Explanation: Turns until heading is 90°, max 50% power.

turn_to_point

What it does: Turns to face a field point (x, y).

When to use: Before driving to a target coordinate.

drive.turn_to_point(30, 18, 50);

Explanation: Rotates to face the point (30,18).

swing_to_heading

What it does: Turns using one side of the drive.

When to use: Tight turning when space is limited.

drive.swing_to_heading(90, 50, true);

Explanation: Left side stays; right side turns robot to 90°.

drive_to_point

What it does: Drives to a point (x,y) using odometry.

When to use: Precise navigation to a coordinate.

drive.drive_to_point(24, 12, 60);

drive_to_pose

What it does: Drives to a point and ends at a heading.

When to use: Final positioning for scoring or alignment.

drive.drive_to_pose(30, 18, 45, 60);

Async Motion

Run motions in the background to overlap actions (like intakes or arms).

drive.drive_to_point_async(24, 12, 60);
// do other actions
if (drive.motion_running()) {
  // still moving
}
drive.stop_motion();

Motion Chaining

Chains commands into a single sequence (cleaner auton code).

clasi::MotionChain chain;
chain.add([&](){ drive.drive_distance(24, 60); });
chain.add([&](){ drive.turn_to_heading(90, 50); });
chain.add([&](){ drive.drive_to_point(36, 18, 60); });
chain.run();

Path Following

Pure Pursuit

Use when: Following long smooth paths.

auto path = clasi::make_arc(0, 0, 24, 0, 60, 8);
pure_pursuit.follow_path(drive, path,
                         clasi_config::kLookaheadIn,
                         clasi_config::kPathMaxPct);

Boomerang

Use when: Precise final pose alignment.

boomerang.go_to(drive, 30, 18, 45, 60);

Beginner Easy API

For kBeginner, use the simplified API.

clasi_easy::drive_forward(drive, 24, 60);
clasi_easy::turn_deg(drive, 90, 50);
clasi_easy::go_to(drive, 24, 12, 60);