TrackingWheel
vectorlib::TrackingWheel — fields, methods, parameters and return types.
pub struct TrackingWheelA tracking wheel: an encoder (or motor group) and the geometry to turn it into distance.
Methods
Prop
Type
new
pub fn new(
encoder: impl Into<TrackingEncoder>,
wheel_diameter: f32,
distance: f32,
gear_ratio: f32,
) -> SelfCreate a tracking wheel from a rotation sensor or an ADI encoder.
encoder— a vexideRotationSensororAdiEncoder(or aTrackingEncoder)wheel_diameter— the diameter of the wheel, in inches (seeOmniwheel)distance— distance between the tracking wheel and the center of rotation, in inches. Same sign convention as LemLib: negative is left / back.gear_ratio— gear ratio of the tracking wheel (LemLib default1), defined as output / input
// pros::Rotation verticalEnc(-11);
// lemlib::TrackingWheel vertical(&verticalEnc, lemlib::Omniwheel::NEW_275, -2.5);
let vertical_enc = RotationSensor::new(peripherals.port_11, Direction::Reverse);
let vertical = TrackingWheel::new(vertical_enc, Omniwheel::NEW_275, -2.5, 1.0);
Parameters
Prop
Type
Returns
Selffrom_motors
pub fn from_motors(
motors: Rc<RefCell<MotorGroup>>,
wheel_diameter: f32,
distance: f32,
rpm: f32,
) -> SelfCreate a "tracking wheel" from drivetrain motors (LemLib's MotorGroup* constructor).
motors— the motor groupwheel_diameter— the diameter of the drivetrain wheels, in inchesdistance— half the track width, negative for the left siderpm— theoretical maximum rpm of the drivetrain wheels
Parameters
Prop
Type
Returns
Selfreset
pub fn reset(&mut self)Reset the tracking wheel position to 0.
Returns
()get_distance_traveled
pub fn get_distance_traveled(&self) -> f32Get the distance traveled by the tracking wheel, in inches.
Returns
f32get_offset
pub fn get_offset(&self) -> f32Get the offset of the tracking wheel from the center of rotation.
Returns
f32get_type
pub fn get_type(&self) -> i32Get the type of tracking wheel: 0 for an encoder, 1 for motors.
Returns
i32