Skip to Content
VectorLib

devices

Public functions and their Rust signatures.


millivolts_to_volts

pub fn millivolts_to_volts(millivolts: i32) -> f64

Convert millivolts to the volts argument for Motor::set_voltage so that vexide's (volts * 1000.0) as i32 produces exactly millivolts again.

Parameters

Prop

Type

Returns

f64

View source

pros_move_to_millivolts

pub fn pros_move_to_millivolts(voltage: i32, reversed: bool) -> i32

Port of PROS motor_move: map [-127, 127] to millivolts with PROS's integer arithmetic.

PROS reverses a motor in software by negating the voltage before mapping. Because the mapping is not symmetric (move(1) is 94 mV, move(-1) is −95 mV), a reversed motor gets the mapping of the negated input. vexide reverses in firmware instead, so the result is negated once more before it is sent, and the motor ends up with exactly PROS's output.

Parameters

Prop

Type

Returns

i32

View source