pub struct SimRobot { /* private fields */ }Expand description
A simulated differential-drive robot: drive it with a Twist, read back its Pose.
This stands in for a real rover in a hardware-free test or demo. It is both an
Actuator whose command is a body twist and a Sensor whose reading is the pose:
each command advances the robot one time step at the commanded velocity, integrating the
motion with the same exact-arc odometry a real robot would use, and a read returns where it
has reached. A control loop can therefore be developed and tested end to end with no robot.
§Examples
use pamoja_core::{Actuator, Sensor};
use pamoja_kit::Twist;
use pamoja_sim::SimRobot;
let mut robot = SimRobot::new(0.1); // 0.1 s per command
// Drive straight at 1 m/s for ten steps: about one metre forward.
for _ in 0..10 {
robot.apply(Twist::planar(1.0, 0.0)).await?;
}
let pose = robot.read().await?;
assert!((pose.x - 1.0).abs() < 1e-5 && pose.y.abs() < 1e-5);Implementations§
Trait Implementations§
impl Copy for SimRobot
Auto Trait Implementations§
impl Freeze for SimRobot
impl RefUnwindSafe for SimRobot
impl Send for SimRobot
impl Sync for SimRobot
impl Unpin for SimRobot
impl UnsafeUnpin for SimRobot
impl UnwindSafe for SimRobot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more