diff --git a/application/cmd/robot_cmd.c b/application/cmd/robot_cmd.c index ab958f1..cd6070c 100644 --- a/application/cmd/robot_cmd.c +++ b/application/cmd/robot_cmd.c @@ -16,7 +16,7 @@ #include "bsp_log.h" // 私有宏,自动将编码器转换成角度值 -#define YAW_ALIGN_ANGLE 175.0f //(YAW_CHASSIS_ALIGN_ECD * ECD_ANGLE_COEF_DJI) // 对齐时的角度,0-360 +#define YAW_ALIGN_ANGLE 132.0f //(YAW_CHASSIS_ALIGN_ECD * ECD_ANGLE_COEF_DJI) // 对齐时的角度,0-360 #define PTICH_HORIZON_ANGLE (PITCH_HORIZON_ECD * ECD_ANGLE_COEF_DJI) // pitch水平时电机的角度,0-360 #define PITCH_SCAN -10.0f //扫描阶段PITCH固定角度 @@ -266,10 +266,10 @@ static void RemoteControlSet() { static uint8_t sentry_state; static void AutoControlSet() { - chassis_cmd_send.chassis_mode = CHASSIS_ROTATE; + chassis_cmd_send.chassis_mode = CHASSIS_FOLLOW_GIMBAL_YAW; -// chassis_cmd_send.vx = vision_recv_data->nav_vx; -// chassis_cmd_send.vy = vision_recv_data->nav_vy; + chassis_cmd_send.vx = vision_recv_data->nav_vx; + chassis_cmd_send.vy = vision_recv_data->nav_vy; //云台保持陀螺仪控制 gimbal_cmd_send.gimbal_mode = GIMBAL_GYRO_MODE; @@ -286,10 +286,10 @@ static void AutoControlSet() { //if(sentry_state > 1) { - if (yaw_dir == 1) gimbal_cmd_send.yaw += 0.06f; - else gimbal_cmd_send.yaw -= 0.06f; - if (gimbal_fetch_data.mini_yaw_encode_angle <= YAW_MIN_ENCODE_ANGLE + 2.0f) yaw_dir = 1; - if (gimbal_fetch_data.mini_yaw_encode_angle >= YAW_MAX_ENCODE_ANGLE - 2.0f) yaw_dir = -1; +// if (yaw_dir == 1) gimbal_cmd_send.yaw += 0.06f; +// else gimbal_cmd_send.yaw -= 0.06f; +// if (gimbal_fetch_data.mini_yaw_encode_angle <= YAW_MIN_ENCODE_ANGLE + 2.0f) yaw_dir = 1; +// if (gimbal_fetch_data.mini_yaw_encode_angle >= YAW_MAX_ENCODE_ANGLE - 2.0f) yaw_dir = -1; } shoot_cmd_send.load_mode = LOAD_STOP; @@ -303,7 +303,7 @@ static void AutoControlSet() { no_find_cnt++; if (no_find_cnt >= 200) { - //gimbal_scan_flag = 1; + gimbal_scan_flag = 1; //auto_aim_flag = 0; } //else @@ -463,7 +463,7 @@ void RobotCMDTask() { CANCommSend(cmd_can_comm, (void *) &gimbal_cmd_send); //哨兵左右云台双板通信 PubPushMessage(shoot_cmd_pub, (void *) &shoot_cmd_send); PubPushMessage(gimbal_cmd_pub, (void *) &gimbal_cmd_send); - VisionSend(&vision_send_data); +// VisionSend(&vision_send_data); } uint8_t sentry_behave() { diff --git a/application/gimbal/gimbal.c b/application/gimbal/gimbal.c index ead1b40..af18fa0 100644 --- a/application/gimbal/gimbal.c +++ b/application/gimbal/gimbal.c @@ -242,7 +242,7 @@ void GimbalTask() //big_yaw_speed = yaw_speed - yaw_motor->measure.speed_aps * DEGREE_2_RAD; - big_yaw_angle = gimba_IMU_data->YawTotalAngle - (yaw_motor->measure.total_angle - 44); + big_yaw_angle = gimba_IMU_data->YawTotalAngle - (yaw_motor->measure.total_angle - (-80)); //big_yaw_speed = yaw_speed - yaw_motor->measure.speed_aps * DEGREE_2_RAD; big_yaw_speed = (yaw_speed - yaw_motor->measure.speed_aps * DEGREE_2_RAD); diff --git a/application/robot_def.h b/application/robot_def.h index 4fe590b..f039ab2 100644 --- a/application/robot_def.h +++ b/application/robot_def.h @@ -32,8 +32,8 @@ #define PITCH_MAX_ANGLE 39 // 云台竖直方向最大角度 (注意反馈如果是陀螺仪,则填写陀螺仪的角度) #define PITCH_MIN_ANGLE -18 // 云台竖直方向最小角度 (注意反馈如果是陀螺仪,则填写陀螺仪的角度) -#define YAW_MAX_ENCODE_ANGLE 139.0f //小yaw编码器限位 -#define YAW_MIN_ENCODE_ANGLE 10.0f +#define YAW_MAX_ENCODE_ANGLE -10.0f //小yaw编码器限位 +#define YAW_MIN_ENCODE_ANGLE -90.0f // 发射参数 #define ONE_BULLET_DELTA_ANGLE 36 // 发射一发弹丸拨盘转动的距离,由机械设计图纸给出 #define REDUCTION_RATIO_LOADER 49.0f // 拨盘电机的减速比,英雄需要修改为3508的19.0f diff --git a/modules/imu/ins_task.c b/modules/imu/ins_task.c index a4d505c..9805580 100644 --- a/modules/imu/ins_task.c +++ b/modules/imu/ins_task.c @@ -165,7 +165,7 @@ void INS_Task(void) INS.Yaw = QEKF_INS.Yaw; INS.Pitch = QEKF_INS.Pitch; - INS.Roll = QEKF_INS.Roll; + INS.Roll = - QEKF_INS.Roll; INS.YawTotalAngle = QEKF_INS.YawTotalAngle; //VisionSetAltitude(INS.Yaw, INS.Pitch, INS.Roll); diff --git a/modules/master_machine/master_process.c b/modules/master_machine/master_process.c index 36c2efc..aadf3f0 100644 --- a/modules/master_machine/master_process.c +++ b/modules/master_machine/master_process.c @@ -180,7 +180,7 @@ void VisionSend() // // 将数据转化为seasky协议的数据包 // get_protocol_send_data(0x02, flag_register, &send_data.yaw, 3, send_buff, &tx_len); // USBTransmit(send_buff, tx_len); - static uint8_t send_buffer[24]={0}; + static uint8_t send_buffer[64]={0}; send_data.header = 0x5A; //VisionSetFlag(COLOR_BLUE); diff --git a/modules/master_machine/master_process.h b/modules/master_machine/master_process.h index fada1e7..620d57c 100644 --- a/modules/master_machine/master_process.h +++ b/modules/master_machine/master_process.h @@ -84,10 +84,10 @@ typedef struct { float aim_y; float aim_z; -// uint8_t game_progress; -// uint16_t outpost_hp; -// float target_x; -// float target_y; + uint8_t game_progress; + uint16_t outpost_hp; + float target_x; + float target_y; uint16_t checksum; } SendPacket_t; @@ -112,9 +112,9 @@ typedef struct { float dz; //导航数据 -// float nav_vx; -// float nav_vy; -// float nav_wz; + float nav_vx; + float nav_vy; + float nav_wz; uint16_t checksum; } RecievePacket_t;