pub struct SensorimotorBus { /* private fields */ }Expand description
The central bus connecting sensors and actuators to the cognitive system.
Manages device registration, sensor reading aggregation, and actuator
command dispatch. Thread-safe via RwLock.
Implementations§
Source§impl SensorimotorBus
impl SensorimotorBus
Sourcepub fn register_sensor(&mut self, sensor: Box<dyn SensorDevice>)
pub fn register_sensor(&mut self, sensor: Box<dyn SensorDevice>)
Register a sensor device.
Sourcepub fn register_actuator(&mut self, actuator: Box<dyn ActuatorDevice>)
pub fn register_actuator(&mut self, actuator: Box<dyn ActuatorDevice>)
Register an actuator device.
Sourcepub fn poll_all(&mut self) -> Vec<SensorReading>
pub fn poll_all(&mut self) -> Vec<SensorReading>
Poll all sensors and collect readings.
Sourcepub fn read_sensor(&self, sensor_id: &str) -> Option<SensorReading>
pub fn read_sensor(&self, sensor_id: &str) -> Option<SensorReading>
Read from a specific sensor by ID.
Sourcepub fn send_command(&mut self, cmd: &ActuatorCommand) -> Result<(), String>
pub fn send_command(&mut self, cmd: &ActuatorCommand) -> Result<(), String>
Send a command to a specific actuator.
Sourcepub fn e_stop_all(&self) -> Vec<String>
pub fn e_stop_all(&self) -> Vec<String>
Emergency stop all actuators.
Sourcepub const fn recent_readings(&self) -> &[SensorReading]
pub const fn recent_readings(&self) -> &[SensorReading]
Get recent sensor readings.
Sourcepub fn history(&self) -> Vec<SensorReading>
pub fn history(&self) -> Vec<SensorReading>
Get the reading history as a Vec.
Sourcepub fn sensor_count(&self) -> usize
pub fn sensor_count(&self) -> usize
Number of registered sensors.
Sourcepub fn actuator_count(&self) -> usize
pub fn actuator_count(&self) -> usize
Number of registered actuators.
Sourcepub const fn readings_collected(&self) -> u64
pub const fn readings_collected(&self) -> u64
Total readings collected since creation.
Sourcepub const fn commands_sent(&self) -> u64
pub const fn commands_sent(&self) -> u64
Total commands sent since creation.
Sourcepub fn sensor_ids(&self) -> Vec<String>
pub fn sensor_ids(&self) -> Vec<String>
List all registered sensor IDs.
Sourcepub fn actuator_ids(&self) -> Vec<String>
pub fn actuator_ids(&self) -> Vec<String>
List all registered actuator IDs.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SensorimotorBus
impl !UnwindSafe for SensorimotorBus
impl Freeze for SensorimotorBus
impl Send for SensorimotorBus
impl Sync for SensorimotorBus
impl Unpin for SensorimotorBus
impl UnsafeUnpin for SensorimotorBus
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