build-test-deploy / ci (push) Failing after 32m37s
- 协议模块(protocol/MotorCan):12 条 CAN ID、指令帧 0x18EF2010 编码、 状态帧(转速/母线电压/温度)与支路一/二故障报警帧解码,故障位按协议 逐位映射中文描述(docs/推进电机通信协议20260321.docx) - 主程序(MOOS 应用):订阅 pCanBridge 透传 CAN_0x* 解码电机状态; 500ms 周期下发指令帧(CAN_TX_0x18EF2010,m_sSrcAux=CAN1), 可选 red_channel 冗余下发 0x18EF2011;复位位保持 reset_hold_sec - 网页(18081):按协议指令帧字段独立下发(使能命令 Byte0 bit0 / 复位命令 Byte0 bit1 / 期望转速 Byte2/3,无联动按钮); WebSocket 1Hz 推送转速/电压/温度/故障告警/链路统计 - 配置接入:missions/h100.moos 增加 pMotor 配置块(can_channel=CAN1) - 测试:pmotorTest 92 项(指令帧字节级对照协议示例、解码/故障表) - 部署:scripts/build-board.sh 增加 pMotor 产物拷贝 + pMotor.service; .gitignore 补 bin/pMotor、bin/pmotorTest - 联调验证:MOOSDB+pCanBridge+假CANET 全链路,下行帧 01 00 E8 03 与协议文档示例一致,复位位 3s 保持行为正确
55 lines
1.6 KiB
C++
55 lines
1.6 KiB
C++
/************************************************************/
|
|
/* NAME: pMotor */
|
|
/* FILE: main.cpp */
|
|
/************************************************************/
|
|
|
|
#include <string>
|
|
#include "MBUtils.h"
|
|
#include "ColorParse.h"
|
|
#include "Motor.h"
|
|
#include "Motor_Info.h"
|
|
#include "../pPowerManger/logc/loguru.hpp"
|
|
|
|
using namespace std;
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
loguru::init(argc, argv);
|
|
|
|
string mission_file;
|
|
string run_command = argv[0];
|
|
// 默认以程序文件名(去掉路径)作为进程名,保证与 .moos 中 ProcessConfig 匹配
|
|
{
|
|
size_t slash = run_command.find_last_of('/');
|
|
if (slash != string::npos) run_command = run_command.substr(slash + 1);
|
|
}
|
|
|
|
for (int i = 1; i < argc; i++) {
|
|
string argi = argv[i];
|
|
if ((argi == "-v") || (argi == "--version") || (argi == "-version"))
|
|
showReleaseInfoAndExit();
|
|
else if ((argi == "-e") || (argi == "--example") || (argi == "-example"))
|
|
showExampleConfigAndExit();
|
|
else if ((argi == "-h") || (argi == "--help") || (argi == "-help"))
|
|
showHelpAndExit();
|
|
else if ((argi == "-i") || (argi == "--interface"))
|
|
showInterfaceAndExit();
|
|
else if (strEnds(argi, ".moos") || strEnds(argi, ".moos++"))
|
|
mission_file = argv[i];
|
|
else if (strBegins(argi, "--alias="))
|
|
run_command = argi.substr(8);
|
|
else if (i == 2)
|
|
run_command = argi;
|
|
}
|
|
|
|
if (mission_file == "")
|
|
showHelpAndExit();
|
|
|
|
LOG_F(INFO, "pMotor launching as %s", run_command.c_str());
|
|
|
|
motor::Motor Motor;
|
|
Motor.Run(run_command.c_str(), mission_file.c_str());
|
|
|
|
return 0;
|
|
}
|