cmvr-es/example/torqueOff.cpp
2025-08-21 13:56:39 +08:00

34 lines
789 B
C++

//
// Created by lgv on 2025/8/13.
//
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib> // for std::atof
#include <glog/logging.h>
#include "device_manager/device_manager.h"
#include <libgen.h>
using namespace cmvr::device;
int main(int argc, char* argv[]) {
// 这里按你的原代码结构获取 robot
std::string config_path = "/home/lgv/cmvr/cmvr-es/config/cabin_robot.xml";
const XmlNode config(config_path);
if (!config.hasChild("DeviceManager")) {
LOG(ERROR) << "Device Manager node not found";
return 1;
}
auto dmgr_cfg = config.getChild("DeviceManager");
auto &dmgr = DeviceManager::getInstance(dmgr_cfg);
auto robot = dmgr.getDevice<AbstractRobot>("hc01");
robot->torqueOff();
return 0;
}