uORB : Don't automatically include message name as default topic name in uORBTopics source files, to handle case where user doesn't use default messgae name for multi topic definition in .msg file

This commit is contained in:
Junwoo Hwang
2022-04-13 09:08:51 +02:00
committed by Beat Küng
parent 4fc161192a
commit 35613df210
5 changed files with 52 additions and 35 deletions
+6 -6
View File
@@ -8,7 +8,7 @@
@#
@# Context:
@# - msgs (List) list of all msg files
@# - multi_topics (List) list of all multi-topic names
@# - topics (List) list of all topic names
@###############################################
/****************************************************************************
*
@@ -48,17 +48,17 @@
@{
msg_names = [mn.replace(".msg", "") for mn in msgs]
msgs_count = len(msg_names)
msg_names_all = list(set(msg_names + multi_topics)) # set() filters duplicates
msg_names_all.sort()
msgs_count_all = len(msg_names_all)
topics_all = topics
topics_all.sort()
topics_count_all = len(topics_all)
}@
@[for msg_name in msg_names]@
#include <uORB/topics/@(msg_name).h>
@[end for]
const constexpr struct orb_metadata *const uorb_topics_list[ORB_TOPICS_COUNT] = {
@[for idx, msg_name in enumerate(msg_names_all, 1)]@
ORB_ID(@(msg_name))@[if idx != msgs_count_all], @[end if]
@[for idx, topic_name in enumerate(topics_all, 1)]@
ORB_ID(@(topic_name))@[if idx != topics_count_all], @[end if]
@[end for]
};