Files
Simba-OmniInfantry/云台/Application/Task/Src/shoot_task.c
T

55 lines
1.4 KiB
C

/*
*文件名称:shoot_task.c
*功能描述:发射机构控制任务(2ms),计算摩擦轮与拨弹电流并发送0x200控制帧
*备注:发射机构上电状态来自底盘0x019(ctoc_shooter_power)
*/
#include "app_tasks.h"
#include "cmsis_os.h"
#include "FreeRTOS.h"
#include "task.h"
#include "robot_typedef.h"
#include "gimbal.h"
#include "shoot.h"
#include "c_comm.h"
#include "dr16.h"
#include "robot_param.h"//GIMBAL_BENCH_RAMMER_TUNE等开关定义
/*
*函数简介:发射机构控制任务(2ms)
*参数说明:argument:FreeRTOS任务参数(未使用)
*返回类型:无
*备注:支持台架单机拨弹调试模式与整车门控模式
*/
void shoot_task(void const * argument)
{
(void)argument;
TickType_t last_wake = xTaskGetTickCount();//绝对延时基准
while (!app_ready)
osDelay(2);
for (;;)
{
#if GIMBAL_BENCH_RAMMER_TUNE
/* 台架调试工况:仅M2006+DT7单机拨弹,旁路整车门控 */
shoot_bench_step();
shoot_bench_send();
#else
if (cmd_robot.online && !gimbal_motor_offline() && !ctoc_chassis_fault())
{
shoot_control(cmd_robot.friction_on, cmd_robot.fire, cmd_robot.eject,
ctoc_shooter_power);
shoot_send_cmd();
}
else
{
shoot_output_zero();
}
#endif
monitor_heartbeat(HB_SHOOT);
vTaskDelayUntil(&last_wake, pdMS_TO_TICKS(2));
}
}