Expand description
§Robot Control
A Rust library for controlling DC motor robots via PWM motor driver boards.
This crate provides a hardware-abstracted MotorDriver trait, allowing you to
control robots in production (with real I2C hardware) and in tests (with a mock driver).
§Features
pca9685— Enables thePca9685MotorBoardimplementation for PCA9685 PWM boards over I2C. Only available on Linux with I2C support.
§Quick Start
use robot_control::{Motor, MotorDriver, Robot, RobotConfig};
use std::sync::Arc;
use tokio::sync::Mutex;
// Use any MotorDriver implementation (mock for testing, Pca9685 for real hardware)
let driver: Arc<Mutex<dyn MotorDriver>> = todo!("create your driver");
let robot = Robot::new(driver, RobotConfig::default())?;
robot.drive(0.5, 0.5).await?;
robot.stop().await?;
robot.shutdown().await;Re-exports§
pub use error::MotorError;pub use error::RobotError;pub use motor::Motor;pub use motor::MotorDriver;pub use robot::Robot;pub use robot::RobotConfig;pub use robot::RobotOutputState;pub use robot::RobotPhase;pub use robot::RobotStatus;