Skip to content

Commit

Permalink
Fixed qos profile parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-palmer committed Mar 30, 2024
1 parent c9f507a commit ef97915
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
7 changes: 3 additions & 4 deletions mobile_to_maritime/launch/demo.launch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ launch:
value: /cmd_vel
- name: out_topic
value: /cmd_vel_fsd
# Set the QoS profile to ensure that the subscriber is compatible with the publisher
- name: qos.reliability
value: system_default
- name: qos.durability
- name: qos_reliability
value: best_effort
- name: qos_durability
value: system_default

- executable:
Expand Down
21 changes: 11 additions & 10 deletions mobile_to_maritime/mobile_to_maritime/mobile_to_maritime.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def __init__(self, message_type: Any, node_name: str) -> None:

# Configure the QoS profile to avoid compatibility issues
self.declare_parameters(
"qos",
"",
[
("history", "keep_last"),
("reliability", "reliable"),
("durability", "volatile"),
("qos_history", "keep_last"),
("qos_reliability", "reliable"),
("qos_durability", "volatile"),
],
)
self.declare_parameters("qos", [("depth", 10)])
self.declare_parameters("", [("qos_depth", 10)])

in_topic = self.get_parameter("in_topic").get_parameter_value().string_value
out_topic = self.get_parameter("out_topic").get_parameter_value().string_value
Expand All @@ -63,22 +63,23 @@ def __init__(self, message_type: Any, node_name: str) -> None:
def _get_qos_profile_from_params(self) -> QoSProfile:
"""Construct a QoS profile from the parameters."""
history = QoSHistoryPolicy.get_from_short_key(
self.get_parameter("qos.history").get_parameter_value().string_value
self.get_parameter("qos_history").get_parameter_value().string_value
)
reliability = QoSReliabilityPolicy.get_from_short_key(
self.get_parameter("qos.reliability").get_parameter_value().string_value
self.get_parameter("qos_reliability").get_parameter_value().string_value
)
durability = QoSDurabilityPolicy.get_from_short_key(
self.get_parameter("qos.durability").get_parameter_value().string_value
self.get_parameter("qos_durability").get_parameter_value().string_value
)
depth = self.get_parameter("qos.depth").get_parameter_value().integer_value
depth = self.get_parameter("qos_depth").get_parameter_value().integer_value

return QoSProfile(
history=history, reliability=reliability, durability=durability, depth=depth
)

@abstractmethod
def in_callback(self, msg: Any) -> None: ...
def in_callback(self, msg: Any) -> None:
...


class MaritimeToMobileStamped(MobileToMaritime):
Expand Down

0 comments on commit ef97915

Please sign in to comment.