cmvr-es/include/hardware/can/can_group.h
2025-11-06 17:27:37 +08:00

35 lines
1.0 KiB
C++

//
// Created by linbo on 2025/10/22.
//
#pragma once
#include "motor_protocol/motorprotocolmanager.h"
namespace cmvr::hardware
{
class CanGroup
{
public:
explicit CanGroup(const XmlNode &cfg);
~CanGroup() = default;
void init();
std::shared_ptr<AbstractMotorProtocol> getMotorProtocol(const std::string &protocolType);
uint8_t getNodeId(const std::string& joint_name);
const MotorProtocolManager::MotorInfo& getMotorInfo(const std::string& joint_name);
private:
XmlNode cfg_;
std::string id_;
unsigned int channelId_;
bool enable_;
std::shared_ptr<MotorProtocolManager> motor_protocol_manager;
std::shared_ptr<device::AbstractCanbus> can_client_{nullptr};
std::shared_ptr<device::CanReceiver<msgs::RobotDetail>> can_receiver_{nullptr};
std::shared_ptr<device::CanSender<msgs::RobotDetail>> can_sender_{nullptr};
std::shared_ptr<device::MessageManager<msgs::RobotDetail>> message_manager_{nullptr};
};
}