DJI解析
This commit is contained in:
parent
83a9c93e16
commit
f50817a218
@ -37,7 +37,7 @@
|
||||
(ptr)->temperate = (data)[6]; \
|
||||
(ptr)->ecd - (ptr)->last_ecd > 4096 ? ((ptr)->round_cnt--) : ((ptr)->round_cnt=(ptr)->round_cnt); \
|
||||
(ptr)->ecd - (ptr)->last_ecd < -4096 ? ((ptr)->round_cnt++) : ((ptr)->round_cnt=(ptr)->round_cnt); \
|
||||
(ptr)->total_angle = (fp64)((ptr)->round_cnt * 8192 + (ptr)->ecd - (ptr)->offset_ecd ) * MOTOR_ECD_TO_ANGLE; \
|
||||
(ptr)->total_angle = (fp64)((ptr)->round_cnt * 8192 + (ptr)->ecd - (ptr)->offset_ecd ) * MOTOR_ECD_TO_ANGLE_3508; \
|
||||
}//ptr指向电机测量数据结构体的指针,data包含电机测量数据的数组.
|
||||
/*(ptr)->real_angle = (ptr)->real_angle % 360; */
|
||||
#define get_motor_offset(ptr, data) \
|
||||
@ -55,7 +55,18 @@
|
||||
(ptr)->ecd - (ptr)->last_ecd > 4096 ? ((ptr)->round_cnt--) : ((ptr)->round_cnt=(ptr)->round_cnt); \
|
||||
(ptr)->ecd - (ptr)->last_ecd < -4096 ? ((ptr)->round_cnt++) : ((ptr)->round_cnt=(ptr)->round_cnt); \
|
||||
(ptr)->total_angle = (fp64)((ptr)->round_cnt * 8192 + (ptr)->ecd - (ptr)->offset_ecd ) * MOTOR_ECD_TO_ANGLE_6020; \
|
||||
}
|
||||
}
|
||||
#define get_2006_motor_measure(ptr, data) \
|
||||
{ \
|
||||
(ptr)->last_ecd = (ptr)->ecd; \
|
||||
(ptr)->ecd = (uint16_t)((data)[0] << 8 | (data)[1]); \
|
||||
(ptr)->speed_rpm = (uint16_t)((data)[2] << 8 | (data)[3]); \
|
||||
(ptr)->given_current = (uint16_t)((data)[4] << 8 | (data)[5]); \
|
||||
(ptr)->temperate = (data)[6]; \
|
||||
(ptr)->ecd - (ptr)->last_ecd > 4096 ? ((ptr)->round_cnt--) : ((ptr)->round_cnt=(ptr)->round_cnt); \
|
||||
(ptr)->ecd - (ptr)->last_ecd < -4096 ? ((ptr)->round_cnt++) : ((ptr)->round_cnt=(ptr)->round_cnt); \
|
||||
(ptr)->total_angle = (fp64)((ptr)->round_cnt * 8192 + (ptr)->ecd - (ptr)->offset_ecd ) * MOTOR_ECD_TO_ANGLE_2006; \
|
||||
}
|
||||
// 解析出初始编码器值
|
||||
// #define get_5065motor_measure(ptr, data) \
|
||||
// { \
|
||||
@ -132,7 +143,7 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
|
||||
|
||||
}
|
||||
#else
|
||||
static osEventFlagsId_t eventReceive;
|
||||
static osEventFlagsId_t eventReceive;//事件标志
|
||||
/**
|
||||
* @brief 自定义大疆电机回调函数
|
||||
* @param[in] none
|
||||
|
@ -47,7 +47,8 @@ typedef struct
|
||||
|
||||
//motor calc ecd to angle
|
||||
|
||||
#define MOTOR_ECD_TO_ANGLE (360.0 / 8191.0 / (3591.0/187.0))
|
||||
#define MOTOR_ECD_TO_ANGLE_3508 (360.0 / 8191.0 / (3591.0/187.0))
|
||||
#define MOTOR_ECD_TO_ANGLE_2006 (360.0 / 8191.0 / 36)
|
||||
#define MOTOR_ECD_TO_RAD 0.000766990394f
|
||||
#define MOTOR_ECD_TO_ANGLE_6020 (360.0 / 8191.0 )
|
||||
|
||||
|
@ -48,7 +48,7 @@ void Task_Motor(void *argument)
|
||||
//当最高点时进入离合
|
||||
if(encoder.round_cnt>=8)
|
||||
{
|
||||
trigger_angle_o=-1;
|
||||
trigger_angle_o=2;
|
||||
trigger_pos(m);
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@ extern int mode;
|
||||
|
||||
//odrive发射
|
||||
#define SHOOT3 12
|
||||
#define TOP 8
|
||||
#define MIDDLE 4
|
||||
#define TOP 6
|
||||
#define MIDDLE 3
|
||||
#define BOTTOM 0
|
||||
|
||||
void Task_Shoot(void *argument)
|
||||
|
Loading…
Reference in New Issue
Block a user