|
Feetech STS Driver
|
: STS Servo Command Implementation More...
Functions | |
| sts_result_t | STS_SetTorqueEnable (sts_servo_t *servo, uint8_t enable) |
| Enables or disables motor torque output. | |
| sts_result_t | STS_SetOperatingMode (sts_servo_t *servo, sts_operating_mode_t mode) |
| Sets the operating mode of the servo. | |
| sts_result_t | STS_SetTargetPosition (sts_servo_t *servo, uint16_t position) |
| Sets the absolute target position for the servo. | |
| sts_result_t | STS_GetPresentPosition (sts_servo_t *servo, uint16_t *position_out) |
| Reads the current actual position from the servo. | |
| sts_result_t | STS_SetTargetSpeed (sts_servo_t *servo, uint16_t speed, sts_direction_t dir) |
| Sets the target speed and direction of the servo. | |
| sts_result_t | STS_GetPresentSpeed (sts_servo_t *servo, int16_t *speed_out) |
| Reads the current rotational speed of the servo. | |
| sts_result_t | STS_SetTargetAcceleration (sts_servo_t *servo, uint8_t acceleration) |
| Sets the acceleration profile for servo movements. | |
| sts_result_t | STS_SetTargetPWM (sts_servo_t *servo, uint16_t pwm, sts_direction_t dir) |
| Sets the open-loop PWM duty cycle (effort) applied to motor coils. | |
| sts_result_t | STS_SetTargetStep (sts_servo_t *servo, uint16_t steps, sts_direction_t dir) |
| Commands the servo to move a relative number of steps. | |
| sts_result_t | STS_SetTarget (sts_servo_t *servo, int32_t target) |
| Universal target wrapper that routes the command based on current mode. | |
| sts_result_t | STS_SetTorqueLimit (sts_servo_t *servo, uint16_t limit) |
| Sets the dynamic (RAM) maximum torque limit. | |
| sts_result_t | STS_GetPresentLoad (sts_servo_t *servo, int16_t *load_out) |
| Reads the current physical load/effort of the motor. | |
| sts_result_t | STS_GetPresentVoltage (sts_servo_t *servo, uint8_t *voltage_out) |
| Reads the current input voltage at the servo's power terminals. | |
| sts_result_t | STS_GetPresentTemperature (sts_servo_t *servo, uint8_t *temp_out) |
| Reads the internal temperature of the servo's MCU/Motor driver. | |
| sts_result_t | STS_GetMovingStatus (sts_servo_t *servo, uint8_t *status_out) |
| Reads the moving status flag to determine if the motor is currently in motion. | |
| sts_result_t | STS_SetEEPROMLock (sts_servo_t *servo, uint8_t lock) |
| Toggles the EEPROM write protection. | |
| sts_result_t | STS_SetID (sts_servo_t *servo, uint8_t new_id) |
| Assigns a new permanent ID to the servo. | |
: STS Servo Command Implementation
Implements the high-level command set for Feetech STS servo control, built on top of the STS_Write8, STS_Write16, STS_Read8, and STS_Read16 register access primitives.
All commands are stateless and route through the service layer command engine no direct protocol framing occurs at this level.
| sts_result_t STS_GetMovingStatus | ( | sts_servo_t * | servo, |
| uint8_t * | status_out | ||
| ) |
Reads the moving status flag to determine if the motor is currently in motion.
| servo | Pointer to an initialized servo handle. | |
| [out] | status_out | Pointer to store the moving flag (1: Moving, 0: Target reached). |
| sts_result_t STS_GetPresentLoad | ( | sts_servo_t * | servo, |
| int16_t * | load_out | ||
| ) |
Reads the current physical load/effort of the motor.
| servo | Pointer to an initialized servo handle. | |
| [out] | load_out | Pointer to store the signed load value. |
| sts_result_t STS_GetPresentPosition | ( | sts_servo_t * | servo, |
| uint16_t * | position_out | ||
| ) |
Reads the current actual position from the servo.
| servo | Pointer to an initialised servo handle. | |
| [out] | position_out | Pointer to store the 16-bit position. |
| sts_result_t STS_GetPresentSpeed | ( | sts_servo_t * | servo, |
| int16_t * | speed_out | ||
| ) |
Reads the current rotational speed of the servo.
| servo | Pointer to an initialised servo handle. | |
| [out] | speed_out | Pointer to store the 16-bit speed value. |
| sts_result_t STS_GetPresentTemperature | ( | sts_servo_t * | servo, |
| uint8_t * | temp_out | ||
| ) |
Reads the internal temperature of the servo's MCU/Motor driver.
| servo | Pointer to an initialized servo handle. | |
| [out] | temp_out | Pointer to store the temperature in degrees Celsius. |
| sts_result_t STS_GetPresentVoltage | ( | sts_servo_t * | servo, |
| uint8_t * | voltage_out | ||
| ) |
Reads the current input voltage at the servo's power terminals.
| servo | Pointer to an initialized servo handle. | |
| [out] | voltage_out | Pointer to store the voltage (in 0.1V units, e.g., 120 = 12.0V). |
| sts_result_t STS_SetEEPROMLock | ( | sts_servo_t * | servo, |
| uint8_t | lock | ||
| ) |
Toggles the EEPROM write protection.
| servo | Pointer to an initialized servo handle. |
| lock | EEPROM_LOCK to protect, EEPROM_UNLOCK to unprotect. |
| sts_result_t STS_SetID | ( | sts_servo_t * | servo, |
| uint8_t | new_id | ||
| ) |
Assigns a new permanent ID to the servo.
| servo | Pointer to an initialized servo handle. |
| new_id | The new ID (0 to STS_ID_BROADCAST_SYNC). |
| sts_result_t STS_SetOperatingMode | ( | sts_servo_t * | servo, |
| sts_operating_mode_t | mode | ||
| ) |
Sets the operating mode of the servo.
| servo | Pointer to an initialised servo handle. |
| mode | The desired operating mode (Position, Speed, PWM, Step). |
| sts_result_t STS_SetTarget | ( | sts_servo_t * | servo, |
| int32_t | target | ||
| ) |
Universal target wrapper that routes the command based on current mode.
| servo | Pointer to an initialized servo handle. |
| target | The desired target value. Bounds depend on active mode. |
| sts_result_t STS_SetTargetAcceleration | ( | sts_servo_t * | servo, |
| uint8_t | acceleration | ||
| ) |
Sets the acceleration profile for servo movements.
| servo | Pointer to an initialized servo handle. |
| acceleration | The acceleration rate (0 to STS_MAX_ACCELERATION). |
| sts_result_t STS_SetTargetPosition | ( | sts_servo_t * | servo, |
| uint16_t | position | ||
| ) |
Sets the absolute target position for the servo.
| servo | Pointer to an initialised servo handle. |
| position | 0 to STS_MAX_POSITION. |
| sts_result_t STS_SetTargetPWM | ( | sts_servo_t * | servo, |
| uint16_t | pwm, | ||
| sts_direction_t | dir | ||
| ) |
Sets the open-loop PWM duty cycle (effort) applied to motor coils.
| servo | Pointer to an initialized servo handle. |
| pwm | Raw PWM effort value (0 to STS_MAX_PWM). |
| dir | The direction to apply force (STS_DIR_CW or STS_DIR_CCW). |
| sts_result_t STS_SetTargetSpeed | ( | sts_servo_t * | servo, |
| uint16_t | speed, | ||
| sts_direction_t | dir | ||
| ) |
Sets the target speed and direction of the servo.
| servo | Pointer to an initialized servo handle. |
| speed | The target speed magnitude (0 to STS_MAX_SPEED). |
| dir | The desired rotation direction (STS_DIR_CCW or STS_DIR_CW). |
| sts_result_t STS_SetTargetStep | ( | sts_servo_t * | servo, |
| uint16_t | steps, | ||
| sts_direction_t | dir | ||
| ) |
Commands the servo to move a relative number of steps.
| servo | Pointer to an initialized servo handle. |
| steps | Number of relative steps to execute (0 to STS_MAX_STEP). |
| dir | The direction of rotation (STS_DIR_CW or STS_DIR_CCW). |
| sts_result_t STS_SetTorqueEnable | ( | sts_servo_t * | servo, |
| uint8_t | enable | ||
| ) |
Enables or disables motor torque output.
| servo | Pointer to an initialised servo handle. |
| enable | Non-zero to enable torque, zero to disable (free spin). |
| sts_result_t STS_SetTorqueLimit | ( | sts_servo_t * | servo, |
| uint16_t | limit | ||
| ) |
Sets the dynamic (RAM) maximum torque limit.
| servo | Pointer to an initialized servo handle. |
| limit | Max torque value (0 to STS_MAX_TORQUE). 0 disables torque. |