mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 16:03:33 +08:00
msg: templates: update empy contexts, required fields and license header years
This commit is contained in:
@@ -6,8 +6,7 @@
|
||||
@# Start of Template
|
||||
@#
|
||||
@# Context:
|
||||
@# - msgs (List) list of all msg files
|
||||
@# - ids (List) list of all RTPS msg ids
|
||||
@# - spec (msggen.MsgSpec) Parsed specification of the .msg file
|
||||
@###############################################
|
||||
@{
|
||||
import genmsg.msgs
|
||||
@@ -16,7 +15,6 @@ from px_generate_uorb_topic_files import MsgScope # this is in Tools/
|
||||
|
||||
send_topics = [(alias[idx] if alias[idx] else s.short_name) for idx, s in enumerate(spec) if scope[idx] == MsgScope.SEND]
|
||||
recv_topics = [(alias[idx] if alias[idx] else s.short_name) for idx, s in enumerate(spec) if scope[idx] == MsgScope.RECEIVE]
|
||||
package = package[0]
|
||||
}@
|
||||
/****************************************************************************
|
||||
*
|
||||
@@ -61,7 +59,7 @@ bool RtpsTopics::init(std::condition_variable *t_send_queue_cv, std::mutex *t_se
|
||||
std::cout << "\033[0;36m--- Subscribers ---\033[0m" << std::endl;
|
||||
@[for topic in recv_topics]@
|
||||
|
||||
if (_@(topic)_sub.init(@(ids[0].index(topic) + 1), t_send_queue_cv, t_send_queue_mutex, t_send_queue, ns)) {
|
||||
if (_@(topic)_sub.init(@(msgs[0].index(topic) + 1), t_send_queue_cv, t_send_queue_mutex, t_send_queue, ns)) {
|
||||
std::cout << "- @(topic) subscriber started" << std::endl;
|
||||
|
||||
} else {
|
||||
@@ -120,7 +118,7 @@ void RtpsTopics::publish(const uint8_t topic_ID, char data_buffer[], size_t len)
|
||||
switch (topic_ID) {
|
||||
@[for topic in send_topics]@
|
||||
|
||||
case @(ids[0].index(topic) + 1): { // @(topic) publisher
|
||||
case @(msgs[0].index(topic) + 1): { // @(topic) publisher
|
||||
@(topic)_msg_t st;
|
||||
eprosima::fastcdr::FastBuffer cdrbuffer(data_buffer, len);
|
||||
eprosima::fastcdr::Cdr cdr_des(cdrbuffer);
|
||||
@@ -162,7 +160,7 @@ bool RtpsTopics::getMsg(const uint8_t topic_ID, eprosima::fastcdr::Cdr &scdr)
|
||||
switch (topic_ID) {
|
||||
@[for topic in recv_topics]@
|
||||
|
||||
case @(ids[0].index(topic) + 1): // @(topic) subscriber
|
||||
case @(msgs[0].index(topic) + 1): // @(topic) subscriber
|
||||
if (_@(topic)_sub.hasMsg()) {
|
||||
@(topic)_msg_t msg = _@(topic)_sub.getMsg();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user