Skip to content
Snippets Groups Projects
Commit 5ed6c284 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Removed some no longer needed files because they are implemented in the stm32_libraries repository.

parent de6b64ab
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
#ifndef _DYN_SERVOS_H
#define _DYN_SERVOS_H
// servo models
#define SERVO_DX113 0x0071
#define SERVO_DX116 0x0074
#define SERVO_DX117 0x0075
#define SERVO_AX12A 0x000C
#define SERVO_AX12W 0x012C
#define SERVO_AX18A 0x0012
#define SERVO_RX10 0x000A
#define SERVO_MX12W 0x0168
#define SERVO_MX28 0x001D
#define SERVO_RX24F 0x0018
#define SERVO_RX28 0x001C
#define SERVO_RX64 0x0040
#define SERVO_MX64 0x0136
#define SERVO_EX106 0x006B
#define SERVO_MX106 0x0140
#define SERVO_XL320 0x015E
#define IS_SERVO(model) (model==SERVO_DX113 || model==SERVO_DX116 || model==SERVO_DX117 || model==SERVO_AX12A \
model==SERVO_AX12W || model==SERVO_AX18A || model==SERVO_RX10 || model==SERVO_MX12W \
model==SERVO_MX28 || model==SERVO_RX24F || model==SERVO_RX28 || model==SERVO_RX64 \
model==SERVO_MX64 || model==SERVO_EX106 || model==SERVO_MX106 || model==SERVO_XL320)
// Servo register map
typedef enum{
P_MODEL_NUMBER_L = 0,
P_MODEL_NUMBER_H = 1,
P_VERSION = 2,
P_ID = 3,
P_BAUD_RATE = 4,
P_RETURN_DELAY_TIME = 5,
P_CW_ANGLE_LIMIT_L = 6,
P_CW_ANGLE_LIMIT_H = 7,
P_CCW_ANGLE_LIMIT_L = 8,
P_CCW_ANGLE_LIMIT_H = 9,
P_SYSTEM_DATA2 = 10,
P_HIGH_LIMIT_TEMPERATURE = 11,
P_LOW_LIMIT_VOLTAGE = 12,
P_HIGH_LIMIT_VOLTAGE = 13,
P_MAX_TORQUE_L = 14,
P_MAX_TORQUE_H = 15,
P_RETURN_LEVEL = 16,
P_ALARM_LED = 17,
P_ALARM_SHUTDOWN = 18,
P_OPERATING_MODE = 19,
P_LOW_CALIBRATION_L = 20,
P_LOW_CALIBRATION_H = 21,
P_HIGH_CALIBRATION_L = 22,
P_HIGH_CALIBRATION_H = 23,
P_TORQUE_ENABLE = 24,
P_LED = 25,
P_CW_COMPLIANCE_MARGIN = 26,
P_CCW_COMPLIANCE_MARGIN = 27,
P_CW_COMPLIANCE_SLOPE = 28,
P_CCW_COMPLIANCE_SLOPE = 29,
P_D_GAIN = 26,
P_I_GAIN = 27,
P_P_GAIN = 28,
P_RESERVED = 29,
P_GOAL_POSITION_L = 30,
P_GOAL_POSITION_H = 31,
P_MOVING_SPEED_L = 32,
P_MOVING_SPEED_H = 33,
P_TORQUE_LIMIT_L = 34,
P_TORQUE_LIMIT_H = 35,
P_PRESENT_POSITION_L = 36,
P_PRESENT_POSITION_H = 37,
P_PRESENT_SPEED_L = 38,
P_PRESENT_SPEED_H = 39,
P_PRESENT_LOAD_L = 40,
P_PRESENT_LOAD_H = 41,
P_PRESENT_VOLTAGE = 42,
P_PRESENT_TEMPERATURE = 43,
P_REGISTERED_INSTRUCTION = 44,
P_PAUSE_TIME = 45,
P_MOVING = 46,
P_LOCK = 47,
P_PUNCH_L = 48,
P_PUNCH_H = 49,
P_RESERVED4 = 50,
P_RESERVED5 = 51,
P_POT_L = 52,
P_POT_H = 53,
P_PWM_OUT_L = 54,
P_PWM_OUT_H = 55,
P_P_ERROR_L = 56,
P_P_ERROR_H = 57,
P_I_ERROR_L = 58,
P_I_ERROR_H = 59,
P_D_ERROR_L = 60,
P_D_ERROR_H = 61,
P_P_ERROR_OUT_L = 62,
P_P_ERROR_OUT_H = 63,
P_I_ERROR_OUT_L = 64,
P_I_ERROR_OUT_H = 65,
P_D_ERROR_OUT_L = 66,
P_D_ERROR_OUT_H = 67}TDynServo;
typedef enum{
XL_MODEL_NUMBER_L = 0,
XL_MODEL_NUMBER_H = 1,
XL_VERSION = 2,
XL_ID = 3,
XL_BAUD_RATE = 4,
XL_RETURN_DELAY_TIME = 5,
XL_CW_ANGLE_LIMIT_L = 6,
XL_CW_ANGLE_LIMIT_H = 7,
XL_CCW_ANGLE_LIMIT_L = 8,
XL_CCW_ANGLE_LIMIT_H = 9,
XL_SYSTEM_DATA2 = 10,
XL_CONTROL_MODE = 11,
XL_HIGH_LIMIT_TEMPERATURE = 12,
XL_LOW_LIMIT_VOLTAGE = 13,
XL_HIGH_LIMIT_VOLTAGE = 14,
XL_MAX_TORQUE_L = 15,
XL_MAX_TORQUE_H = 16,
XL_RETURN_LEVEL = 17,
XL_ALARM_SHUTDOWN = 18,
XL_TORQUE_ENABLE = 24,
XL_LED = 25,
XL_D_GAIN = 27,
XL_I_GAIN = 28,
XL_P_GAIN = 29,
XL_GOAL_POSITION_L = 30,
XL_GOAL_POSITION_H = 31,
XL_MOVING_SPEED_L = 32,
XL_MOVING_SPEED_H = 33,
XL_TORQUE_LIMIT_L = 35,
XL_TORQUE_LIMIT_H = 36,
XL_PRESENT_POSITION_L = 37,
XL_PRESENT_POSITION_H = 38,
XL_PRESENT_SPEED_L = 39,
XL_PRESENT_SPEED_H = 40,
XL_PRESENT_LOAD_L = 41,
XL_PRESENT_LOAD_H = 42,
XL_PRESENT_VOLTAGE = 45,
XL_PRESENT_TEMPERATURE = 46,
XL_REGISTERED_INSTRUCTION = 47,
XL_MOVING = 49,
XL_HARDWARE_ERROR_STATUS = 50,
XL_PUNCH_L = 51,
XL_PUNCH_H = 51}TXLServo;
#endif
#ifndef __EEPROM_INIT_H
#define __EEPROM_INIT_H
#ifdef __cplusplus
extern "C" {
#endif
#define DEFAULT_MM_PERIOD 0x1E78 //7800us
#define DEFAULT_BAL_KNEE_GAIN 0x4CCD // 0.3 in fixed point format 0|16
#define DEFAULT_BAL_ANKLE_ROLL_GAIN 0xFFFF // 0.99999
#define DEFAULT_BAL_ANKLE_PITCH_GAIN 0xE666 // 0.9
#define DEFAULT_BAL_HIP_ROLL_GAIN 0x8000 // 0.5
#define DEFAULT_SERVO0_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO1_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO2_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO3_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO4_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO5_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO6_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO7_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO8_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO9_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO10_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO11_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO12_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO13_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO14_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO15_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO16_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO17_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO18_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO19_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO20_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO21_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO22_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO23_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO24_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO25_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO26_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO27_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO28_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO29_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO30_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_SERVO31_OFFSET 0x0000 // 0 in fixed point format 4 (1+3) | 4
#define DEFAULT_WALK_X_OFFSET 0xFFF6 // -10 mm
#define DEFAULT_WALK_Y_OFFSET 0x0005 // 5 mm
#define DEFAULT_WALK_Z_OFFSET 0x0014 // 20 mm
#define DEFAULT_WALK_ROLL_OFFSET 0x0000 // 0 degrees in fixed point format 5 (1+4) | 3
#define DEFAULT_WALK_PITCH_OFFSET 0x0000 // 0 degrees in fixed point format 5 (1+4) | 3
#define DEFAULT_WALK_YAW_OFFSET 0x0000 // 0 degrees in fixed point format 5 (1+4) | 3
#define DEFAULT_WALK_HIP_PITCH_OFF 0x34B6 // 13.18 degrees in fixed point format 6 (1+5) | 10
#define DEFAULT_WALK_PERIOD_TIME 0x0258 // 600 ms
#define DEFAULT_WALK_DSP_RATIO 0x0019 // 0.1 in fixed point format 0 | 8
#define DEFAULT_WALK_STEP_FW_BW_RATIO 0x004C // 0.3 in fixed point format 0 | 8
#define DEFAULT_WALK_FOOT_HEIGHT 0x0028 // 40 mm
#define DEFAULT_WALK_SWING_RIGHT_LEFT 0x0014 // 20 mm
#define DEFAULT_WALK_SWING_TOP_DOWN 0x0005 // 5 mm
#define DEFAULT_WALK_PELVIS_OFFSET 0x0018 // 3 degrees in fixed point format 5 (1+4) | 3
#define DEFAULT_WALK_ARM_SWING_GAIN 0x0030 // 1.5 in fixed point format 3 | 5
#define DEFAULT_WALK_MAX_VEL 0x0016 // 20 mm/s
#define DEFAULT_WALK_MAX_ROT_VEL 0x0040 // 8 degrees/s in fixed point format 5 | 3
#define DEFAULT_HEAD_PAN_P 0x028F // 0.01 in fixed point format 0|16
#define DEFAULT_HEAD_PAN_I 0x0000 // 0.0 in fixed point format 0|16
#define DEFAULT_HEAD_PAN_D 0x0000 // 0.0 in fixed point format 0|16
#define DEFAULT_HEAD_PAN_I_CLAMP 0x0000 // 0.0 in fixed point format 9|7
#define DEFAULT_HEAD_TILT_P 0x028F // 0.01 in fixed point format 0|16
#define DEFAULT_HEAD_TILT_I 0x0000 // 0.0 in fixed point format 0|16
#define DEFAULT_HEAD_TILT_D 0x0000 // 0.0 in fixed point format 0|16
#define DEFAULT_HEAD_TILT_I_CLAMP 0x0000 // 0.0 in fixed point format 9|7
#define DEFAULT_GRIPPER_LEFT_TOP_ID 0x0015 // ID 21 for the left gripper
#define DEFAULT_GRIPPER_LEFT_BOT_ID 0x0016 // ID 22 for the left gripper
#define DEFAULT_GRIPPER_LEFT_MAX_ANGLE 0x0F00 // 30 in fixed point format 9|7
#define DEFAULT_GRIPPER_LEFT_MIN_ANGLE 0xF100 // -30 in fixed point format 9|7
#define DEFAULT_GRIPPER_LEFT_MAX_FORCE 0x0080 // 1023 max force in binary format
#define DEFAULT_GRIPPER_RIGHT_TOP_ID 0x0017 // ID 23 for the left gripper
#define DEFAULT_GRIPPER_RIGHT_BOT_ID 0x0018 // ID 24 for the left gripper
#define DEFAULT_GRIPPER_RIGHT_MAX_ANGLE 0x0F00 // 30 in fixed point format 9|7
#define DEFAULT_GRIPPER_RIGHT_MIN_ANGLE 0xF100 // -30 in fixed point format 9|7
#define DEFAULT_GRIPPER_RIGHT_MAX_FORCE 0x0080 // 1023 max force in binary format
#define DEFAULT_SMART_CHARGER_PERIOD 0x05DC // 1500 ms
#define DEFAULT_STAIRS_PHASE1_TIME 0x0640 // 1600 ms
#define DEFAULT_STAIRS_PHASE2_TIME 0x0C80 // 3200 ms
#define DEFAULT_STAIRS_PHASE3_TIME 0x12C0 // 4800 ms
#define DEFAULT_STAIRS_PHASE4_TIME 0x1900 // 6400 ms
#define DEFAULT_STAIRS_PHASE5_TIME 0x1F40 // 8000 ms
#define DEFAULT_STAIRS_PHASE6_TIME 0x2580 // 9600 ms
#define DEFAULT_STAIRS_PHASE7_TIME 0x2BC0 // 11200 ms
#define DEFAULT_STAIRS_PHASE8_TIME 0x3200 // 12800 ms
#define DEFAULT_STAIRS_PHASE9_TIME 0x3840 // 14400 ms
#define DEFAULT_STAIRS_X_OFFSET 0xFFF6 // -10 mm
#define DEFAULT_STAIRS_Y_OFFSET 0x0005 // 5mm
#define DEFAULT_STAIRS_Z_OFFSET 0x0014 // 20 mm
#define DEFAULT_STAIRS_R_OFFSET 0x0000 // 0 degrees in fixed point format 5 (1+4) | 3
#define DEFAULT_STAIRS_P_OFFSET 0x0000 // 0 degrees in fixed point format 5 (1+4) | 3
#define DEFAULT_STAIRS_A_OFFSET 0x0000 // 0 degrees in fixed point format 5 (1+4) | 3
#define DEFAULT_STAIRS_Y_SHIFT 0x0028 // 40 mm
#define DEFAULT_STAIRS_X_SHIFT 0x0050 // 80 mm
#define DEFAULT_STAIRS_Z_OVERSHOOT 0x000F // 15 mm
#define DEFAULT_STAIRS_Z_HEIGHT 0x001E // 30 mm
#define DEFAULT_STAIRS_HIP_PITCH_OFF 0x34B6 // 13.18 degrees in fixed point format 6 (1+5) | 10
#define DEFAULT_STAIRS_R_SHIFT 0x000B // 2.875 degrees in fixed point format 5 (1+5) | 2
#define DEFAULT_STAIRS_P_SHIFT 0x0017 // 5.73 degrees in fixed point format 5 (1+5) | 2
#define DEFAULT_STAIRS_A_SHIFT 0x0045 // 17.19 degrees in fixed point format 6 (1+5) | 2
#define DEFAULT_STAIRS_Y_SPREAD 0x0014 // 20 mm
#define DEFAULT_STAIRS_X_SHIFT_BODY 0x0023 // 35 mm
#ifdef __cplusplus
}
#endif
#endif /* __EEPROM_INIT_H */
/** @file */
#ifndef _MOTION_MANAGER_H
#define _MOTION_MANAGER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "stm32f1xx.h"
#include "dyn_common.h"
typedef enum {
R_SHOULDER_PITCH = 1,
L_SHOULDER_PITCH = 2,
R_SHOULDER_ROLL = 3,
L_SHOULDER_ROLL = 4,
R_ELBOW = 5,
L_ELBOW = 6,
R_HIP_YAW = 7,
L_HIP_YAW = 8,
R_HIP_ROLL = 9,
L_HIP_ROLL = 10,
R_HIP_PITCH = 11,
L_HIP_PITCH = 12,
R_KNEE = 13,
L_KNEE = 14,
R_ANKLE_PITCH = 15,
L_ANKLE_PITCH = 16,
R_ANKLE_ROLL = 17,
L_ANKLE_ROLL = 18,
L_PAN = 19,
L_TILT = 20,
L_GRIPPER_TOP = 21,
L_GRIPPER_BOT = 22,
R_GRIPPER_TOP = 23,
R_GRIPPER_BOT = 24} servo_id_t;
typedef enum {MM_NONE = 0,
MM_ACTION = 1,
MM_WALKING = 2,
MM_JOINTS = 3,
MM_HEAD = 4} TModules;
typedef enum {MM_FWD_FALL = 0,
MM_BWD_FALL = 1,
MM_STANDING = 2} TFall;
typedef struct
{
void (*process_fnct)(void);
void (*init_fnct)(void);
uint8_t name[16];
}TMotionModule;
#define MAX_MOTION_MODULES 8
// servo information structure
typedef struct{
uint8_t id;
uint16_t model;
uint16_t encoder_resolution;
uint8_t gear_ratio;
uint16_t max_angle;
uint16_t center_angle;
uint16_t max_speed;
int16_t current_angle;
uint8_t cw_comp;
uint8_t ccw_comp;
uint16_t current_value;
TModules module;
uint8_t enabled;
int16_t cw_angle_limit;
int16_t ccw_angle_limit;
TDynVersion dyn_version;
}TServoInfo;
#define MANAGER_MAX_NUM_SERVOS 31
// public variables
extern int64_t manager_current_angles[MANAGER_MAX_NUM_SERVOS];
extern int8_t manager_current_slopes[MANAGER_MAX_NUM_SERVOS];
// public functions
/** \brief Initialize motion manager module
*/
void manager_init(uint16_t period_us);
uint16_t manager_get_period(void);
uint16_t manager_get_period_us(void);
void manager_set_period(uint16_t period_us);
void manager_enable(void);
void manager_disable(void);
uint8_t manager_is_enabled(void);
void manager_enable_balance(void);
void manager_disable_balance(void);
uint8_t manager_has_fallen(void);
TFall manager_get_fallen_position(void);
uint8_t manager_get_num_servos(void);
void manager_set_module(uint8_t servo_id,TModules module);
TModules manager_get_module(uint8_t servo_id);
void manager_enable_servo(uint8_t servo_id);
void manager_disable_servo(uint8_t servo_id);
uint8_t manager_is_servo_enabled(uint8_t servo_id);
void manager_set_offset(uint8_t servo_id,int8_t offset);
int16_t manager_get_cw_angle_limit(uint8_t servo_id);
int16_t manager_get_ccw_angle_limit(uint8_t servo_id);
// motion modules handling
// operation functions
uint8_t manager_in_range(unsigned short int address, unsigned short int length);
void manager_process_write_cmd(unsigned short int address,unsigned short int length,unsigned char *data);
#ifdef __cplusplus
}
#endif
#endif
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment