ros2 launch creates two nodes of same type
Hi,
I am experiencing a weird behavior of the ros2 launch
command.
Using following example launch file from the robot_localization packge:
from launch import LaunchDescription
from ament_index_python.packages import get_package_share_directory
import launch_ros.actions
import os
import yaml
from launch.substitutions import EnvironmentVariable
import pathlib
import launch.actions
from launch.actions import DeclareLaunchArgument
def generate_launch_description():
return LaunchDescription([
launch_ros.actions.Node(
package='robot_localization',
node_executable='ekf_node',
node_name='ekf_filter_node',
output='screen',
parameters=[os.path.join(get_package_share_directory("robot_localization"), 'params', 'ekf.yaml')],
),
])
creates following output:
$ ros2 launch robot_localization ekf.launch.py
[INFO] [launch]: All log files can be found below /home/xxx/.ros/log/2020-02-14-12-59-00-118313-xxx-22388
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ekf_node-1]: process started with pid [22398]
[ekf_node-1] [WARN] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[ekf_node-1] X acceleration is being measured from IMU; X velocity control input is disabled
Listing running nodes with ros2 node list
also shows me two ekf_nodes.
The same happens with ros2 cartographer_ros node.
Any Idea why this is happening? I am able to launch other nodes without any problem.
I have similar issue.
I am experiencing the same issue using Dashing version. Any updates on how to fix it and what version do you use of robot_localization?
Can you check if the same node is already running ?
In my case, the launch was happening due to a script which launches ros node automatically after building the code. So when I manually launch the node, it does not run.
After making some modifications to the script, now I am able to run the node manually.
I just checked and the node is not already running before I run my launch file. Can you show the script where you made the modifications to get it running?
Did you all figure this out? I don't use ROS2, so I don't have a lot to say here, but I'm wondering if this has been solved.
Hi, sorry for the late reply. I did not solve this issue. However, I also haven't digged in deeper yet, as I am currently trying out different things in ros.
In reply to @kk2105: I did not use any other script to launch the node. I also checked that there are no nodes running at launch.
@DanielRobotics Apologies for the delay in response. Unfortunately I will not be able to share the script. However that is just a simple script which launches the node by running
ros2 launch launch_file.py
.@DanielRobotics@Tom Moore Even I did not dig deeper in finding the root cause. However in ROS2 I believe, there is no separate command which actually kills the running node. So if the same node runs in same system, it overrides the already running one. Is this right @gvdhoorn ?