26 lines
563 B
C++
26 lines
563 B
C++
|
|
#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;
|
||
|
|
}
|