sentry_chassis_hzz/modules/motor/HT04.h

42 lines
807 B
C
Raw Normal View History

2022-10-20 17:13:02 +08:00
#ifndef HT04_H
#define HT04_H
2022-12-12 22:29:51 +08:00
#include <stdint.h>
2022-10-20 17:13:02 +08:00
#include "bsp_can.h"
2022-10-20 21:14:17 +08:00
#include "controller.h"
#include "motor_def.h"
2022-10-20 17:13:02 +08:00
#define HT_MOTOR_CNT 4
#define P_MIN -95.5f // Radians
2022-10-20 17:13:02 +08:00
#define P_MAX 95.5f
#define V_MIN -45.0f // Rad/s
2022-10-20 17:13:02 +08:00
#define V_MAX 45.0f
#define T_MIN -18.0f
#define T_MAX 18.0f
typedef struct // HT04
2022-10-20 17:13:02 +08:00
{
float last_ecd;
float ecd;
float speed_rpm;
float real_current;
2022-10-20 21:14:17 +08:00
PIDInstance pid;
CANInstance *motor_can_instace;
} HKMotor_Measure_t;
2022-10-20 17:13:02 +08:00
typedef enum
{
CMD_MOTOR_MODE = 0xfc,
CMD_RESET_MODE = 0xfd,
2022-10-20 17:13:02 +08:00
CMD_ZERO_POSITION = 0xfe
} joint_mode;
HKMotor_Measure_t *HTMotorInit(CAN_Init_Config_s config);
2022-10-20 17:13:02 +08:00
void JointControl(HKMotor_Measure_t *_instance, float current);
2022-10-20 17:13:02 +08:00
void SetJointMode(joint_mode cmd, HKMotor_Measure_t *_instance);
2022-10-20 17:13:02 +08:00
#endif // !HT04_H#define HT04_H