2025-10-24 14:37:17 +08:00
|
|
|
|
//
|
|
|
|
|
|
// Created by linbo on 2025/10/24.
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#include "jointpositioncontroller.h"
|
2025-10-29 16:26:15 +08:00
|
|
|
|
#include "hardware/can/can_manager.h"
|
|
|
|
|
|
#include "hardware_manager/hardware_manager.h"
|
2025-10-24 14:37:17 +08:00
|
|
|
|
using namespace std;
|
|
|
|
|
|
using namespace cmvr::device;
|
2025-10-29 16:26:15 +08:00
|
|
|
|
using namespace cmvr::hardware;
|
|
|
|
|
|
|
2025-10-24 14:37:17 +08:00
|
|
|
|
JointPositionController::JointPositionController(const XmlNode& cfg):AbstractController(cfg)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-24 17:06:17 +08:00
|
|
|
|
void JointPositionController::call(const Json::Value& json)
|
2025-10-24 14:37:17 +08:00
|
|
|
|
{
|
2025-10-24 14:44:45 +08:00
|
|
|
|
if (state_ != ControllerState_Idle)
|
|
|
|
|
|
return;
|
2025-10-29 16:26:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//解析jason,执行算法
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//调用canmanager执行电机指令
|
|
|
|
|
|
HardWareManager::getInstance();
|
2025-10-24 14:37:17 +08:00
|
|
|
|
}
|
2025-10-29 16:26:15 +08:00
|
|
|
|
|
|
|
|
|
|
void JointPositionController::interrupt()
|
2025-10-24 14:37:17 +08:00
|
|
|
|
{
|
2025-10-29 16:26:15 +08:00
|
|
|
|
state_ = ControllerState_Switching;
|
2025-10-24 14:37:17 +08:00
|
|
|
|
|
2025-10-29 16:26:15 +08:00
|
|
|
|
|
|
|
|
|
|
state_ = ControllerState_Idle;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void JointPositionController::stop()
|
|
|
|
|
|
{
|
|
|
|
|
|
state_ = ControllerState_Idle;
|
2025-10-24 14:37:17 +08:00
|
|
|
|
}
|