54 lines
1.9 KiB
C
54 lines
1.9 KiB
C
/* =============================================================================
|
|
* shoot_task.c - 发射机构任务(2ms)
|
|
* shoot_control() 计算摩擦轮/拨弹电流 -> shoot_send_cmd() 发 0x200(CAN1 摩擦轮 / CAN2 拨弹);
|
|
* 发射机构上电状态来自底盘 0x019
|
|
* ========================================================================== */
|
|
#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 等开关定义在此 */
|
|
|
|
/* shoot_task(云台板,2ms):摩擦轮/拨弹控制
|
|
* 发射机构上电状态来自底盘 0x019(ctoc_shooter_power) */
|
|
|
|
void shoot_task(void const * argument)
|
|
{
|
|
TickType_t last_wake = xTaskGetTickCount();
|
|
|
|
while (!app_ready)
|
|
osDelay(2);
|
|
|
|
for (;;)
|
|
{
|
|
#if GIMBAL_BENCH_RAMMER_TUNE
|
|
/* ---- 台架调试工况:单机拨弹 ----------------------------------------
|
|
* 只有 M2006(拨弹)+DT7 时使用:旁路 cmd_robot.online / gimbal_motor_offline /
|
|
* ctoc_chassis_fault 全部门控,直接由 DT7 驱动拨弹盘。
|
|
* 控制方式同整车遥控器模式:S1 上=使能、拨轮下=发射、拨轮上=退弹、中位=停;
|
|
* 退弹由 shoot_bench_step() 内部做 转角/电流/超时 保护。 */
|
|
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));
|
|
}
|
|
}
|