Cpp-abstract-motor » Cpp-motor-telemetry module

Contents

These functions allow programmers to collect telemetry from motors

Modules

module Cpp-motor-configuration

Motor telemetry functions

double get_actual_velocity(const std::uint8_t index = 0) const pure virtual
Gets the actual velocity of the motor.
std::vector<double> get_actual_velocity_all(void) const pure virtual
Gets a vector containing the actual velocity/velocities of the motor(s)
std::int32_t get_current_draw(const std::uint8_t index = 0) const pure virtual
Gets the current drawn by the motor in mA.
std::vector<std::int32_t> get_current_draw_all(void) const pure virtual
Gets a vector containing the current(s) drawn by the motor(s) in mA.
std::int32_t get_direction(const std::uint8_t index = 0) const pure virtual
Gets the direction of movement for the motor.
std::vector<std::int32_t> get_direction_all(void) const pure virtual
Gets a vector containing the direction(s) of movement for the motor(s).
double get_efficiency(const std::uint8_t index = 0) const pure virtual
Gets the efficiency of the motor in percent.
std::vector<double> get_efficiency_all(void) const pure virtual
Gets a vector containing the efficiency/efficiencies of the motor(s) in percent.
std::uint32_t get_faults(const std::uint8_t index = 0) const pure virtual
Gets the faults experienced by the motor.
std::vector<std::uint32_t> get_faults_all(void) const pure virtual
Gets a vector of the faults experienced by the motor(s).
std::uint32_t get_flags(const std::uint8_t index = 0) const pure virtual
Gets the flags set by the motor's operation.
std::vector<std::uint32_t> get_flags_all(void) const pure virtual
Gets a vector of the flags set by the motor's/motors' operation.
double get_position(const std::uint8_t index = 0) const pure virtual
Gets the absolute position of the motor in its encoder units.
std::vector<double> get_position_all(void) const pure virtual
Gets a vector containing the absolute position(s) of the motor(s) in its encoder units.
double get_power(const std::uint8_t index = 0) const pure virtual
Gets the power drawn by the motor in Watts.
std::vector<double> get_power_all(void) const pure virtual
Gets a vector containing the power(s) drawn by the motor(s) in Watts.
std::int32_t get_raw_position(std::uint32_t*const timestamp, const std::uint8_t index = 0) const pure virtual
Gets the raw encoder count of the motor at a given timestamp.
std::vector<std::int32_t> get_raw_position_all(std::uint32_t*const timestamp) const pure virtual
Gets a vector of the raw encoder count(s) of the motor(s) at a given timestamp.
double get_temperature(const std::uint8_t index = 0) const pure virtual
Gets the temperature of the motor in degrees Celsius.
std::vector<double> get_temperature_all(void) const pure virtual
Gets a vector of the temperature(s) of the motor(s) in degrees Celsius.
double get_torque(const std::uint8_t index = 0) const pure virtual
Gets the torque generated by the motor in Newton Meters (Nm).
std::vector<double> get_torque_all(void) const pure virtual
Gets a vector of the torque(s) generated by the motor(s) in Newton Meters (Nm).
std::int32_t get_voltage(const std::uint8_t index = 0) const pure virtual
Gets the voltage delivered to the motor in millivolts.
std::vector<std::int32_t> get_voltage_all(void) const pure virtual
Gets a vector of the voltage(s) delivered to the motor(s) in millivolts.
std::int32_t is_over_current(const std::uint8_t index = 0) const pure virtual
Checks if the motor is drawing over its current limit.
std::vector<std::int32_t> is_over_current_all(void) const pure virtual
Gets a vector of whether each motor is drawing over its current limit.
std::int32_t is_over_temp(const std::uint8_t index = 0) const pure virtual
Gets the temperature limit flag for the motor.
std::vector<std::int32_t> is_over_temp_all(void) const pure virtual
Gets a vector of the temperature limit flag(s) for the motor(s).

Function documentation

double get_actual_velocity(const std::uint8_t index = 0) const pure virtual

Gets the actual velocity of 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 The motor's actual velocity in RPM or PROS_ERR_F 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<double> get_actual_velocity_all(void) const pure virtual

Gets a vector containing the actual velocity/velocities of the motor(s)

Returns A vector containing the motor's/motors' actual velocity/velocities in RPM or PROS_ERR_F 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_draw(const std::uint8_t index = 0) const pure virtual

Gets the current drawn by 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 in mA 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> get_current_draw_all(void) const pure virtual

Gets a vector containing the current(s) drawn by the motor(s) in mA.

Returns A vector conatining the motor's/motors' current(s) in mA 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 get_direction(const std::uint8_t index = 0) const pure virtual

Gets the direction of movement 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 1 for moving in the positive direction, -1 for moving in the negative direction, and 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> get_direction_all(void) const pure virtual

Gets a vector containing the direction(s) of movement for the motor(s).

Returns A vector containing 1 for moving in the positive direction, -1 for moving in the negative direction, and 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

double get_efficiency(const std::uint8_t index = 0) const pure virtual

Gets the efficiency of the motor in percent.

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 efficiency in percent or PROS_ERR_F if the operation failed, setting errno.

An efficiency of 100% means that the motor is moving electrically while drawing no electrical power, and an efficiency of 0% means that the motor is drawing power but not moving.

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<double> get_efficiency_all(void) const pure virtual

Gets a vector containing the efficiency/efficiencies of the motor(s) in percent.

Returns A vector containing the motor's/motors' efficiency/efficiencies in percent or PROS_ERR_F if the operation failed, setting errno.

An efficiency of 100% means that the motor is moving electrically while drawing no electrical power, and an efficiency of 0% means that the motor is drawing power but not moving.

This function uses the following values of errno when an error state is reached:

ENODEV - The port cannot be configured as a motor

std::uint32_t get_faults(const std::uint8_t index = 0) const pure virtual

Gets the faults experienced by 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 A bitfield containing the motor's faults.

Compare this bitfield to the bitmasks in pros::motor_fault_e_t.

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::uint32_t> get_faults_all(void) const pure virtual

Gets a vector of the faults experienced by the motor(s).

Returns A bitfield containing the motor's/motors' faults.

Compare this bitfield to the bitmasks in pros::motor_fault_e_t.

This function uses the following values of errno when an error state is reached:

ENODEV - The port cannot be configured as a motor

std::uint32_t get_flags(const std::uint8_t index = 0) const pure virtual

Gets the flags set by the motor's operation.

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 A bitfield containing the motor's flags.

Compare this bitfield to the bitmasks in pros::motor_flag_e_t.

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::uint32_t> get_flags_all(void) const pure virtual

Gets a vector of the flags set by the motor's/motors' operation.

Returns A bitfield containing the motor's/motors' flags.

Compare this bitfield to the bitmasks in pros::motor_flag_e_t.

This function uses the following values of errno when an error state is reached:

ENODEV - The port cannot be configured as a motor

double get_position(const std::uint8_t index = 0) const pure virtual

Gets the absolute position of the motor in its encoder units.

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 absolute position in its encoder units or PROS_ERR_F 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<double> get_position_all(void) const pure virtual

Gets a vector containing the absolute position(s) of the motor(s) in its encoder units.

Returns A vector containing the motor's/motors' absolute position(s) in its encoder units or PROS_ERR_F 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

double get_power(const std::uint8_t index = 0) const pure virtual

Gets the power drawn by the motor in Watts.

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 power draw in Watts or PROS_ERR_F 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<double> get_power_all(void) const pure virtual

Gets a vector containing the power(s) drawn by the motor(s) in Watts.

Returns A vector containing the motor's/motors' power draw in Watts or PROS_ERR_F 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_raw_position(std::uint32_t*const timestamp, const std::uint8_t index = 0) const pure virtual

Gets the raw encoder count of the motor at a given timestamp.

Parameters
timestamp in A pointer to a time in milliseconds for which the encoder count will be returned. If NULL, the timestamp at which the encoder count was read will not be supplied
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 raw encoder count at the given timestamp or PROS_ERR 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::int32_t> get_raw_position_all(std::uint32_t*const timestamp) const pure virtual

Gets a vector of the raw encoder count(s) of the motor(s) at a given timestamp.

Parameters
timestamp A pointer to a time in milliseconds for which the encoder count will be returned. If NULL, the timestamp at which the encoder count was read will not be supplied
Returns A vector containing the raw encoder count(s) at the given timestamp or PROS_ERR 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

double get_temperature(const std::uint8_t index = 0) const pure virtual

Gets the temperature of the motor in degrees Celsius.

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 temperature in degrees Celsius or PROS_ERR_F 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<double> get_temperature_all(void) const pure virtual

Gets a vector of the temperature(s) of the motor(s) in degrees Celsius.

Returns A vector containing the motor's/motors' temperature(s) in degrees Celsius or PROS_ERR_F 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

double get_torque(const std::uint8_t index = 0) const pure virtual

Gets the torque generated by the motor in Newton Meters (Nm).

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 torque in Nm or PROS_ERR_F 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<double> get_torque_all(void) const pure virtual

Gets a vector of the torque(s) generated by the motor(s) in Newton Meters (Nm).

Returns A vector containing the motor's/motors' torque(s) in Nm or PROS_ERR_F 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_voltage(const std::uint8_t index = 0) const pure virtual

Gets the voltage delivered to the motor in millivolts.

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 in mV or PROS_ERR_F 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> get_voltage_all(void) const pure virtual

Gets a vector of the voltage(s) delivered to the motor(s) in millivolts.

Returns A vector containing the motor's/motors' voltage(s) in mV or PROS_ERR_F 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 is_over_current(const std::uint8_t index = 0) const pure virtual

Checks if the motor is drawing over its current limit.

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's current limit is being exceeded and 0 if the current limit is not exceeded, 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_over_current_all(void) const pure virtual

Gets a vector of whether each motor is drawing over its current limit.

Returns 1 if the motor's current limit is being exceeded and 0 if the current limit is not exceeded, 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 is_over_temp(const std::uint8_t index = 0) const pure virtual

Gets the temperature limit flag 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 1 if the temperature limit is exceeded and 0 if the temperature is below the limit, 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_over_temp_all(void) const pure virtual

Gets a vector of the temperature limit flag(s) for the motor(s).

Returns 1 if the temperature limit is exceeded and 0 if the temperature is below the limit, 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