module
Cpp-motor-configurationContents
- Reference
These functions allow programmers to configure the behavior of motors
Motor configuration functions
- MotorBrake get_brake_mode(const std::uint8_t index = 0) const pure virtual
- Gets the brake mode that was set for the motor.
- std::vector<MotorBrake> get_brake_mode_all(void) const pure virtual
- Gets a vector of the brake mode(s) that was set for the motor(s).
- std::int32_t get_current_limit(const std::uint8_t index = 0) const pure virtual
- Gets the current limit for the motor in mA.
- std::vector<std::int32_t> get_current_limit_all(void) const pure virtual
- Gets a vector of the current limit(s) for the motor(s) in mA.
- MotorUnits get_encoder_units(const std::uint8_t index = 0) const pure virtual
- Gets the encoder units that were set for the motor.
- std::vector<MotorUnits> get_encoder_units_all(void) const pure virtual
- Gets a vector of the encoder units that were set for the motor(s).
- MotorGears get_gearing(const std::uint8_t index = 0) const pure virtual
- Gets the gearset that was set for the motor.
- std::vector<MotorGears> get_gearing_all(void) const pure virtual
- Gets a vector of the gearset(s) that was/were set for the motor(s).
- std::vector<std::int8_t> get_port_all(void) const pure virtual
- Gets returns a vector with all the port numbers in the motor group.
- std::int32_t get_voltage_limit(const std::uint8_t index = 0) const pure virtual
- Gets the voltage limit set by the user.
- std::vector<std::int32_t> get_voltage_limit_all(void) const pure virtual
- Gets a vector of the voltage limit(s) set by the user.
- std::int32_t is_reversed(const std::uint8_t index = 0) const pure virtual
- Gets the operation direction of the motor as set by the user.
- std::vector<std::int32_t> is_reversed_all(void) const pure virtual
- Gets a vector of the operation direction(s) of the motor(s) as set by the user.
- std::int32_t set_brake_mode(const MotorBrake mode, const std::uint8_t index = 0) const pure virtual
- Sets one of MotorBrake to the motor.
- std::int32_t set_brake_mode(const pros::motor_brake_mode_e_t mode, const std::uint8_t index = 0) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_brake_mode_all(const MotorBrake mode) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_brake_mode_all(const pros::motor_brake_mode_e_t mode) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_current_limit(const std::int32_t limit, const std::uint8_t index = 0) const pure virtual
- Sets the current limit for the motor in mA.
- std::int32_t set_current_limit_all(const std::int32_t limit) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_encoder_units(const MotorUnits units, const std::uint8_t index = 0) const pure 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 pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_encoder_units_all(const MotorUnits units) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_encoder_units_all(const pros::motor_encoder_units_e_t units) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_gearing(const MotorGears gearset, const std::uint8_t index = 0) const pure 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 pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_gearing_all(const MotorGears gearset) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_gearing_all(const pros::motor_gearset_e_t gearset) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_reversed(const bool reverse, const std::uint8_t index = 0) pure virtual
- Sets the reverse flag for the motor.
- std::int32_t set_reversed_all(const bool reverse) pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_voltage_limit(const std::int32_t limit, const std::uint8_t index = 0) const pure virtual
- Sets the voltage limit for the motor in Volts.
- std::int32_t set_voltage_limit_all(const std::int32_t limit) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t set_zero_position(const double position, const std::uint8_t index = 0) const pure virtual
- Sets the position for the motor in its encoder units.
- std::int32_t set_zero_position_all(const double position) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int32_t tare_position(const std::uint8_t index = 0) const pure virtual
- Sets the "absolute" zero position of the motor to its current position.
- std::int32_t tare_position_all(void) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int8_t get_port(const std::uint8_t index = 0) const pure virtual
- Gets the brake mode that was set for the motor.
- std::int8_t size(void) const pure virtual
- Returns the number of objects.
Function documentation
MotorBrake get_brake_mode(const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Parameters | |
---|---|
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::vector<MotorBrake> get_brake_mode_all(void) const pure virtual
#include <pros/abstract_motor.hpp>
Gets a vector of the brake mode(s) that was set for the motor(s).
Returns | A vector containing MotorBrake(s), according to what was set for the motor(s), or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t get_current_limit(const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the current limit for the motor in mA.
Parameters | |
---|---|
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | The motor's current limit in mA or PROS_ERR if the operation failed, setting errno. |
The default value is 2500 mA.
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::vector<std::int32_t> get_current_limit_all(void) const pure virtual
#include <pros/abstract_motor.hpp>
Gets a vector of the current limit(s) for the motor(s) in mA.
Returns | A vector containing the motor's/motors' current limit(s) in mA or PROS_ERR if the operation failed, setting errno. |
---|
The default value is 2500 mA.
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
MotorUnits get_encoder_units(const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the encoder units that were set for the motor.
Parameters | |
---|---|
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | One of MotorUnits according to what is set for the motor or E_MOTOR_ENCODER_INVALID if the operation failed. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::vector<MotorUnits> get_encoder_units_all(void) const pure virtual
#include <pros/abstract_motor.hpp>
Gets a vector of the encoder units that were set for the motor(s).
Returns | A vector of MotorUnits according to what is set for the motor(s) or E_MOTOR_ENCODER_INVALID if the operation failed. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
MotorGears get_gearing(const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the gearset that was set for the motor.
Parameters | |
---|---|
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | One of MotorGears according to what is set for the motor, or pros::MotorGears::invalid if the operation failed. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::vector<MotorGears> get_gearing_all(void) const pure virtual
#include <pros/abstract_motor.hpp>
Gets a vector of the gearset(s) that was/were set for the motor(s).
Returns | A vector of MotorGears according to what is set for the motor(s), or pros::MotorGears::invalid if the operation failed. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::vector<std::int8_t> get_port_all(void) const pure virtual
#include <pros/abstract_motor.hpp>
Gets returns a vector with all the port numbers in the motor group.
Returns | std::vector<std::int8_t> |
---|
std::int32_t get_voltage_limit(const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the voltage limit set by the user.
Parameters | |
---|---|
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | The motor's voltage limit in V or PROS_ERR if the operation failed, setting errno. |
Default value is 0V, which means that there is no software limitation imposed on the voltage.
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::vector<std::int32_t> get_voltage_limit_all(void) const pure virtual
#include <pros/abstract_motor.hpp>
Gets a vector of the voltage limit(s) set by the user.
Returns | A vector containing the motor's/motors' voltage limit(s) in V or PROS_ERR if the operation failed, setting errno. |
---|
Default value is 0V, which means that there is no software limitation imposed on the voltage.
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t is_reversed(const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the operation direction of the motor as set by the user.
Parameters | |
---|---|
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | 1 if the motor has been reversed and 0 if the motor was not reversed, or PROS_ERR if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::vector<std::int32_t> is_reversed_all(void) const pure virtual
#include <pros/abstract_motor.hpp>
Gets a vector of the operation direction(s) of the motor(s) as set by the user.
Returns | 1 if the motor has been reversed and 0 if the motor was not reversed, or PROS_ERR if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_brake_mode(const MotorBrake mode,
const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Sets one of MotorBrake to the motor.
Parameters | |
---|---|
mode | The MotorBrake to set for the motor |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
Works with the C enum and the C++ enum class.
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_brake_mode(const pros::motor_brake_mode_e_t mode,
const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Parameters | |
---|---|
mode | |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_brake_mode_all(const MotorBrake mode) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_brake_mode_all(const pros::motor_brake_mode_e_t mode) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_current_limit(const std::int32_t limit,
const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Sets the current limit for the motor in mA.
Parameters | |
---|---|
limit | The new current limit in mA |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_current_limit_all(const std::int32_t limit) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_encoder_units(const MotorUnits units,
const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Sets one of MotorUnits for the motor encoder.
Parameters | |
---|---|
units | The new motor encoder units |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
Works with the C enum and the C++ enum class.
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_encoder_units(const pros::motor_encoder_units_e_t units,
const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Parameters | |
---|---|
units | |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_encoder_units_all(const MotorUnits units) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_encoder_units_all(const pros::motor_encoder_units_e_t units) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_gearing(const MotorGears gearset,
const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Sets one of the gear cartridge (red, green, blue) for the motor.
Parameters | |
---|---|
gearset | The new motor gearset |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
Usable with the C++ enum class and the C enum.
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_gearing(const pros::motor_gearset_e_t gearset,
const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Parameters | |
---|---|
gearset | |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_gearing_all(const MotorGears gearset) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_gearing_all(const pros::motor_gearset_e_t gearset) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_reversed(const bool reverse,
const std::uint8_t index = 0) pure virtual
#include <pros/abstract_motor.hpp>
Sets the reverse flag for the motor.
Parameters | |
---|---|
reverse | True reverses the motor, false is default |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This will invert its movements and the values returned for its position.
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_reversed_all(const bool reverse) pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_voltage_limit(const std::int32_t limit,
const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Sets the voltage limit for the motor in Volts.
Parameters | |
---|---|
limit | The new voltage limit in Volts |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_voltage_limit_all(const std::int32_t limit) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_zero_position(const double position,
const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Sets the position for the motor in its encoder units.
Parameters | |
---|---|
position | The new reference position in its encoder units |
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This will be the future reference point for the motor's "absolute" position.
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t set_zero_position_all(const double position) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t tare_position(const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Sets the "absolute" zero position of the motor to its current position.
Parameters | |
---|---|
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int32_t tare_position_all(void) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int8_t get_port(const std::uint8_t index = 0) const pure virtual
#include <pros/abstract_motor.hpp>
Gets the brake mode that was set for the motor.
Parameters | |
---|---|
index | Optional parameter. The index of the motor to get the target position of. By default index is 0, and will return an error for an out of bounds index |
Returns | One of MotorBrake, according to what was set for the motor, or E_MOTOR_BRAKE_INVALID if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENODEV - The port cannot be configured as a motor
std::int8_t size(void) const pure virtual
#include <pros/abstract_motor.hpp>
Returns the number of objects.
Returns | std::int8_t |
---|