Feetech STS Driver
Loading...
Searching...
No Matches
sts_servo_cmd.h
Go to the documentation of this file.
1
20#pragma once
21
22#include "sts_protocol.h"
23#include "sts_servo.h"
24
30#define STS_MAX_POSITION 4095U
31#define STS_MAX_SPEED 3073U
32#define STS_MAX_ACCELERATION 150U
33#define STS_MAX_PWM 1000U
34#define STS_MAX_STEP 32767U
35#define STS_MAX_TORQUE 1000U
37#define EEPROM_UNLOCK 0U
38#define EEPROM_LOCK 1U
46typedef enum {
48 STS_DIR_CW = 1U
50
51
58sts_result_t STS_SetTorqueEnable(sts_servo_t *servo, uint8_t enable);
59
67
74sts_result_t STS_SetTargetPosition(sts_servo_t *servo, uint16_t position);
75
82sts_result_t STS_GetPresentPosition(sts_servo_t *servo, uint16_t *position_out);
83
90sts_result_t STS_GetPresentSpeed(sts_servo_t *servo, int16_t *speed_out);
91
101
108sts_result_t STS_SetTargetAcceleration(sts_servo_t *servo, uint8_t acceleration);
109
117sts_result_t STS_SetTarget(sts_servo_t *servo, int32_t target);
118
127sts_result_t STS_SetTargetStep(sts_servo_t *servo, uint16_t steps, sts_direction_t dir);
128
138
146sts_result_t STS_SetTorqueLimit(sts_servo_t *servo, uint16_t limit);
147
154sts_result_t STS_GetPresentLoad(sts_servo_t *servo, int16_t *load_out);
155
162sts_result_t STS_GetPresentVoltage(sts_servo_t *servo, uint8_t *voltage_out);
163
170sts_result_t STS_GetPresentTemperature(sts_servo_t *servo, uint8_t *temp_out);
171
178sts_result_t STS_GetMovingStatus(sts_servo_t *servo, uint8_t *status_out);
179
188sts_result_t STS_SetEEPROMLock(sts_servo_t *servo, uint8_t lock);
189
198sts_result_t STS_SetID(sts_servo_t *servo, uint8_t new_id);
STS Servo Handle Represents a single physical servo on the bus.
Definition sts_servo.h:74
: Feetech STS Servo Protocol API
sts_result_t
Return codes for STS protocol operations.
Definition sts_protocol.h:71
sts_operating_mode_t
Defines the active internal control algorithm (Operating Mode). Changing the operating mode fundament...
Definition sts_registers.h:132
: STS Service Layer and Hardware Abstraction Definitions
sts_result_t STS_GetPresentTemperature(sts_servo_t *servo, uint8_t *temp_out)
Reads the internal temperature of the servo's MCU/Motor driver.
Definition sts_servo_cmd.c:197
sts_result_t STS_SetTarget(sts_servo_t *servo, int32_t target)
Universal target wrapper that routes the command based on current mode.
Definition sts_servo_cmd.c:131
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.
Definition sts_servo_cmd.c:63
sts_result_t STS_SetEEPROMLock(sts_servo_t *servo, uint8_t lock)
Toggles the EEPROM write protection.
Definition sts_servo_cmd.c:211
sts_result_t STS_GetPresentSpeed(sts_servo_t *servo, int16_t *speed_out)
Reads the current rotational speed of the servo.
Definition sts_servo_cmd.c:76
sts_result_t STS_GetPresentPosition(sts_servo_t *servo, uint16_t *position_out)
Reads the current actual position from the servo.
Definition sts_servo_cmd.c:56
sts_result_t STS_SetOperatingMode(sts_servo_t *servo, sts_operating_mode_t mode)
Sets the operating mode of the servo.
Definition sts_servo_cmd.c:33
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.
Definition sts_servo_cmd.c:105
sts_result_t STS_GetPresentLoad(sts_servo_t *servo, int16_t *load_out)
Reads the current physical load/effort of the motor.
Definition sts_servo_cmd.c:170
sts_result_t STS_SetTorqueLimit(sts_servo_t *servo, uint16_t limit)
Sets the dynamic (RAM) maximum torque limit.
Definition sts_servo_cmd.c:160
sts_result_t STS_SetTargetAcceleration(sts_servo_t *servo, uint8_t acceleration)
Sets the acceleration profile for servo movements.
Definition sts_servo_cmd.c:95
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.
Definition sts_servo_cmd.c:204
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.
Definition sts_servo_cmd.c:118
sts_result_t STS_GetPresentVoltage(sts_servo_t *servo, uint8_t *voltage_out)
Reads the current input voltage at the servo's power terminals.
Definition sts_servo_cmd.c:190
sts_result_t STS_SetID(sts_servo_t *servo, uint8_t new_id)
Assigns a new permanent ID to the servo.
Definition sts_servo_cmd.c:219
sts_result_t STS_SetTargetPosition(sts_servo_t *servo, uint16_t position)
Sets the absolute target position for the servo.
Definition sts_servo_cmd.c:45
sts_result_t STS_SetTorqueEnable(sts_servo_t *servo, uint8_t enable)
Enables or disables motor torque output.
Definition sts_servo_cmd.c:24
sts_direction_t
Defines the rotational direction of the servo.
Definition sts_servo_cmd.h:46
@ STS_DIR_CCW
Definition sts_servo_cmd.h:47
@ STS_DIR_CW
Definition sts_servo_cmd.h:48