class
#include <pros/motor_group.hpp>
MotorGroup
Base classes
- class AbstractMotor virtual
Constructors, destructors, conversion operators
-
MotorGroup(const std::initializer_list<std::int8_t>,
const pros::
v5:: MotorGears gearset = pros:: v5:: MotorGears:: invalid, const pros:: v5:: MotorUnits encoder_units = pros::v5::MotorUnits::invalid) - Constructs a new MotorGroup object.
-
MotorGroup(const std::vector<std::int8_t>& ports,
const pros::
v5:: MotorGears gearset = pros:: v5:: MotorGears:: invalid, const pros:: v5:: MotorUnits encoder_units = pros::v5::MotorUnits::invalid) - Constructs a new MotorGroup object.
- MotorGroup(AbstractMotor& motor_group)
- Constructs a new MotorGroup object from an abstract motor.
Motor movement functions
These functions allow programmers to make motors move
- std::int32_t move(std::int32_t voltage) const virtual
- Sets the voltage for the motor group from -127 to 127.
- std::int32_t move_absolute(const double position, const std::int32_t velocity) const virtual
- Sets the target absolute position for the motor group to move to.
- std::int32_t move_relative(const double position, const std::int32_t velocity) const virtual
- Sets the relative target position for the motor group to move to.
- std::int32_t move_velocity(const std::int32_t velocity) const virtual
- Sets the velocity for the motor group.
- std::int32_t move_voltage(const std::int32_t voltage) const virtual
- Sets the output voltage for the motor group from -12000 to 12000 in millivolts.
- std::int32_t brake(void) const virtual
- Stops the motor group using the currently configured brake mode.
- std::int32_t modify_profiled_velocity(const std::int32_t velocity) const virtual
- Changes the output velocity for a profiled movement (move_absolute or move_relative).
- double get_target_position(const std::uint8_t index) const virtual
- Gets the target position set for a motor in the motor group, with a parameter for the motor index.
- std::vector<double> get_target_position_all(void) const virtual
- Gets a vector of the the target positions set for the motor group.
- std::int32_t get_target_velocity(const std::uint8_t index = 0) const virtual
- Gets the velocity commanded to the motor by the user at the index specified.
- std::vector<std::int32_t> get_target_velocity_all(void) const virtual
- Gets a vector of the velocity commanded to the motor by the user.
Motor telemetry functions
These functions allow programmers to collect telemetry from motors
- double get_actual_velocity(const std::uint8_t index = 0) const virtual
- Gets the actual velocity of a motor in the motor group.
- std::vector<double> get_actual_velocity_all(void) const virtual
- Gets a vector of the the actual velocity of each motor the motor group.
- std::int32_t get_current_draw(const std::uint8_t index = 0) const virtual
- Gets the current drawn by a motor in the motor group in mA.
- std::vector<std::int32_t> get_current_draw_all(void) const virtual
- Gets a vector of the current drawn each motor in the motor group in mA.
- std::int32_t get_direction(const std::uint8_t index = 0) const virtual
- Gets the direction of movement for a motor in the motor group.
- std::vector<std::int32_t> get_direction_all(void) const virtual
- Gets a vector of the directions of movement for each motor in the motor group.
- double get_efficiency(const std::uint8_t index = 0) const virtual
- Gets the efficiency of a motor in the motor group in percent.
- std::vector<double> get_efficiency_all(void) const virtual
- Gets a vector of the efficiency of each motor in percent.
- std::uint32_t get_faults(const std::uint8_t index = 0) const virtual
- Gets the faults experienced by a motor in the motor group.
- std::vector<std::uint32_t> get_faults_all(void) const virtual
- Gets a vector of the faults experienced by each motor in the motor group.
- std::uint32_t get_flags(const std::uint8_t index = 0) const virtual
- Gets the flags set by a motor in the motor group's operation.
- std::vector<std::uint32_t> get_flags_all(void) const virtual
- Gets a vector of the flags set by each motor in the motor groups's operation.
- double get_position(const std::uint8_t index = 0) const virtual
- Gets the absolute position of a motor in the motor group in its encoder units.
- std::vector<double> get_position_all(void) const virtual
- Gets a vector of the absolute position of each motor in its encoder units.
- double get_power(const std::uint8_t index = 0) const virtual
- Gets the power drawn by a motor in the motor group in Watts.
- std::vector<double> get_power_all(void) const virtual
- Gets a vector of the power drawn by each motor in the motor group in Watts.
- std::int32_t get_raw_position(std::uint32_t*const timestamp, const std::uint8_t index = 0) const virtual
- Gets the raw encoder count of a motor in the motor group at a given timestamp.
- std::vector<std::int32_t> get_raw_position_all(std::uint32_t*const timestamp) const virtual
- Gets the raw encoder count of each motor at a given timestamp.
- double get_temperature(const std::uint8_t index = 0) const virtual
- Gets the temperature of a motor in the motor group in degrees Celsius.
- std::vector<double> get_temperature_all(void) const virtual
- Gets the temperature of each motor in the motor group in degrees Celsius.
- double get_torque(const std::uint8_t index = 0) const virtual
- Gets the torque generated by a motor in the motor groupin Newton Meters (Nm).
- std::vector<double> get_torque_all(void) const virtual
- Gets a vector of the torque generated by each motor in Newton Meters (Nm).
- std::int32_t get_voltage(const std::uint8_t index = 0) const virtual
- Gets the voltage delivered to a motor in the motor group in millivolts.
- std::vector<std::int32_t> get_voltage_all(void) const virtual
- Gets a vector of the voltage delivered to each motor in millivolts.
- std::int32_t is_over_current(const std::uint8_t index = 0) const virtual
- Checks if a motor in the motor group is drawing over its current limit.
- std::vector<std::int32_t> is_over_current_all(void) const virtual
- Checks if each motor in the motor group is drawing over its current limit.
- std::int32_t is_over_temp(const std::uint8_t index = 0) const virtual
- Gets the temperature limit flag for a motor in the motor group.
- std::vector<std::int32_t> is_over_temp_all(void) const virtual
- Gets a vector with the temperature limit flag for each motor in the motor group.
Motor configuration functions
These functions allow programmers to configure the behavior of motors
- MotorBrake get_brake_mode(const std::uint8_t index = 0) const virtual
- Gets the brake mode that was set for a motor in the motor group.
- std::vector<MotorBrake> get_brake_mode_all(void) const virtual
- Gets a vector with the brake mode that was set for each motor in the motor group.
- std::int32_t get_current_limit(const std::uint8_t index = 0) const virtual
- Gets the current limit for a motor in the motor group in mA.
- std::vector<std::int32_t> get_current_limit_all(void) const virtual
- Gets a vector of the current limit for each motor in the motor group in mA.
- MotorUnits get_encoder_units(const std::uint8_t index = 0) const virtual
- Gets the encoder units that were set for a motor in the motor group.
- std::vector<MotorUnits> get_encoder_units_all(void) const virtual
- Gets a vector of the encoder units that were set for each motor in the motor group.
- MotorGears get_gearing(const std::uint8_t index = 0) const virtual
- Gets the gearset that was set for a motor in the motor group.
- std::vector<MotorGears> get_gearing_all(void) const virtual
- Gets a vector of the gearset that was set for each motor.
- std::vector<std::int8_t> get_port_all(void) const virtual
- Gets a vector with all the port numbers in the motor group.
- std::int32_t get_voltage_limit(const std::uint8_t index = 0) const virtual
- Gets the voltage limit of a motor in the motor group set by the user.
- std::vector<std::int32_t> get_voltage_limit_all(void) const virtual
- Gets a vector of the voltage limit of each motor in the motor group.
- std::int32_t is_reversed(const std::uint8_t index = 0) const virtual
- Gets the operation direction of a motor in the motor group as set by the user.
- std::vector<std::int32_t> is_reversed_all(void) const virtual
- Gets a vector of the operation direction of each motor in the motor group as set by the user.
- std::int32_t set_brake_mode(const MotorBrake mode, const std::uint8_t index = 0) const virtual
- Sets one of MotorBrake to a motor in the motor group.
- std::int32_t set_brake_mode(const pros::motor_brake_mode_e_t mode, const std::uint8_t index = 0) const virtual
- Sets one of MotorBrake to a motor in the motor group.
- std::int32_t set_brake_mode_all(const MotorBrake mode) const virtual
- Sets one of MotorBrake all the motors in the motor group.
- std::int32_t set_brake_mode_all(const pros::motor_brake_mode_e_t mode) const virtual
- Sets one of MotorBrake to a motor in the motor group.
- std::int32_t set_current_limit(const std::int32_t limit, const std::uint8_t index = 0) const virtual
- Sets the current limit for one motor in the motor group in mA.
- std::int32_t set_current_limit_all(const std::int32_t limit) const virtual
- Sets the current limit for every motor in the motor group in mA.
- std::int32_t set_encoder_units(const MotorUnits units, const std::uint8_t index = 0) const virtual
- Sets one of MotorUnits for one motor in the motor group's motor encoder.
- std::int32_t set_encoder_units(const pros::motor_encoder_units_e_t units, const std::uint8_t index = 0) const virtual
- Sets one of MotorUnits for one motor in the motor group's motor encoder.
- std::int32_t set_encoder_units_all(const MotorUnits units) const virtual
- Sets one of MotorUnits for every motor in the motor group's motor encoder.
- std::int32_t set_encoder_units_all(const pros::motor_encoder_units_e_t units) const virtual
- Sets one of MotorUnits for every motor in the motor group's motor encoder.
- std::int32_t set_gearing(std::vector<pros::motor_gearset_e_t> gearsets) const
- Sets one of the gear cartridge (red, green, blue) for one motor in the motor group.
- std::int32_t set_gearing(const pros::motor_gearset_e_t gearset, const std::uint8_t index = 0) const virtual
- Sets one of the gear cartridge (red, green, blue) for one motor in the motor group.
- std::int32_t set_gearing(std::vector<MotorGears> gearsets) const
- Sets the gear cartridge (red, green, blue) for each motor in the motor group by taking in a vector of the cartridges.
- std::int32_t set_gearing(const MotorGears gearset, const std::uint8_t index = 0) const virtual
- Sets one of the gear cartridge (red, green, blue) for one motor in the motor group.
- std::int32_t set_gearing_all(const MotorGears gearset) const virtual
- Sets one of the gear cartridge (red, green, blue) for one motor in the motor group.
- std::int32_t set_gearing_all(const pros::motor_gearset_e_t gearset) const virtual
- Sets one of the gear cartridge (red, green, blue) for every motor in the motor group.
- std::int32_t set_reversed(const bool reverse, const std::uint8_t index = 0) virtual
- sets the reversal for a motor in the motor group.
- std::int32_t set_reversed_all(const bool reverse) virtual
- Sets the reversal for all the motors in the motor group.
- std::int32_t set_voltage_limit(const std::int32_t limit, const std::uint8_t index = 0) const virtual
- Sets the voltage limit for a motor in the motor group in millivolts.
- std::int32_t set_voltage_limit_all(const std::int32_t limit) const virtual
- Sets the voltage limit for every motor in the motor group in millivolts.
- std::int32_t set_zero_position(const double position, const std::uint8_t index = 0) const virtual
- Sets the position for a motor in the motor group in its encoder units.
- std::int32_t set_zero_position_all(const double position) const virtual
- Sets the position for every motor in the motor group in its encoder units.
- std::int32_t tare_position(const std::uint8_t index = 0) const virtual
- Sets the "absolute" zero position of a motor in the motor group to its current position.
- std::int32_t tare_position_all(void) const virtual
- Sets the "absolute" zero position of every motor in the motor group to its current position.
- std::int8_t size(void) const virtual
- Returns the number of motors in the motor group.
- std::int8_t get_port(const std::uint8_t index = 0) const virtual
- Gets the port of a motor in the motor group via index.
- void operator+=(AbstractMotor&)
- Appends all the motors in the other motor group reference to this motor group.
- void append(AbstractMotor&)
- Appends all the motors in the other motor group reference to this motor group.
- void erase_port(std::int8_t port)
- Removes the all motors on the port (regardless of reversal) from the motor group.