forked from Archive/PX4-Autopilot
uorb topics generator: add multi-topics to the list of all topics
topic names with '# TOPICS <name>' were previously not in orb_get_topics(). This means the logger could not find them. Affects for example actuator_controls_0.
This commit is contained in:
parent
4e1652fa6b
commit
89a7e0cf87
|
@ -259,7 +259,12 @@ def convert_dir_save(format_idx, inputdir, outputdir, templatedir, temporarydir,
|
|||
|
||||
def generate_topics_list_file(msgdir, outputdir, templatedir):
|
||||
# generate cpp file with topics list
|
||||
tl_globals = {"msgs" : get_msgs_list(msgdir)}
|
||||
msgs = get_msgs_list(msgdir)
|
||||
multi_topics = []
|
||||
for msg in msgs:
|
||||
msg_filename = os.path.join(msgdir, msg)
|
||||
multi_topics.extend(get_multi_topics(msg_filename))
|
||||
tl_globals = {"msgs" : msgs, "multi_topics": multi_topics}
|
||||
tl_template_file = os.path.join(templatedir, TOPICS_LIST_TEMPLATE_FILE)
|
||||
tl_out_file = os.path.join(outputdir, TOPICS_LIST_TEMPLATE_FILE.replace(".template", ""))
|
||||
generate_by_template(tl_out_file, tl_template_file, tl_globals)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
@#
|
||||
@# Context:
|
||||
@# - msgs (List) list of all msg files
|
||||
@# - multi_topics (List) list of all multi-topic names
|
||||
@###############################################
|
||||
/****************************************************************************
|
||||
*
|
||||
|
@ -45,17 +46,19 @@
|
|||
#include <uORB/uORBTopics.h>
|
||||
#include <uORB/uORB.h>
|
||||
@{
|
||||
msgs_count = len(msgs)
|
||||
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
|
||||
msgs_count_all = len(msg_names_all)
|
||||
}@
|
||||
@[for msg_name in msg_names]@
|
||||
#include <uORB/topics/@(msg_name).h>
|
||||
@[end for]
|
||||
|
||||
const size_t _uorb_topics_count = @(msgs_count);
|
||||
const size_t _uorb_topics_count = @(msgs_count_all);
|
||||
const struct orb_metadata* _uorb_topics_list[_uorb_topics_count] = {
|
||||
@[for idx, msg_name in enumerate(msg_names, 1)]@
|
||||
ORB_ID(@(msg_name))@[if idx != msgs_count],@[end if]
|
||||
@[for idx, msg_name in enumerate(msg_names_all, 1)]@
|
||||
ORB_ID(@(msg_name))@[if idx != msgs_count_all],@[end if]
|
||||
@[end for]
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue