TrSensor
vectorlib::TrSensor — fields, methods, parameters and return types.
pub struct TrSensorA distance sensor used for distance sensor resets (tr_sensor).
Methods
Prop
Type
new
pub fn new(offset: impl Into<TrVector2>, sensor: impl DistanceDevice + 'static) -> SelfA sensor at offset (inches) from the centre of the robot.
Parameters
Prop
Type
Returns
Selfrelative_square
pub fn relative_square(heading: f32) -> f32Map a heading into [-45, 45): how far the robot is from square to the walls.
Parameters
Prop
Type
Returns
f32raw_distance
pub fn raw_distance(&self) -> TrDistanceThe reading in inches, without correcting for heading or offset (distance()).
A missing reading is 9999 with confidence 0.
Returns
TrDistancedistance
pub fn distance(&self, heading: f32) -> TrDistanceThe perpendicular distance from the centre of the robot to the wall the sensor
faces, inches, for a robot at heading (distance(float heading)). A missing
reading is 9999 with confidence 0.
Parameters
Prop
Type
Returns
TrDistance