Skip to main content

kernelvex/
lib.rs

1//! # kernelvex
2//!
3//! A VEX robotics control library for the Vexide platform.
4//!
5//! `kernelvex` provides high-level abstractions for building autonomous and
6//! driver-controlled robot programs. It includes odometry, motion control,
7//! trajectory following, and drivetrain management.
8//!
9//! ## Features
10//!
11//! - **Odometry**: Track robot position using [`TrackingRig`] with wheel encoders and IMU
12//! - **Drivetrains**: [`DifferentialDrive`] with tank, arcade, and curvature control
13//! - **Motion Profiles**: [`TrapezoidalConstraints`] for smooth acceleration
14//! - **Trajectory Following**: [`PurePursuit`] and [`RamseteController`] for path tracking
15//! - **PID Control**: [`Pid`] and [`AngularPid`] for closed-loop control
16//! - **Feedforward**: [`FeedForward`] and [`ArmFeedForward`] for model-based control
17//! - **Type-Safe Units**: [`QLength`], [`QAngle`], [`QTime`] prevent unit errors
18//!
19//! ## Quick Start
20//!
21//! ```ignore
22//! use kernelvex::*;
23//!
24//! // Create a differential drivetrain
25//! let left_motors = MotorGroup::new(vec![left1, left2]);
26//! let right_motors = MotorGroup::new(vec![right1, right2]);
27//! let drivetrain = DifferentialDrive::new(left_motors, right_motors, track_width);
28//!
29//! // Set up odometry
30//! let rig = TrackingRig::new(
31//!     Pose::default(),
32//!     [horizontal_wheel],
33//!     [left_wheel, right_wheel],
34//!     Some(imu),
35//! );
36//!
37//! // Create an odometry chassis for autonomous
38//! let chassis = OdomChassis::new(drivetrain, rig, linear_pid, angular_pid);
39//!
40//! // Drive to a point
41//! chassis.shoot(target_pose, constraints).await?;
42//! ```
43//!
44//! ## Module Overview
45//!
46//! | Module | Description |
47//! |--------|-------------|
48//! | [`control`] | PID controllers, feedforward, RAMSETE, pure pursuit |
49//! | [`dt`] | Drivetrain models and motor groups |
50//! | [`motion`] | Motion profiles and trajectories |
51//! | [`odom`] | Odometry, pose estimation, tracking wheels |
52//! | [`util`] | Type-safe units, logging, solenoid groups |
53
54
55pub use odom::wheel::{OmniWheel, TrackingWheel, TrackingRig};
56pub use odom::chassis::{
57    DriveError, OdomChassis,
58};
59
60pub use control::ramsete::{RamseteController, RamseteReference};
61pub use util::controller::*;
62pub use motion::profile::TrapezoidalConstraints;
63pub use motion::trajectory::{Trajectory, TrajectoryPoint};
64pub use odom::{pose::Pose, wheel::*};
65
66pub use util::si::{QAngle, QLength, QTime};
67
68pub use dt::model::*;
69pub use util::solenoidgroup::SolenoidGroup;
70
71pub use dt::differential::DifferentialDrive;
72pub use dt::motorgroup::MotorGroup;
73
74pub mod control;
75pub mod dt;
76
77pub use util::logger::Logger;
78pub use util::{si::*, utils::*};
79
80pub mod odom;
81
82pub mod motion;
83
84pub use control::pid::{AngularPid, Pid};
85
86pub use control::purepursuit::PurePursuit;
87pub mod util;
88
89pub use control::feedforward::*;
90
91pub use dt::differential::*;