Module motor Copy item path Source motor_pid_full_s_t Holds the information about a Motor’s position or velocity PID controls. motor_pid_s_t Holds just the constants for a Motor’s position or velocity PID controls. E_MOTOR_BRAKE_BRAKE Motor brakes when stopped E_MOTOR_BRAKE_COAST Motor coasts when stopped, traditional behavior E_MOTOR_BRAKE_HOLD Motor actively holds position when stopped E_MOTOR_BRAKE_INVALID E_MOTOR_ENCODER_COUNTS Position is recorded as raw encoder ticks as a whole number E_MOTOR_ENCODER_DEGREES Position is recorded as angle in degrees as a floating point number E_MOTOR_ENCODER_INVALID E_MOTOR_ENCODER_ROTATIONS Position is recorded as angle in rotations as a floating point number E_MOTOR_FAULT_DRIVER_FAULT Indicates a motor h-bridge fault E_MOTOR_FAULT_DRV_OVER_CURRENT Indicates an h-bridge over current E_MOTOR_FAULT_MOTOR_OVER_TEMP Analogous to motor_is_over_temp() E_MOTOR_FAULT_NO_FAULTS E_MOTOR_FAULT_OVER_CURRENT Analogous to motor_is_over_current() E_MOTOR_FLAGS_BUSY Cannot currently communicate to the motor E_MOTOR_FLAGS_NONE E_MOTOR_FLAGS_ZERO_POSITION E_MOTOR_FLAGS_ZERO_VELOCITY Analogous to motor_is_stopped() E_MOTOR_GEARSET_06 6:1, 600 RPM, Blue gear set E_MOTOR_GEARSET_18 18:1, 200 RPM, Green gear set E_MOTOR_GEARSET_36 36:1, 100 RPM, Red gear set E_MOTOR_GEARSET_INVALID E_MOTOR_GEAR_100 E_MOTOR_GEAR_200 E_MOTOR_GEAR_600 E_MOTOR_GEAR_BLUE E_MOTOR_GEAR_GREEN E_MOTOR_GEAR_RED motor_brake ⚠ Stops the motor using the currently configured brake mode. motor_convert_pid ⚠ Deprecated Takes in floating point values and returns a properly formatted pid struct.
The motor_pid_s_t struct is in 4.4 format, i.e. 0x20 is 2.0, 0x21 is 2.0625,
etc.
This function will convert the floating point values to the nearest 4.4
value. motor_convert_pid_full ⚠ Deprecated Takes in floating point values and returns a properly formatted pid struct.
The motor_pid_s_t struct is in 4.4 format, i.e. 0x20 is 2.0, 0x21 is 2.0625,
etc.
This function will convert the floating point values to the nearest 4.4
value. motor_get_actual_velocity ⚠ Gets the actual velocity of the motor. motor_get_brake_mode ⚠ Gets the brake mode that was set for the motor. motor_get_current_draw ⚠ Gets the current drawn by the motor in mA. motor_get_current_limit ⚠ Gets the current limit for the motor in mA. motor_get_direction ⚠ Gets the direction of movement for the motor. motor_get_efficiency ⚠ Gets the efficiency of the motor in percent. motor_get_encoder_units ⚠ Gets the encoder units that were set for the motor. motor_get_faults ⚠ Gets the faults experienced by the motor. motor_get_flags ⚠ Gets the flags set by the motor’s operation. motor_get_gearing ⚠ Gets the gearset that was set for the motor. motor_get_pos_pid ⚠ Deprecated Gets the position PID that was set for the motor. This function will return
zero for all of the parameters if the motor_set_pos_pid() or
motor_set_pos_pid_full() functions have not been used. motor_get_position ⚠ Gets the absolute position of the motor in its encoder units. motor_get_power ⚠ Gets the power drawn by the motor in Watts. motor_get_raw_position ⚠ Gets the raw encoder count of the motor at a given timestamp. motor_get_target_position ⚠ Gets the target position set for the motor by the user. motor_get_target_velocity ⚠ Gets the velocity commanded to the motor by the user. motor_get_temperature ⚠ Gets the temperature of the motor in degrees Celsius. motor_get_torque ⚠ Gets the torque generated by the motor in Newton Meters (Nm). motor_get_vel_pid ⚠ Deprecated Gets the velocity PID that was set for the motor. This function will return
zero for all of the parameters if the motor_set_vel_pid() or
motor_set_vel_pid_full() functions have not been used. motor_get_voltage ⚠ Gets the voltage delivered to the motor in millivolts. motor_get_voltage_limit ⚠ Gets the voltage limit set by the user. motor_get_zero_position_flag ⚠ Checks if the motor is at its zero position. motor_is_over_current ⚠ Checks if the motor is drawing over its current limit. motor_is_over_temp ⚠ Checks if the motor’s temperature is above its limit. motor_is_reversed ⚠ Gets the operation direction of the motor as set by the user. motor_is_stopped ⚠ Checks if the motor is stopped. motor_modify_profiled_velocity ⚠ Changes the output velocity for a profiled movement (motor_move_absolute or
motor_move_relative). This will have no effect if the motor is not following
a profiled movement. motor_move ⚠ Sets the voltage for the motor from -127 to 127. motor_move_absolute ⚠ Sets the target absolute position for the motor to move to. motor_move_relative ⚠ Sets the relative target position for the motor to move to. motor_move_velocity ⚠ Sets the velocity for the motor. motor_move_voltage ⚠ Sets the output voltage for the motor from -12000 to 12000 in millivolts motor_set_brake_mode ⚠ Sets one of motor_brake_mode_e_t to the motor. motor_set_current_limit ⚠ Sets the current limit for the motor in mA. motor_set_encoder_units ⚠ Sets one of motor_encoder_units_e_t for the motor encoder. motor_set_gearing ⚠ Sets one of motor_gearset_e_t for the motor. motor_set_pos_pid ⚠ Deprecated Sets one of motor_pid_s_t for the motor. This intended to just modify the
main PID constants. motor_set_pos_pid_full ⚠ Deprecated Sets one of motor_pid_full_s_t for the motor. motor_set_reversed ⚠ Sets the reverse flag for the motor. motor_set_vel_pid ⚠ Deprecated Sets one of motor_pid_s_t for the motor. This intended to just modify the
main PID constants. motor_set_vel_pid_full ⚠ Deprecated Sets one of motor_pid_full_s_t for the motor. motor_set_voltage_limit ⚠ Sets the voltage limit for the motor in Volts. motor_set_zero_position ⚠ Sets the position for the motor in its encoder units. motor_tare_position ⚠ Sets the “absolute” zero position of the motor to its current position. motor_brake_mode_e_t motor_encoder_units_e_t motor_fault_e_t motor_flag_e_t motor_gearset_e_t