/****************************************************************/ /* NAME: Motor_Info */ /* FILE: Motor_Info.cpp */ /****************************************************************/ #include #include #include "Motor_Info.h" #include "ColorParse.h" #include "ReleaseInfo.h" using namespace std; void showSynopsis() { blk("SYNOPSIS: "); blk("------------------------------------ "); blk(" The pMotor application is the propulsion motor operation "); blk(" program. It talks to the motor controller over CAN (via "); blk(" pCanBridge pass-through, default channel CAN1): "); blk(" subscribes motor state/fault frames (CAN_0x*), sends the "); blk(" 500ms periodic command frame 0x18EF2010 (enable/reset/speed) "); blk(" via MOOS CAN_TX_0x*, and provides a web page for control "); blk(" and monitoring. Protocol: "); blk(" docs/推进电机通信协议20260321.docx. "); blk(" "); } void showHelpAndExit() { blk(" "); blu("=============================================================== "); blu("Usage: pMotor file.moos [OPTIONS] "); blu("=============================================================== "); blk(" "); showSynopsis(); blk(" "); blk("Options: "); mag(" --alias","= "); blk(" Launch pMotor with the given process name "); blk(" rather than pMotor. "); mag(" --example, -e "); blk(" Display example MOOS configuration block. "); mag(" --help, -h "); blk(" Display this help message. "); mag(" --interface, -i "); blk(" Display MOOS publications and subscriptions. "); mag(" --version,-v "); blk(" Display the release version of pMotor. "); blk(" "); blk("Note: If argv[2] does not otherwise match a known option, "); blk(" then it will be interpreted as a run alias. This is "); blk(" to support pAntler launching conventions. "); blk(" "); exit(0); } void showExampleConfigAndExit() { blk(" "); blu("=============================================================== "); blu("pMotor Example MOOS Configuration "); blu("=============================================================== "); blk(" "); blk("ProcessConfig = pMotor "); blk("{ "); blk(" AppTick = 4 "); blk(" CommsTick = 4 "); blk(" "); blk(" can_channel = CAN1 // 电机 CAN 通道(pCanBridge 配置名) "); blk(" red_channel = // 冗余 CAN 通道(空=不发冗余帧) "); blk(" cmd_period_ms = 500 // 指令帧周期(协议 500ms) "); blk(" reset_hold_sec= 5 // 复位位保持时长(秒) "); blk(" web_port = 18081 // 网页端口(避开8080/8090/18080) "); blk(" web_enable = true // 是否启用网页 "); blk(" logpath = pMotor.log // 日志路径 "); blk("} "); blk(" "); exit(0); } void showInterfaceAndExit() { blk(" "); blu("=============================================================== "); blu("pMotor INTERFACE "); blu("=============================================================== "); blk(" "); showSynopsis(); blk(" "); blk("SUBSCRIPTIONS: "); blk("------------------------------------ "); blk(" CAN_0x* = pCanBridge 透传的 CAN 帧(电机状态/故障) "); blk(" "); blk("PUBLICATIONS: "); blk("------------------------------------ "); blk(" CAN_TX_0x18EF2010 = 主控指令帧(二进制 8 字节数据域, "); blk(" m_sSrcAux=CAN1,经 pCanBridge 下行) "); blk(" CAN_TX_0x18EF2011 = 指令帧冗余(配置 red_channel 时发送) "); blk(" "); exit(0); } void showReleaseInfoAndExit() { showReleaseInfo("pMotor", "gpl"); exit(0); }