mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 07:23:35 +08:00
microRTPS: add timesync for the agent side
This commit is contained in:
@@ -73,7 +73,6 @@ bool RtpsTopics::init(std::condition_variable* t_send_queue_cv, std::mutex* t_se
|
||||
std::cerr << "Failed starting @(topic) subscriber" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@[end for]@
|
||||
std::cout << "--------------------" << std::endl << std::endl;
|
||||
@[end if]@
|
||||
@@ -83,11 +82,13 @@ bool RtpsTopics::init(std::condition_variable* t_send_queue_cv, std::mutex* t_se
|
||||
@[for topic in send_topics]@
|
||||
if (_@(topic)_pub.init()) {
|
||||
std::cout << "- @(topic) publisher started" << std::endl;
|
||||
@[ if topic == 'Timesync']@
|
||||
_timesync->start(&_@(topic)_pub);
|
||||
@[ end if]@
|
||||
} else {
|
||||
std::cerr << "ERROR starting @(topic) publisher" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@[end for]@
|
||||
std::cout << "--------------------" << std::endl;
|
||||
@[end if]@
|
||||
@@ -118,6 +119,9 @@ void RtpsTopics::publish(uint8_t topic_ID, char data_buffer[], size_t len)
|
||||
eprosima::fastcdr::FastBuffer cdrbuffer(data_buffer, len);
|
||||
eprosima::fastcdr::Cdr cdr_des(cdrbuffer);
|
||||
st.deserialize(cdr_des);
|
||||
@[ if topic == 'Timesync']@
|
||||
_timesync->processTimesyncMsg(&st);
|
||||
@[ end if]@
|
||||
_@(topic)_pub.publish(&st);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user