通信bug修复测试完成
This commit is contained in:
parent
2575a2267e
commit
c97996f501
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue