core_pb::driving::data

Struct SharedRobotData

Source
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.

§buttons: [AtomicBool; 6]§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§

Source§

impl<R: RobotBehavior> SharedRobotData<R>

Source

pub fn new(name: RobotName) -> Self

Source

pub fn get_extra_bool_opt(&self, index: usize) -> Option<bool>

👎Deprecated: Extra options should only be used for temporary testing
Source

pub fn get_extra_f32_opt(&self, index: usize) -> Option<f32>

👎Deprecated: Extra options should only be used for temporary testing
Source

pub fn get_extra_i8_opt(&self, index: usize) -> Option<i8>

👎Deprecated: Extra options should only be used for temporary testing
Source

pub fn get_extra_i32_opt(&self, index: usize) -> Option<i32>

👎Deprecated: Extra options should only be used for temporary testing
Source

pub fn set_extra_bool_indicator(&self, index: usize, value: bool)

👎Deprecated: Extra indicators should only be used for temporary testing
Source

pub fn set_extra_f32_indicator(&self, index: usize, value: f32)

👎Deprecated: Extra indicators should only be used for temporary testing
Source

pub fn set_extra_i8_indicator(&self, index: usize, value: i8)

👎Deprecated: Extra indicators should only be used for temporary testing
Source

pub fn set_extra_i32_indicator(&self, index: usize, value: i32)

👎Deprecated: Extra indicators should only be used for temporary testing

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.