Skip to content

Commit

Permalink
Set the default frequency rate as a parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisTM committed Aug 5, 2024
1 parent b10d53f commit 18190c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/modules/uxrce_dds_client/dds_topics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# This file maps all the topics that are to be used on the uXRCE-DDS client.
#
#####
default_max_rate_hz: 100

publications:

- topic: /fmu/out/register_ext_component_reply
Expand Down
9 changes: 6 additions & 3 deletions src/modules/uxrce_dds_client/generate_dds_topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
import em
import yaml

DEFAULT_MAX_RATE_HZ = 100

parser = argparse.ArgumentParser()
parser.add_argument("-m", "--topic-msg-dir", dest='msgdir', type=str,
help="Topics message, by default using relative path 'msg/'", default="msg")
Expand Down Expand Up @@ -87,6 +85,11 @@
merged_em_globals = {}
all_type_includes = []

if "default_max_rate_hz" not in msg_map:
msg_map["default_max_rate_hz"] = 100
else:
msg_map["default_max_rate_hz"] = int(msg_map["default_max_rate_hz"])

def process_message_type(msg_type):
# eg TrajectoryWaypoint from px4_msgs::msg::TrajectoryWaypoint
simple_base_type = msg_type['type'].split('::')[-1]
Expand All @@ -101,7 +104,7 @@ def process_message_type(msg_type):
# topic_simple: eg vehicle_status
msg_type['topic_simple'] = msg_type['topic'].split('/')[-1]
if "max_rate_hz" not in msg_type:
msg_type["max_rate_hz"] = DEFAULT_MAX_RATE_HZ
msg_type["max_rate_hz"] = msg_map["default_max_rate_hz"]
else:
msg_type["max_rate_hz"] = int(msg_type["max_rate_hz"])

Expand Down

0 comments on commit 18190c2

Please sign in to comment.