Merge branch 'master' of gitee.com:hnuyuelurm/basic_framework
This commit is contained in:
commit
b85eff52ba
2
Makefile
2
Makefile
|
@ -141,6 +141,7 @@ modules/can_comm/can_comm.c \
|
||||||
modules/message_center/message_center.c \
|
modules/message_center/message_center.c \
|
||||||
modules/daemon/daemon.c \
|
modules/daemon/daemon.c \
|
||||||
modules/vofa/vofa.c \
|
modules/vofa/vofa.c \
|
||||||
|
modules/ps_handle/ps_handle.c \
|
||||||
application/gimbal/gimbal.c \
|
application/gimbal/gimbal.c \
|
||||||
application/chassis/chassis.c \
|
application/chassis/chassis.c \
|
||||||
application/shoot/shoot.c \
|
application/shoot/shoot.c \
|
||||||
|
@ -262,6 +263,7 @@ C_INCLUDES = \
|
||||||
-Imodules/message_center \
|
-Imodules/message_center \
|
||||||
-Imodules/daemon \
|
-Imodules/daemon \
|
||||||
-Imodules/vofa \
|
-Imodules/vofa \
|
||||||
|
-Imodules/ps_handle \
|
||||||
-Imodules
|
-Imodules
|
||||||
|
|
||||||
# compile gcc flags
|
# compile gcc flags
|
||||||
|
|
|
@ -69,6 +69,7 @@ void RobotCMDInit()
|
||||||
cmd_can_comm = CANCommInit(&comm_conf);
|
cmd_can_comm = CANCommInit(&comm_conf);
|
||||||
#endif // GIMBAL_BOARD
|
#endif // GIMBAL_BOARD
|
||||||
gimbal_cmd_send.pitch = 0;
|
gimbal_cmd_send.pitch = 0;
|
||||||
|
gimbal_cmd_send.pitch = 0;
|
||||||
|
|
||||||
robot_state = ROBOT_READY; // 启动时机器人进入工作模式,后续加入所有应用初始化完成之后再进入
|
robot_state = ROBOT_READY; // 启动时机器人进入工作模式,后续加入所有应用初始化完成之后再进入
|
||||||
}
|
}
|
||||||
|
@ -100,6 +101,17 @@ static void CalcOffsetAngle()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void OffsetAnglePidCalc()
|
||||||
|
{
|
||||||
|
// float pid_measure,pid_ref;
|
||||||
|
// static PIDInstance AngleCal = {
|
||||||
|
// .Kp = -1,
|
||||||
|
// .Ki = 0,
|
||||||
|
// .Kd = 0,
|
||||||
|
// .MaxOut = 10000,
|
||||||
|
// };
|
||||||
|
// chassis_cmd_send.offset_angle = PIDCalculate(&AngleCal,chassis_cmd_send.offset_angle,0);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @brief 控制输入为遥控器(调试时)的模式和控制量设置
|
* @brief 控制输入为遥控器(调试时)的模式和控制量设置
|
||||||
*
|
*
|
||||||
|
@ -134,6 +146,7 @@ static void RemoteControlSet()
|
||||||
// 底盘参数,目前没有加入小陀螺(调试似乎暂时没有必要),系数需要调整
|
// 底盘参数,目前没有加入小陀螺(调试似乎暂时没有必要),系数需要调整
|
||||||
chassis_cmd_send.vx = 10.0f * (float)rc_data[TEMP].rc.rocker_r_; // _水平方向
|
chassis_cmd_send.vx = 10.0f * (float)rc_data[TEMP].rc.rocker_r_; // _水平方向
|
||||||
chassis_cmd_send.vy = 10.0f * (float)rc_data[TEMP].rc.rocker_r1; // 1数值方向
|
chassis_cmd_send.vy = 10.0f * (float)rc_data[TEMP].rc.rocker_r1; // 1数值方向
|
||||||
|
//chassis_cmd_send.wz = 300;
|
||||||
|
|
||||||
// 发射参数
|
// 发射参数
|
||||||
if (switch_is_up(rc_data[TEMP].rc.switch_right)) // 右侧开关状态[上],弹舱打开
|
if (switch_is_up(rc_data[TEMP].rc.switch_right)) // 右侧开关状态[上],弹舱打开
|
||||||
|
@ -181,6 +194,8 @@ static void EmergencyHandler()
|
||||||
gimbal_cmd_send.gimbal_mode = GIMBAL_ZERO_FORCE; // 云台模式改为零力矩
|
gimbal_cmd_send.gimbal_mode = GIMBAL_ZERO_FORCE; // 云台模式改为零力矩
|
||||||
chassis_cmd_send.chassis_mode = CHASSIS_ZERO_FORCE; // 底盘模式改为零力矩
|
chassis_cmd_send.chassis_mode = CHASSIS_ZERO_FORCE; // 底盘模式改为零力矩
|
||||||
shoot_cmd_send.shoot_mode = SHOOT_OFF; // 射击模式改为关闭
|
shoot_cmd_send.shoot_mode = SHOOT_OFF; // 射击模式改为关闭
|
||||||
|
shoot_cmd_send.friction_mode = FRICTION_OFF;
|
||||||
|
shoot_cmd_send.load_mode = LOAD_STOP;
|
||||||
}
|
}
|
||||||
// 遥控器右侧开关为[上],恢复正常运行
|
// 遥控器右侧开关为[上],恢复正常运行
|
||||||
if (switch_is_up(rc_data[TEMP].rc.switch_right))
|
if (switch_is_up(rc_data[TEMP].rc.switch_right))
|
||||||
|
@ -218,7 +233,7 @@ void RobotCMDTask()
|
||||||
vision_send_data.enemy_color = 0;
|
vision_send_data.enemy_color = 0;
|
||||||
vision_send_data.pitch = gimbal_fetch_data.gimbal_imu_data.Pitch;
|
vision_send_data.pitch = gimbal_fetch_data.gimbal_imu_data.Pitch;
|
||||||
vision_send_data.yaw = gimbal_fetch_data.gimbal_imu_data.Yaw;
|
vision_send_data.yaw = gimbal_fetch_data.gimbal_imu_data.Yaw;
|
||||||
vision_send_data.roll = gimbal_fetch_data.gimbal_imu_data.Roll;
|
vision_send_data.roll = gimbal_fetch_data.gimbal_imu_data.Roll;;
|
||||||
|
|
||||||
// 推送消息,双板通信,视觉通信等
|
// 推送消息,双板通信,视觉通信等
|
||||||
// 其他应用所需的控制数据在remotecontrolsetmode和mousekeysetmode中完成设置
|
// 其他应用所需的控制数据在remotecontrolsetmode和mousekeysetmode中完成设置
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "ins_task.h"
|
#include "ins_task.h"
|
||||||
#include "message_center.h"
|
#include "message_center.h"
|
||||||
#include "general_def.h"
|
#include "general_def.h"
|
||||||
|
|
||||||
#include "bmi088.h"
|
#include "bmi088.h"
|
||||||
|
|
||||||
static attitude_t *gimba_IMU_data; // 云台IMU数据
|
static attitude_t *gimba_IMU_data; // 云台IMU数据
|
||||||
|
|
|
@ -113,7 +113,6 @@ typedef struct // config parameter
|
||||||
float CoefB; // ITerm = Err*((A-abs(err)+B)/A) when B<|err|<A+B
|
float CoefB; // ITerm = Err*((A-abs(err)+B)/A) when B<|err|<A+B
|
||||||
float Output_LPF_RC; // RC = 1/omegac
|
float Output_LPF_RC; // RC = 1/omegac
|
||||||
float Derivative_LPF_RC;
|
float Derivative_LPF_RC;
|
||||||
|
|
||||||
} PID_Init_Config_s;
|
} PID_Init_Config_s;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
#include "crc16.h"
|
#include "crc16.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
|
/*获取CRC8校验码*/
|
||||||
|
uint8_t Get_CRC8_Check(uint8_t *pchMessage,uint16_t dwLength)
|
||||||
|
{
|
||||||
|
return crc_8(pchMessage,dwLength);
|
||||||
|
}
|
||||||
/*检验CRC8数据段*/
|
/*检验CRC8数据段*/
|
||||||
static uint8_t CRC8_Check_Sum(uint8_t *pchMessage, uint16_t dwLength)
|
static uint8_t CRC8_Check_Sum(uint8_t *pchMessage, uint16_t dwLength)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +30,12 @@ static uint8_t CRC8_Check_Sum(uint8_t *pchMessage, uint16_t dwLength)
|
||||||
return (ucExpected == pchMessage[dwLength - 1]);
|
return (ucExpected == pchMessage[dwLength - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*获取CRC16校验码*/
|
||||||
|
uint16_t Get_CRC16_Check(uint8_t *pchMessage,uint32_t dwLength)
|
||||||
|
{
|
||||||
|
return crc_16(pchMessage,dwLength);
|
||||||
|
}
|
||||||
|
|
||||||
/*检验CRC16数据段*/
|
/*检验CRC16数据段*/
|
||||||
static uint16_t CRC16_Check_Sum(uint8_t *pchMessage, uint32_t dwLength)
|
static uint16_t CRC16_Check_Sum(uint8_t *pchMessage, uint32_t dwLength)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue