feat(monitor): 添加监控模块用于订阅和打印运动状态和里程计数据
添加新的Monitor类,用于订阅并打印SportModeState和Odometry消息数据 移除custom_robot.cpp中冗余的日志信息 更新CMakeLists.txt以包含新的监控模块
This commit is contained in:
28
include/monitor.hpp
Normal file
28
include/monitor.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef MONITOR_HPP
|
||||
#define MONITOR_HPP
|
||||
|
||||
#include <unitree/idl/go2/SportModeState_.hpp>
|
||||
#include <unitree/idl/ros2/Odometry_.hpp>
|
||||
#include <unitree/robot/channel/channel_subscriber.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace custom {
|
||||
|
||||
class Monitor {
|
||||
public:
|
||||
Monitor();
|
||||
~Monitor();
|
||||
|
||||
void initialize();
|
||||
|
||||
private:
|
||||
void sportModeStateCallback(const void* message);
|
||||
void odometryCallback(const void* message);
|
||||
|
||||
std::unique_ptr<unitree::robot::ChannelSubscriber<unitree_go::msg::dds_::SportModeState_>> sport_mode_state_subscriber_;
|
||||
std::unique_ptr<unitree::robot::ChannelSubscriber<nav_msgs::msg::dds_::Odometry_>> odometry_subscriber_;
|
||||
};
|
||||
|
||||
} // namespace custom
|
||||
|
||||
#endif // MONITOR_HPP
|
||||
Reference in New Issue
Block a user