初始化项目,包含fast_lio_ws和unitree_sdk2
This commit is contained in:
25
unitree_sdk2/example/helloworld/publisher.cpp
Normal file
25
unitree_sdk2/example/helloworld/publisher.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <unitree/robot/channel/channel_publisher.hpp>
|
||||
#include <unitree/common/time/time_tool.hpp>
|
||||
#include "HelloWorldData.hpp"
|
||||
|
||||
#define TOPIC "TopicHelloWorld"
|
||||
|
||||
using namespace unitree::robot;
|
||||
using namespace unitree::common;
|
||||
|
||||
int main()
|
||||
{
|
||||
ChannelFactory::Instance()->Init(0);
|
||||
ChannelPublisher<HelloWorldData::Msg> publisher(TOPIC);
|
||||
|
||||
publisher.InitChannel();
|
||||
|
||||
while (true)
|
||||
{
|
||||
HelloWorldData::Msg msg(unitree::common::GetCurrentTimeMillisecond(), "HelloWorld.");
|
||||
publisher.Write(msg);
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user