diff --git a/src/modules/uxrce_dds_client/dds_topics.h.em b/src/modules/uxrce_dds_client/dds_topics.h.em index 7ae3b7e48d79..25364c12f776 100644 --- a/src/modules/uxrce_dds_client/dds_topics.h.em +++ b/src/modules/uxrce_dds_client/dds_topics.h.em @@ -44,7 +44,7 @@ struct SendSubscription { const char* topic; uint32_t topic_size; UcdrSerializeMethod ucdr_serialize_method; - uint16_t polling_interval; + uint16_t max_rate_hz; }; // Subscribers for messages to send @@ -57,7 +57,7 @@ struct SendTopicsSubs { "@(pub['topic'])", ucdr_topic_size_@(pub['simple_base_type'])(), &ucdr_serialize_@(pub['simple_base_type']), - @(pub['polling_interval']), + @(pub['max_rate_hz']), }, @[ end for]@ }; @@ -75,7 +75,7 @@ void SendTopicsSubs::init() { for (unsigned idx = 0; idx < sizeof(send_subscriptions)/sizeof(send_subscriptions[0]); ++idx) { fds[idx].fd = orb_subscribe(send_subscriptions[idx].orb_meta); fds[idx].events = POLLIN; - orb_set_interval(fds[idx].fd, send_subscriptions[idx].polling_interval); + orb_set_interval(fds[idx].fd, send_subscriptions[idx].max_rate_hz ? 1000000 / send_subscriptions[idx].max_rate_hz : 0); } } diff --git a/src/modules/uxrce_dds_client/dds_topics.yaml b/src/modules/uxrce_dds_client/dds_topics.yaml index 85d1737a50a1..6ba7e5d8f370 100644 --- a/src/modules/uxrce_dds_client/dds_topics.yaml +++ b/src/modules/uxrce_dds_client/dds_topics.yaml @@ -37,7 +37,7 @@ publications: - topic: /fmu/out/sensor_combined type: px4_msgs::msg::SensorCombined - polling_interval: 1 + max_rate_hz: 1000 - topic: /fmu/out/timesync_status type: px4_msgs::msg::TimesyncStatus diff --git a/src/modules/uxrce_dds_client/generate_dds_topics.py b/src/modules/uxrce_dds_client/generate_dds_topics.py index f1875b79b22b..e80ceb53f9ea 100644 --- a/src/modules/uxrce_dds_client/generate_dds_topics.py +++ b/src/modules/uxrce_dds_client/generate_dds_topics.py @@ -42,7 +42,7 @@ import em import yaml -DEFAULT_POLLING_RATE = 10 +DEFAULT_MAX_RATE_HZ = 100 parser = argparse.ArgumentParser() parser.add_argument("-m", "--topic-msg-dir", dest='msgdir', type=str, @@ -100,10 +100,10 @@ def process_message_type(msg_type): msg_type['dds_type'] = msg_type['type'].replace("::msg::", "::msg::dds_::") + "_" # topic_simple: eg vehicle_status msg_type['topic_simple'] = msg_type['topic'].split('/')[-1] - if "polling_interval" not in msg_type: - msg_type["polling_interval"] = DEFAULT_POLLING_RATE + if "max_rate_hz" not in msg_type: + msg_type["max_rate_hz"] = DEFAULT_MAX_RATE_HZ else: - msg_type["polling_interval"] = int(msg_type["polling_interval"]) + msg_type["max_rate_hz"] = int(msg_type["max_rate_hz"]) pubs_not_empty = msg_map['publications'] is not None if pubs_not_empty: