1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Localization (odometry) tracking for robot position estimation.
//!
//! This module provides odometry tracking using perpendicular tracking wheels
//! and an inertial sensor to estimate the robot's global position on the field.
//!
//! # Module Structure
//!
//! * **[`tracker`]**: The main odometry tracking controller.
//! * **[`tracker::devices`]**: Sensor abstractions and pose types.
//!
//! # How It Works
//!
//! Odometry uses wheel encoders to measure how far the robot has traveled
//! and an inertial sensor (IMU) to measure rotation. By combining these
//! measurements over time, we can estimate the robot's (x, y) position
//! and heading on the field.
//!
//! # Hardware Requirements
//!
//! - **Vertical tracking wheel**: Measures forward/backward movement.
//! - **Horizontal tracking wheel**: Measures sideways (strafing) movement.
//! - **Inertial sensor (IMU)**: Measures rotation for accurate heading.
//!
//! # Example
//!
//! ```ignore
//! use antaeus::motion::localization::tracker::Tracker;
//! use antaeus::motion::localization::tracker::devices::{TrackerMech, TrackerPod, TrackingSensor};
//! use antaeus::misc::units::Length;
//! use vexide::prelude::*;
//! use std::sync::Arc;
//! use vexide::sync::Mutex;
//!
//! // Create tracking sensors
//! let v_sensor = TrackingSensor::new_rotation_sensor(
//! RotationSensor::new(peripherals.port_5, Direction::Forward)
//! );
//! let h_sensor = TrackingSensor::new_rotation_sensor(
//! RotationSensor::new(peripherals.port_6, Direction::Forward)
//! );
//!
//! // Create tracker pods (2.75" wheel, 1:1 ratio, offset from center)
//! let vertical = TrackerPod::new(
//! v_sensor,
//! Length::from_inches(2.75),
//! 1.0,
//! 1.0,
//! Length::from_inches(2.0),
//! );
//! let horizontal = TrackerPod::new(
//! h_sensor,
//! Length::from_inches(2.75),
//! 1.0,
//! 1.0,
//! Length::from_inches(3.5),
//! );
//!
//! // Create mechanism with IMU
//! let imu = Arc::new(Mutex::new(InertialSensor::new(peripherals.port_10)));
//! let mechanism = TrackerMech::new(vertical, horizontal, imu);
//!
//! // Create the tracker (call `tick` in your control loop)
//! let odom = Tracker::new(mechanism);
//! ```
use cratePose;