MotorGroup
vectorlib::MotorGroup — fields, methods, parameters and return types.
pub struct MotorGroupA group of motors driven together. Port of the pros::MotorGroup subset LemLib uses.
// pros::MotorGroup leftMotors({-5, 4, -3}, pros::MotorGearset::blue);
let left_motors = MotorGroup::new([
Motor::new(peripherals.port_5, Gearset::Blue, Direction::Reverse),
Motor::new(peripherals.port_4, Gearset::Blue, Direction::Forward),
Motor::new(peripherals.port_3, Gearset::Blue, Direction::Reverse),
]);
Methods
Prop
Type
new
pub fn new<M: MotorDevice + 'static>(motors: impl IntoIterator<Item = M>) -> SelfCreate a motor group from owned motors.
Parameters
Prop
Type
Returns
Selffrom_boxed
pub fn from_boxed(motors: Vec<Box<dyn MotorDevice>>) -> SelfCreate a motor group from already-boxed motors (mixed motor types).
Parameters
Prop
Type
Returns
Selfmove_
pub fn move_(&mut self, voltage: i32)MotorGroup::move: set every motor to a power in [-127, 127].
Named move_ because move is a Rust keyword.
Parameters
Prop
Type
Returns
()brake
pub fn brake(&mut self)MotorGroup::brake: stop every motor using its configured brake mode.
Returns
()set_brake_mode_all
pub fn set_brake_mode_all(&mut self, mode: BrakeMode)MotorGroup::set_brake_mode_all.
Parameters
Prop
Type
Returns
()get_brake_mode_all
pub fn get_brake_mode_all(&self) -> Vec<BrakeMode>MotorGroup::get_brake_mode_all.
Returns
Vec<BrakeMode>tare_position_all
pub fn tare_position_all(&mut self)MotorGroup::tare_position_all.
Returns
()get_position_all
pub fn get_position_all(&self) -> Vec<f64>MotorGroup::get_position_all, in rotations.
Returns
Vec<f64>get_gearing_all
pub fn get_gearing_all(&self) -> Vec<Option<Gearset>>MotorGroup::get_gearing_all. None is an invalid gearset.
Returns
Vec<Option<Gearset>>size
pub fn size(&self) -> usizeNumber of motors in the group.
Returns
usize