ozton_drivetrain/lib.rs
1#![no_std]
2
3//! Robot drivetrains and models.
4//!
5//! This crate provides types for representing and modeling different mobile robot drivetrain
6//! configurations. A *drivetrain* in ozton is the combination of a *model* which describes how the
7//! is able to move and a *tracking* system, which describes how the robot can track its motion.
8//!
9//! At the heart of this crate is the [`Drivetrain`] struct, which bundles together a model and a
10//! tracking system. The [`Drivetrain`] type can enacapsulate many different types of robot
11//! drivetrains depending on how its model and tracking logic is implemented.
12
13pub mod model;
14
15use model::DrivetrainModel;
16use ozton_tracking::Tracking;
17
18/// A mobile robot drivetrain capable of measuring data about itself.
19#[derive(Default, Debug, Clone, Copy, Eq, PartialEq, Hash)]
20pub struct Drivetrain<M: DrivetrainModel, T: Tracking> {
21 /// Motor collection.
22 pub model: M,
23
24 /// Tracking system.
25 pub tracking: T,
26}
27
28impl<M: DrivetrainModel, T: Tracking> Drivetrain<M, T> {
29 /// Creates a new drivetrain from a collection of motors and a tracking system.
30 pub const fn new(model: M, tracking: T) -> Self {
31 Self { model, tracking }
32 }
33}