修改可以正常追踪,以及识别
This commit is contained in:
@@ -884,7 +884,7 @@ static void podControlStateMachineProcess()
|
||||
else //手动的话,直接已经遥控轴来控制下面的电机
|
||||
{
|
||||
mt11_data.pan_motor_speed = mt11_data.pan_speed_parem*mt11_data.pan_speed;
|
||||
mt11_data.pitch_motor_speed = mt11_data.pitch_speed_parem*mt11_data.tilt_action_speed;
|
||||
mt11_data.pitch_motor_speed = fabs(mt11_data.pitch_speed_parem*mt11_data.tilt_action_speed);
|
||||
|
||||
if(mt11_data.tilt_action_speed > 0) //根据Y轴数据来定义
|
||||
{
|
||||
@@ -1002,7 +1002,7 @@ static void podControlStateMachineProcess()
|
||||
ai_select_track_target_output.frame.touch_ry = 400;
|
||||
|
||||
ai_select_track_target_output.frame.track_action = 1;
|
||||
packUniversalCommandFrame(CMD_ID_SELECT_AI_TRACK_TARGET, (uint8_t*)&ai_select_track_target_output, 1, 0, 0);
|
||||
packUniversalCommandFrame(CMD_ID_SELECT_AI_TRACK_TARGET, (uint8_t*)&ai_select_track_target_output, 9, 0, 1);
|
||||
publishMessage(&ai_select_track_target_output, 1);
|
||||
|
||||
|
||||
@@ -1077,27 +1077,30 @@ static void podControlStateMachineProcess()
|
||||
mt11_data.current_state = POD_STATE_MANUAL_PREPARE;
|
||||
printf("AUTO: Switch to Manual -> Transitioning to Manual Prepare\n");
|
||||
}
|
||||
else//手动PID运行
|
||||
else//自动PID运行
|
||||
{
|
||||
mt11_data.desired_pitch = 30.0;//默认俯仰为30°
|
||||
mt11_data.desired_yaw = 0.0;
|
||||
mt11_data.pitch = magnetic_angle_data.angle.pitch_angle/10.0;//当前俯仰角度赋值 系数为10
|
||||
mt11_data.yaw = magnetic_angle_data.angle.yaw_angle/10.0; //当前方位角度赋值
|
||||
|
||||
mt11_data.pitch_motor_speed = calculatePidOutput(&pitch_pid, mt11_data.desired_pitch, mt11_data.pitch, 0.0f, dt);
|
||||
mt11_data.pan_motor_speed = calculatePidOutput(&yaw_pid, mt11_data.desired_yaw, mt11_data.yaw, 0.0f, dt);
|
||||
float pitch_pid_output = calculatePidOutput(&pitch_pid, mt11_data.desired_pitch, mt11_data.pitch, 0.0f, dt);
|
||||
mt11_data.pan_motor_speed = -calculatePidOutput(&yaw_pid, mt11_data.desired_yaw, mt11_data.yaw, 0.0f, dt);
|
||||
|
||||
mt11_data.pitch_motor_speed = fabs(pitch_pid_output);//位置模式的速度都是正数
|
||||
|
||||
if(mt11_data.pitch_motor_speed > 0) //根据Y轴数据来定义
|
||||
if(pitch_pid_output > 0) //根据Y轴数据来定义
|
||||
{
|
||||
mt11_data.desired_pitch_position = mt11_data.max_pitch_postion;
|
||||
}
|
||||
else
|
||||
{
|
||||
mt11_data.desired_pitch_position = mt11_data.min_pitch_postion;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
printf("Pitch PID Output: %.4f\n", pitch_pid_output);
|
||||
printf("Yaw PID Output: %.4f\n", mt11_data.pan_motor_speed);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1285,13 +1288,13 @@ void mt11Init(void *signal_id)
|
||||
// 从数据段拷贝AI追踪目标坐标数据到全局结构体
|
||||
memcpy(&ai_track_target_data, &mt11_received_data.data[8], sizeof(ai_track_data_t));
|
||||
|
||||
printf("AI Track Target - X: %d, Y: %d, Width: %d, Height: %d, Target_ID: %d, Track_Sta: %d\n",
|
||||
ai_track_target_data.info.pos_x,
|
||||
ai_track_target_data.info.pos_y,
|
||||
ai_track_target_data.info.pos_width,
|
||||
ai_track_target_data.info.pos_height,
|
||||
ai_track_target_data.info.Target_ID,
|
||||
ai_track_target_data.info.Track_Sta);
|
||||
// printf("AI Track Target - X: %d, Y: %d, Width: %d, Height: %d, Target_ID: %d, Track_Sta: %d\n",
|
||||
// ai_track_target_data.info.pos_x,
|
||||
// ai_track_target_data.info.pos_y,
|
||||
// ai_track_target_data.info.pos_width,
|
||||
// ai_track_target_data.info.pos_height,
|
||||
// ai_track_target_data.info.Target_ID,
|
||||
// ai_track_target_data.info.Track_Sta);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user