/****************************************************************************** 版权所有 (C), 2018-2099, Radkil ****************************************************************************** 文 件 名 : robot.c 版 本 号 : 初稿 作 者 : radkil 生成日期 : 2026年4月14日 最近修改 : 功能描述 : 爬壁机器人抽象层 修改历史 : 1.日 期 : 2026年4月14日 作 者 : radkil 修改内容 : 创建文件 ******************************************************************************/ #include "robot.h" #include "wheel_if.h" #include "swing_if.h" #include "paint_if.h" #include "controller_if.h" /*----------------------------------------------* * 外部变量说明 * *----------------------------------------------*/ /*----------------------------------------------* * 外部函数原型说明 * *----------------------------------------------*/ /*----------------------------------------------* * 内部函数原型说明 * *----------------------------------------------*/ /*----------------------------------------------* * 全局变量 * *----------------------------------------------*/ /*----------------------------------------------* * 模块级变量 * *----------------------------------------------*/ /*----------------------------------------------* * 常量定义 * *----------------------------------------------*/ /*----------------------------------------------* * 宏定义 * *----------------------------------------------*/ int RobotInit(void) { int iRet = 0; iRet |= WheelMotorInit(); iRet |= ControllerInit(); iRet |= SwingArmInit(); iRet |= PaintInit(); return iRet; } void RobotProc(void) { ERobotCmd eRobotCmd = ControllerInputStateMachine(); switch (eRobotCmd) { case RB_STOP: WheelMotorStop(); break; case RB_MANUAL_FORWARD: WheelMotorSetSpeed(10); WheelMotorDirForward(); break; case RB_MANUAL_BACKWARD: WheelMotorSetSpeed(10); WheelMotorDirBackward(); break; case RB_PAINT: PaintWork(); break; default: WheelMotorStop(); break; } }