pros::v5::Motor class

Base classes

class AbstractMotor
class Device

Constructors, destructors, conversion operators

Motor(const std::int8_t port, const pros::v5::MotorGears gearset = pros::v5::MotorGears::invalid, const pros::v5::MotorUnits encoder_units = pros::v5::MotorUnits::invalid)
Constructs a new Motor object.
Motor(const Device& device)

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 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 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 to move to.
std::int32_t move_velocity(const std::int32_t velocity) const virtual
Sets the velocity for the motor.
std::int32_t move_voltage(const std::int32_t voltage) const virtual
Sets the output voltage for the motor from -12000 to 12000 in millivolts.
std::int32_t brake(void) const virtual
Stops the motor 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 (motor_move_absolute or motor_move_relative).

Motor telemetry functions

These functions allow programmers to collect telemetry from motors

double get_target_position(const std::uint8_t index = 0) const virtual
Gets the target position set for the motor by the user.
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.
double get_actual_velocity(const std::uint8_t index = 0) const virtual
Gets the actual velocity of the motor.
std::int32_t get_current_draw(const std::uint8_t index = 0) const virtual
Gets the current drawn by the motor in mA.
std::int32_t get_direction(const std::uint8_t index = 0) const virtual
Gets the direction of movement for the motor.
double get_efficiency(const std::uint8_t index = 0) const virtual
Gets the efficiency of the motor in percent.
std::uint32_t get_faults(const std::uint8_t index = 0) const virtual
Gets the faults experienced by the motor.
std::uint32_t get_flags(const std::uint8_t index = 0) const virtual
Gets the flags set by the motor's operation.
double get_position(const std::uint8_t index = 0) const virtual
Gets the absolute position of the motor in its encoder units.
double get_power(const std::uint8_t index = 0) const virtual
Gets the power drawn by the motor 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 the motor at a given timestamp.
double get_temperature(const std::uint8_t index = 0) const virtual
Gets the temperature of the motor in degrees Celsius.
double get_torque(const std::uint8_t index = 0) const virtual
Gets the torque generated by the motor in Newton Meters (Nm).
std::int32_t get_voltage(const std::uint8_t index = 0) const virtual
Gets the voltage delivered to the motor in millivolts.
std::int32_t is_over_current(const std::uint8_t index = 0) const virtual
Checks if the motor 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 the motor.

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 the motor.
std::int32_t get_current_limit(const std::uint8_t index = 0) const virtual
Gets the current limit for the motor in mA.
MotorUnits get_encoder_units(const std::uint8_t index = 0) const virtual
Gets the encoder units that were set for the motor.
MotorGears get_gearing(const std::uint8_t index = 0) const virtual
Gets the gearset that was set for the motor.
std::int32_t get_voltage_limit(const std::uint8_t index = 0) const virtual
Gets the voltage limit set by the user.
std::int32_t is_reversed(const std::uint8_t index = 0) const virtual
Gets whether the motor is reversed or not.
std::int32_t set_brake_mode(const MotorBrake mode, const std::uint8_t index = 0) const virtual
Sets one of Motor_Brake to the motor.
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 the motor.
std::int32_t set_current_limit(const std::int32_t limit, const std::uint8_t index = 0) const virtual
Sets the current limit for the motor in mA.
std::int32_t set_encoder_units(const MotorUnits units, const std::uint8_t index = 0) const virtual
Sets one of MotorUnits for the 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 the motor encoder.
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 the motor.
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 the motor.
std::int32_t set_reversed(const bool reverse, const std::uint8_t index = 0) virtual
Sets the reverse flag for the motor.
std::int32_t set_voltage_limit(const std::int32_t limit, const std::uint8_t index = 0) const virtual
Sets the voltage limit for the motor in Volts.
std::int32_t set_zero_position(const double position, const std::uint8_t index = 0) const virtual
Sets the position for the motor in its encoder units.
std::int32_t tare_position(const std::uint8_t index = 0) const virtual
Sets the "absolute" zero position of the motor to its current position.
std::int8_t size(void) const virtual
Gets the number of motors.
std::int8_t get_port(const std::uint8_t index = 0) const virtual
gets the port number of the motor
static std::vector<Motor> get_all_devices()
Gets all motors.

Additional motor functions

These functions allow for motors and motor groups to be used interchangeably

std::vector<double> get_target_position_all(void) const virtual
Gets a vector containing the target position set for the motor by the user.
std::vector<std::int32_t> get_target_velocity_all(void) const virtual
Gets a vector containing the velocity commanded to the motor by the user.
std::vector<double> get_actual_velocity_all(void) const virtual
Gets a vector containing the actual velocity commanded of the motor.
std::vector<std::int32_t> get_current_draw_all(void) const virtual
Gets a vector containing the current drawn by the motor in mA.
std::vector<std::int32_t> get_direction_all(void) const virtual
Gets a vector containing the direction of movement for the motor.
std::vector<double> get_efficiency_all(void) const virtual
Gets a vector containing the efficiency of the motor in percent.
std::vector<std::uint32_t> get_faults_all(void) const virtual
Gets a vector of the faults experienced by the motor.
std::vector<std::uint32_t> get_flags_all(void) const virtual
Gets a vector of the flags set by the motor's operation.
std::vector<double> get_position_all(void) const virtual
Gets a vector containing the absolute position of the motor in its encoder units.
std::vector<double> get_power_all(void) const virtual
Gets a vector containing the power drawn by the motor in Watts.
std::vector<std::int32_t> get_raw_position_all(std::uint32_t*const timestamp) const virtual
Gets a vector of the raw encoder count of the motor at a given timestamp.
std::vector<double> get_temperature_all(void) const virtual
Gets a vector of the temperature of the motor in degrees Celsius.
std::vector<double> get_torque_all(void) const virtual
Gets a vector of the torque generated by the motor in Newton Meters (Nm).
std::vector<std::int32_t> get_voltage_all(void) const virtual
Gets a vector of the voltage delivered to the motor in millivolts.
std::vector<std::int32_t> is_over_current_all(void) const virtual
Checks if the motor is drawing over its current limit.
std::vector<std::int32_t> is_over_temp_all(void) const virtual
Gets the temperature limit flag for the motor.
std::vector<MotorBrake> get_brake_mode_all(void) const virtual
Gets a vector containing the brake mode that was set for the motor.
std::vector<std::int32_t> get_current_limit_all(void) const virtual
Gets a vector containing the current limit for the motor in mA.
std::vector<MotorUnits> get_encoder_units_all(void) const virtual
Gets a vector containing the encoder units that were set for the motor.
std::vector<MotorGears> get_gearing_all(void) const virtual
Gets a vector containing the gearset that was set for the motor.
std::vector<std::int8_t> get_port_all(void) const virtual
Gets returns a vector with all the port numbers in the motor group.
std::vector<std::int32_t> get_voltage_limit_all(void) const virtual
Gets a vector of the voltage limit set by the user.
std::vector<std::int32_t> is_reversed_all(void) const virtual
Gets a vector containg whether the motor is reversed or not.
std::int32_t set_brake_mode_all(const MotorBrake mode) const virtual
Sets one of Motor_Brake to the motor.
std::int32_t set_brake_mode_all(const pros::motor_brake_mode_e_t mode) const virtual
Sets one of Motor_Brake to the motor.
std::int32_t set_current_limit_all(const std::int32_t limit) const virtual
Sets the current limit for the motor in mA.
std::int32_t set_encoder_units_all(const MotorUnits units) const virtual
Sets one of Motor_Units for the motor encoder.
std::int32_t set_encoder_units_all(const pros::motor_encoder_units_e_t units) const virtual
Sets one of Motor_Units for the motor encoder.
std::int32_t set_gearing_all(const MotorGears gearset) const virtual
Sets one of the gear cartridge (red, green, blue) for the motor.
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 the motor.
std::int32_t set_reversed_all(const bool reverse) virtual
Sets the reverse flag for the motor.
std::int32_t set_voltage_limit_all(const std::int32_t limit) const virtual
Sets the voltage limit for the motor in Volts.
std::int32_t set_zero_position_all(const double position) const virtual
Sets the position for the motor in its encoder units.
std::int32_t tare_position_all(void) const virtual
Sets the "absolute" zero position of the motor to its current position.