From fc980493d7d487111c14d45e61b7d368613ab9a8 Mon Sep 17 00:00:00 2001 From: TSC21 Date: Tue, 25 Sep 2018 12:58:34 +0100 Subject: [PATCH] px_generate_uorb_topic_helper: add a check for the existence of the RTPS ID for each uORB topic --- msg/tools/px_generate_uorb_topic_helper.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/msg/tools/px_generate_uorb_topic_helper.py b/msg/tools/px_generate_uorb_topic_helper.py index 9ad5817b73..6f3a6bb79f 100644 --- a/msg/tools/px_generate_uorb_topic_helper.py +++ b/msg/tools/px_generate_uorb_topic_helper.py @@ -346,11 +346,19 @@ def print_field_def(field): print('\t%s%s%s %s%s;%s' % (type_prefix, type_px4, type_appendix, field.name, array_size, comment)) + def rtps_message_id(msg_id_map, message): """ Get RTPS ID of uORB message """ + msg_id = -1 for dict in msg_id_map[0]['rtps']: if message in dict['msg']: - return dict['id'] - return 0 + msg_id = dict['id'] + + if msg_id != -1: + return msg_id + else: + raise AssertionError( + "%s does not have a RTPS ID set in the definition file. Please add an ID from the available pool!") + exit(1)