load RTPS msg IDs from a JSON file and remove uorb_rtps_message_ids.py

This commit is contained in:
TSC21
2018-09-21 15:55:17 +02:00
committed by Beat Küng
parent 943bfbf93f
commit a323073456
7 changed files with 377 additions and 115 deletions
@@ -4,6 +4,7 @@
# Another positive effect of having the code here, is that this file will get
# precompiled and thus message generation will be much faster
import json
import genmsg.msgs
import gencpp
@@ -296,3 +297,15 @@ 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(json_file, message):
"""
Get RTPS ID of uORB message
"""
with open(json_file, 'r') as f:
msg_id_map = json.load(f)
for dict in msg_id_map["rtps"]:
if message in dict["msg"]:
return dict["id"]
return 0