feat: 初始化 Go2 导航相关代码与配置

This commit is contained in:
2026-10-15 09:40:29 +08:00
commit 07426fcc09
1282 changed files with 331220 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
#include <unitree/robot/channel/channel_subscriber.hpp>
#include <unitree/common/time/time_tool.hpp>
#include "HelloWorldData.hpp"
#define TOPIC "TopicHelloWorld"
using namespace unitree::robot;
using namespace unitree::common;
void Handler(const void* msg)
{
const HelloWorldData::Msg* pm = (const HelloWorldData::Msg*)msg;
std::cout << "userID:" << pm->userID() << ", message:" << pm->message() << std::endl;
}
int main()
{
ChannelFactory::Instance()->Init(0);
ChannelSubscriber<HelloWorldData::Msg> subscriber(TOPIC);
subscriber.InitChannel(Handler);
sleep(5);
subscriber.CloseChannel();
std::cout << "reseted. sleep 3" << std::endl;
sleep(3);
subscriber.InitChannel();
sleep(5);
subscriber.CloseChannel();
std::cout << "reseted. sleep 3" << std::endl;
sleep(3);
subscriber.InitChannel();
while (true)
{
sleep(10);
}
return 0;
}