Skip to content

Commit

Permalink
fixed launch daemon in ros2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Tiderko committed Sep 13, 2023
1 parent 5ce44f8 commit 010210e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
2 changes: 0 additions & 2 deletions fkie_master_discovery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ if ( ament_cmake_FOUND )
# find dependencies
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(rmw_dds_common REQUIRED)
find_package(rmw_fastrtps_cpp REQUIRED)
find_package(rosidl_typesupport_fastrtps_cpp REQUIRED)
find_package(rmw_fastrtps_shared_cpp REQUIRED)
find_package(lifecycle_msgs REQUIRED)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ def _get_node_executable(self):

def _get_launch_prefix(self) -> Union[str, None]:
prefix = getattr(self._entity, 'prefix', None)
if not prefix:
prefix = getattr(self._entity, 'launch-prefix', None)
if prefix:
prefix = launch.utilities.perform_substitutions(
self._launch_context, self._entity.prefix)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ def __init__(self, loop: asyncio.AbstractEventLoop, realm: str = 'ros', port: in
Log.info("Create ROS2 launch servicer")
CrossbarBaseSession.__init__(self, loop, realm, port)
LoggingEventHandler.__init__(self)
if not hasattr(self, realm):
self.realm = realm
self._watchdog_observer = Observer()
self.__launch_context = LaunchContext(argv=sys.argv[1:])
self.__launch_context._set_asyncio_loop(asyncio.get_event_loop())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,19 +441,22 @@ def _get_topic_from(topic_name, topic_type):
ros_node, isnew = _get_node_from(
sub_info.node_namespace, sub_info.node_name, n_guid)
for topic_type in topic_types:
tp, istopic = _get_topic_from(topic_name, topic_type)
# add tp.qos_profil
if istopic:
Log.debug(
f"{self.__class__.__name__}: add subscriber {n_guid} {sub_info.node_namespace}/{sub_info.node_name}")
tp.subscriber.append(n_guid)
ros_node.subscribers.append(tp)
else:
if n_guid not in tp.provider:
try:
tp, istopic = _get_topic_from(topic_name, topic_type)
# add tp.qos_profil
if istopic:
Log.debug(
f"{self.__class__.__name__}: add provider {n_guid} {sub_info.node_namespace}/{sub_info.node_name}")
tp.provider.append(n_guid)
ros_node.services.append(tp)
f"{self.__class__.__name__}: add subscriber {n_guid} {sub_info.node_namespace}/{sub_info.node_name}")
tp.subscriber.append(n_guid)
ros_node.subscribers.append(tp)
else:
if n_guid not in tp.provider:
Log.debug(
f"{self.__class__.__name__}: add provider {n_guid} {sub_info.node_namespace}/{sub_info.node_name}")
tp.provider.append(n_guid)
ros_node.services.append(tp)
except Exception as err:
print(err)
if isnew:
result.append(ros_node)
return result
Expand Down

0 comments on commit 010210e

Please sign in to comment.