修改炮台模式相关代码,机械改头,调整一下

This commit is contained in:
zcj 2024-05-16 01:53:47 +08:00
parent 6ca069c064
commit a3e0cb1a87
4 changed files with 25 additions and 9 deletions

View File

@ -285,10 +285,12 @@ void ChassisTask()
chassis_cmd_recv.wz = 4500;
if(chassis_cmd_recv.wz < -4500)
chassis_cmd_recv.wz = -4500;
break;
case CHASSIS_FIXED:
chassis_cmd_recv.vx=0;
chassis_cmd_recv.vy=0;
chassis_cmd_recv.wz = 0;
break;
default:
break;

View File

@ -310,9 +310,18 @@ static void MouseKeySet()
{
chassis_cmd_send.vx = rc_data[TEMP].key[KEY_PRESS].a * 60000 - rc_data[TEMP].key[KEY_PRESS].d * 60000; // 系数待测
chassis_cmd_send.vy = rc_data[TEMP].key[KEY_PRESS].w * 60000 - rc_data[TEMP].key[KEY_PRESS].s * 60000;
switch (rc_data[TEMP].key_count[KEY_PRESS][Key_Q] % 2)
{
case 0:
gimbal_cmd_send.yaw -= (float)rc_data[TEMP].mouse.x / 660; // 系数待测
gimbal_cmd_send.pitch += (float)rc_data[TEMP].mouse.y / 660;
break;
case 1 :
gimbal_cmd_send.yaw -= (float)rc_data[TEMP].mouse.x / 660 * 3; // 系数待测
gimbal_cmd_send.pitch += (float)rc_data[TEMP].mouse.y / 660 * 3;
break;
}
gimbal_cmd_send.yaw -= (float)rc_data[TEMP].mouse.x / 660 * 9; // 系数待测
gimbal_cmd_send.pitch += (float)rc_data[TEMP].mouse.y / 660 *5 ;
aim_select.suggest_fire = 0;
if (rc_data[TEMP].mouse.press_l && (!rc_data[TEMP].mouse.press_r)) // 左键发射模式
@ -407,14 +416,19 @@ static void MouseKeySet()
{
case 0:
chassis_cmd_send.chassis_mode = CHASSIS_FOLLOW_GIMBAL_YAW;
gimbal_cmd_send.gimbal_mode = GIMBAL_GYRO_MODE;
break;
default:
chassis_cmd_send.chassis_mode = CHASSIS_ROTATE;
gimbal_cmd_send.gimbal_mode = GIMBAL_GYRO_MODE;
break;
}
switch (rc_data[TEMP].key[KEY_PRESS].shift) // V键开启连发//
switch (rc_data[TEMP].key[KEY_PRESS].z) // Z键开关吊射模式
{
case 1:
chassis_cmd_send.chassis_mode = CHASSIS_VERTICAL_YAW;
//chassis_cmd_send.vx=chassis_cmd_send.vy=0; //吊射时底盘不动
break;
}
switch (rc_data[TEMP].key[KEY_PRESS].shift) //shift开关超电//
{
case 0:
chassis_cmd_send.P_SuperCap=0;

View File

@ -66,15 +66,15 @@ void GimbalInit()
},
.controller_param_init_config = {
.angle_PID = {
.Kp = 0.35f,//20, // 65
.Kp = 0.35f,
.Ki = 0,
.Kd = 0.005f,//1,
.Kd = 0.005f,
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
.IntegralLimit = 100,//100
.MaxOut = 500,//500
},
.speed_PID = {
.Kp = 6000,//11000, // 50
.Kp = 6000,
.Ki = 1000, // 350
.Kd = 0,//15000, // 0
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,

View File

@ -26,7 +26,7 @@
/* 机器人重要参数定义,注意根据不同机器人进行修改,浮点数需要以.0或f结尾,无符号以u结尾 */
// 云台参数
#define YAW_CHASSIS_ALIGN_ECD 3.641593 // 云台和底盘对齐指向相同方向时的电机position值,需要加上PI因为单圈角度计算里增加了PI若对云台有机械改动需要修改
#define YAW_CHASSIS_ALIGN_ECD 5.482276 // 云台和底盘对齐指向相同方向时的电机position值,需要加上PI因为单圈角度计算里增加了PI若对云台有机械改动需要修改
#define YAW_ECD_GREATER_THAN_4096 0 // ALIGN_ECD值是否大于4096,是为1,否为0;用于计算云台偏转角度
#define PITCH_HORIZON_ECD 3412 // 云台处于水平位置时编码器值,若对云台有机械改动需要修改
#define PITCH_MAX_ANGLE 13 // 云台竖直方向最大角度 (注意反馈如果是陀螺仪,则填写陀螺仪的角度)