2025-10-22 16:40:55 +08:00
|
|
|
//
|
|
|
|
|
// Created by linbo on 2025/10/22.
|
|
|
|
|
//
|
|
|
|
|
|
2025-10-29 16:26:15 +08:00
|
|
|
#pragma once
|
2025-10-22 16:40:55 +08:00
|
|
|
|
2025-10-24 09:51:14 +08:00
|
|
|
#include "motor_protocol/motorprotocolmanager.h"
|
2025-10-29 16:26:15 +08:00
|
|
|
|
2025-10-24 10:51:49 +08:00
|
|
|
namespace cmvr::hardware
|
2025-10-22 16:40:55 +08:00
|
|
|
{
|
|
|
|
|
class CanGroup
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit CanGroup(const XmlNode &cfg);
|
|
|
|
|
~CanGroup() = default;
|
|
|
|
|
|
2025-10-29 16:26:15 +08:00
|
|
|
void init();
|
2025-10-24 10:51:49 +08:00
|
|
|
|
2025-11-06 15:58:32 +08:00
|
|
|
std::shared_ptr<AbstractMotorProtocol> getMotorProtocol(const std::string &protocolType);
|
|
|
|
|
uint8_t getNodeId(const std::string& joint_name);
|
2025-11-06 17:27:37 +08:00
|
|
|
|
|
|
|
|
const MotorProtocolManager::MotorInfo& getMotorInfo(const std::string& joint_name);
|
2025-10-24 10:51:49 +08:00
|
|
|
private:
|
2025-10-29 16:26:15 +08:00
|
|
|
XmlNode cfg_;
|
2025-10-24 09:51:14 +08:00
|
|
|
std::string id_;
|
|
|
|
|
unsigned int channelId_;
|
|
|
|
|
bool enable_;
|
|
|
|
|
std::shared_ptr<MotorProtocolManager> motor_protocol_manager;
|
|
|
|
|
|
2025-10-29 16:26:15 +08:00
|
|
|
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};
|
2025-10-22 16:40:55 +08:00
|
|
|
};
|
2025-10-29 16:26:15 +08:00
|
|
|
}
|