mirror of
https://gitee.com/dlmu-cone/half-steering-basic-framework
synced 2026-10-23 17:42:20 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -232,7 +232,7 @@ static void MinmizeRotation(float *angle, const float *last_angle, float *speed)
|
|||||||
while (norm_rotation < -180.0f) {
|
while (norm_rotation < -180.0f) {
|
||||||
norm_rotation += 360.0f;
|
norm_rotation += 360.0f;
|
||||||
}
|
}
|
||||||
float threshold = 90.0f;
|
float threshold = 110.0f;
|
||||||
float target_single=fmodf(target_angle,360.0f);
|
float target_single=fmodf(target_angle,360.0f);
|
||||||
if(target_single<0.0f) target_single+=360.0f;
|
if(target_single<0.0f) target_single+=360.0f;
|
||||||
|
|
||||||
@@ -241,15 +241,15 @@ static void MinmizeRotation(float *angle, const float *last_angle, float *speed)
|
|||||||
|
|
||||||
|
|
||||||
if (fabsf(norm_rotation) > threshold) {
|
if (fabsf(norm_rotation) > threshold) {
|
||||||
int32_t round_diff = (int32_t)(target_angle / 360.0f) - (int32_t)(actual_angle / 360.0f);
|
int32_t round_diff = (int32_t)((target_angle-actual_angle) / 360.0f);
|
||||||
*angle = actual_angle + norm_rotation-180.0f+round_diff*360.0f;
|
*angle = actual_angle + norm_rotation-180.0f+round_diff*360.0f;
|
||||||
*speed = -(*speed);
|
*speed = -(*speed);
|
||||||
}else if(norm_rotation<-threshold){
|
}else if(norm_rotation<-threshold){
|
||||||
int32_t round_diff = (int32_t)(target_angle / 360.0f) - (int32_t)(actual_angle / 360.0f);
|
int32_t round_diff = (int32_t)((target_angle-actual_angle) / 360.0f);
|
||||||
*angle = actual_angle + norm_rotation+180.0f+round_diff*360.0f;
|
*angle = actual_angle + norm_rotation+180.0f+round_diff*360.0f;
|
||||||
*speed = -(*speed);
|
*speed = -(*speed);
|
||||||
}
|
}
|
||||||
ANGLE_LIMIT_360_TO_180_ABS(*angle);
|
// ANGLE_LIMIT_360_TO_180_ABS(*angle);
|
||||||
// float rotation = *angle - *last_angle;
|
// float rotation = *angle - *last_angle;
|
||||||
// ANGLE_LIMIT_360_TO_180_ABS(rotation);
|
// ANGLE_LIMIT_360_TO_180_ABS(rotation);
|
||||||
// if (rotation > 90) {
|
// if (rotation > 90) {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
/* 机器人重要参数定义,注意根据不同机器人进行修改,浮点数需要以.0或f结尾,无符号以u结尾 */
|
/* 机器人重要参数定义,注意根据不同机器人进行修改,浮点数需要以.0或f结尾,无符号以u结尾 */
|
||||||
// 云台参数
|
// 云台参数
|
||||||
#define YAW_CHASSIS_ALIGN_ECD 8015 // 云台和底盘对齐指向相同方向时的电机编码器值,若对云台有机械改动需要修改
|
#define YAW_CHASSIS_ALIGN_ECD 8192 // 云台和底盘对齐指向相同方向时的电机编码器值,若对云台有机械改动需要修改
|
||||||
#define YAW_ECD_GREATER_THAN_4096 0 // ALIGN_ECD值是否大于4096,是为1,否为0;用于计算云台偏转角度
|
#define YAW_ECD_GREATER_THAN_4096 0 // ALIGN_ECD值是否大于4096,是为1,否为0;用于计算云台偏转角度
|
||||||
#define PITCH_HORIZON_ECD 3412 // 云台处于水平位置时编码器值,若对云台有机械改动需要修改
|
#define PITCH_HORIZON_ECD 3412 // 云台处于水平位置时编码器值,若对云台有机械改动需要修改
|
||||||
#define PITCH_MAX_ANGLE 0 // 云台竖直方向最大角度 (注意反馈如果是陀螺仪,则填写陀螺仪的角度)
|
#define PITCH_MAX_ANGLE 0 // 云台竖直方向最大角度 (注意反馈如果是陀螺仪,则填写陀螺仪的角度)
|
||||||
|
|||||||
Reference in New Issue
Block a user