pub struct SharedRobotData<R: RobotBehavior + ?Sized> {Show 24 fields
pub name: RobotName,
pub robot_definition: RobotDefinition<3>,
pub created_at: R::Instant,
pub enable_imu: AtomicBool,
pub enable_extra_imu_data: AtomicBool,
pub enable_dists: AtomicBool,
pub enable_battery_monitor: AtomicBool,
pub enable_display: AtomicBool,
pub enable_gamepad: AtomicBool,
pub display_loop_interval: AtomicU64,
pub sensors: Watch<CriticalSectionRawMutex, SensorData, 2>,
pub network_status: Watch<CriticalSectionRawMutex, (NetworkStatus, Option<[u8; 4]>), 2>,
pub config: Watch<CriticalSectionRawMutex, FrequentServerToRobot, 2>,
pub motor_control: Watch<CriticalSectionRawMutex, MotorControlStatus, 2>,
pub utilization: [AtomicF32; 3],
pub sig_motor_speeds: [AtomicF32; 3],
pub sig_angle: Signal<CriticalSectionRawMutex, Result<f32, <R::Peripherals as RobotPeripheralsBehavior>::Error>>,
pub sig_extra_imu_data: Signal<CriticalSectionRawMutex, ExtraImuData>,
pub sig_distances: [Signal<CriticalSectionRawMutex, Result<Option<f32>, <R::Peripherals as RobotPeripheralsBehavior>::Error>>; 4],
pub sig_battery: Signal<CriticalSectionRawMutex, Result<f32, <R::Peripherals as RobotPeripheralsBehavior>::Error>>,
pub buttons: [AtomicBool; 6],
pub defmt_logs: Pipe<CriticalSectionRawMutex, ROBOT_LOGS_BUFFER>,
pub extra_opts: ExtraOptsAtomicTypes,
pub extra_indicators: ExtraOptsAtomicTypes,
}
Expand description
Each robot should have exactly one. Some fields are managed by core_pb, but (when noted) implementations are responsible for updating values
Fields§
§name: RobotName
Robot’s name, to distinguish it from other robots, is provided on startup
robot_definition: RobotDefinition<3>
The robot’s physical characteristics
created_at: R::Instant
An instant representing the time the shared struct was created
enable_imu: AtomicBool
§enable_extra_imu_data: AtomicBool
§enable_dists: AtomicBool
§enable_battery_monitor: AtomicBool
§enable_display: AtomicBool
§enable_gamepad: AtomicBool
§display_loop_interval: AtomicU64
§sensors: Watch<CriticalSectionRawMutex, SensorData, 2>
Information gathered by the peripherals task will be posted here for network and motors
network_status: Watch<CriticalSectionRawMutex, (NetworkStatus, Option<[u8; 4]>), 2>
The current network status, updated by network task
config: Watch<CriticalSectionRawMutex, FrequentServerToRobot, 2>
Configuration from the server that may change frequently, updated by network task
Note: some fields are loaded into other atomic primitives
motor_control: Watch<CriticalSectionRawMutex, MotorControlStatus, 2>
Motor control status, updated by motors task
utilization: [AtomicF32; 3]
Utilization percentage for the three tasks
sig_motor_speeds: [AtomicF32; 3]
Estimated motor speeds
It is the responsibility of the implementation to update this field.
sig_angle: Signal<CriticalSectionRawMutex, Result<f32, <R::Peripherals as RobotPeripheralsBehavior>::Error>>
An estimation of the absolute orientation of the robot
It is the responsibility of the implementation to update this field.
sig_extra_imu_data: Signal<CriticalSectionRawMutex, ExtraImuData>
Individual IMU sensor information
It is the responsibility of the implementation to update this field.
sig_distances: [Signal<CriticalSectionRawMutex, Result<Option<f32>, <R::Peripherals as RobotPeripheralsBehavior>::Error>>; 4]
Readings from the distance sensors, in order of angle 0, 90, 180, 270
It is the responsibility of the implementation to update this field.
- Err(_) indicates that something is wrong with the sensor and the reading can’t be trusted
- Ok(None) indicates that the sensor is working, but didn’t detect any object in its range
- Ok(x) indicates an object x grid units in front of the sensor
sig_battery: Signal<CriticalSectionRawMutex, Result<f32, <R::Peripherals as RobotPeripheralsBehavior>::Error>>
The battery level of the robot, in volts
It is the responsibility of the implementation to update this field.
defmt_logs: Pipe<CriticalSectionRawMutex, ROBOT_LOGS_BUFFER>
Logging bytes from defmt
It is the responsibility of the implementation to update this field.
extra_opts: ExtraOptsAtomicTypes
§extra_indicators: ExtraOptsAtomicTypes
Implementations§
pub fn new(name: RobotName) -> Self
pub fn get_extra_bool_opt(&self, index: usize) -> Option<bool>
pub fn get_extra_f32_opt(&self, index: usize) -> Option<f32>
pub fn get_extra_i8_opt(&self, index: usize) -> Option<i8>
pub fn get_extra_i32_opt(&self, index: usize) -> Option<i32>
pub fn set_extra_bool_indicator(&self, index: usize, value: bool)
pub fn set_extra_f32_indicator(&self, index: usize, value: f32)
pub fn set_extra_i8_indicator(&self, index: usize, value: i8)
pub fn set_extra_i32_indicator(&self, index: usize, value: i32)
Auto Trait Implementations§
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.