Robotics StackExchange | Archived questions

Turtlebot3 LiDAR laser_filter package error "Reason: new node registered with same name"

i'm trying to use a laser_filter package to help my turtlebot3 LiDAR data. This is my launch file:

<launch>
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>

  <include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch">
    <arg name="model" value="$(arg model)" />
  </include>

  <node pkg="laser_filters" type="scan_to_scan_filter_chain" output="screen" name="laser_filter">
    <rosparam command="load" file="$(find test)/my_laser_config.yaml" />
    <param name="~tf_message_filter_target_frame" type="str" value="base_scan" />
    <remap from="scan" to="base_scan" />
    <remap from="scan_filtered" to="/scan_filtered" />
  </node>
</launch>

I get this error when I launch it:

[ WARN] [1643321298.168853230]: Shutdown request received.
[ WARN] [1643321298.169861311]: Reason given for shutdown: [[/robot_state_publisher] Reason: new node registered with same name]

I dont know where in my files I would have nodes with the same name that I assume publish to /robot_state_plusher or are named robot_state_publisher. I need help fixing this issue

Asked by distro on 2022-01-27 20:43:13 UTC

Comments

robot_state_publisher is the name of the duplicate node--not topic. Your included launch file (turtlebaot3_remote.launch) contains one such node. If you're running any other launch files, they may also contain a node with the same name. This error also arises if you have a node leftover from a previous launch, e.g., you run a test with your launch file, decide to change a parameter, and try to launch the test again without first stopping the previous run.

Asked by tryan on 2022-01-29 15:55:52 UTC

@tryan The only other launch file I have to run beforehand is the turtlebot3_robot.launch file here:

<launch>
  <arg name="multi_robot_name" default=""/>
  <arg name="set_lidar_frame_id" default="base_scan"/>

  <include file="$(find turtlebot3_bringup)/launch/turtlebot3_core.launch">
    <arg name="multi_robot_name" value="$(arg multi_robot_name)"/>
  </include>
  <include file="$(find turtlebot3_bringup)/launch/turtlebot3_lidar.launch">
    <arg name="set_frame_id" value="$(arg set_lidar_frame_id)"/>
  </include>

  <node pkg="turtlebot3_bringup" type="turtlebot3_diagnostics" name="turtlebot3_diagnostics" output="screen"/>
</launch>

Asked by distro on 2022-01-30 02:38:00 UTC

@tryan Which includes turtlebot3_core.launch:

<launch>
  <arg name="multi_robot_name" default=""/>

  <node pkg="rosserial_python" type="serial_node.py" name="turtlebot3_core" output="screen">
    <param name="port" value="/dev/ttyACM0"/>
    <param name="baud" value="115200"/>
    <param name="tf_prefix" value="$(arg multi_robot_name)"/>
  </node>
</launch>

And turtlebot3_lidar.launch:

<launch>
  <arg name="set_frame_id" default="base_scan"/>

  <node pkg="hls_lfcd_lds_driver" type="hlds_laser_publisher" name="turtlebot3_lds" output="screen">
    <param name="port" value="/dev/ttyUSB0"/>
    <param name="frame_id" value="$(arg set_frame_id)"/>
  </node>
</launch>

None of which as you can see contain any node of name robot_state_publisher

Asked by distro on 2022-01-30 02:40:30 UTC

@tryan Any other ideas to what could be going on?

Asked by distro on 2022-01-30 02:45:05 UTC

The launch files, indeed, look fine. This may have been implicit in your reply, but are you starting a fresh session each time? If you don't shut down the master and you happen to have left a robot_state_publisher running in a different launch/terminal, it would cause this error. As noted by @ljaniec, rosnode list is a good way to see which nodes are running. You could look at the list before launching anything to make sure no errant nodes are there, then after each launch to see what has changed.

Asked by tryan on 2022-01-31 20:59:51 UTC

Answers

This means you have used the same node name more than once in your Python or launch files, or you’re trying to launch the same program when it’s already running. Please check the following for this repetition:

  • Your rospy.init_node() statements
  • Your launch file node declaration: <node name="whatever" ... />

It’s about the name for your node in your Python code and launch files.

You should check with rostopic list and rosnode list what each launcher starts separately, topics and nodes. The node called robot_state_publisher could be buried in these.

Side note: AFAIK from https://emanual.robotis.com/docs/en/platform/turtlebot3/slam/ you should just connect with ssh to your TB3 and launch bringup scripts. Why do you use turtlebot3_remote.launch too?

laser_filters/LaserScanSpeckleFilter
  params:
    # Select which filter type to use.
    # 0: Range based filtering (distance between consecutive points)
    # 1: Euclidean filtering based on radius outlier search
    filter_type:0

    # Only ranges smaller than this range are taken into account
    max_range: 2.0

    # filter_type[0] (Distance): max distance between consecutive points
    # filter_type[1] (RadiusOutlier): max distance between points
    max_range_difference: 0.1

    # filter_type[0] (Distance): Number of consecutive ranges that will be tested for max_distance
    # filter_type[1] (RadiusOutlier): Minimum number of neighbors
    filter_window: 2

Asked by ljaniec on 2022-01-30 09:02:35 UTC

Comments

@ljaniec I'm not directly using the turtlebot3_remote.launch , I am trying to make a launch file that runs the laser_filter package to clean up my LiDAR data, I got the idea for the launch file here, as it is specific for the turtlebot3. When I look at the script(scan_to_scan_filter) in said launch file: type="scan_to_scan_filter_chain"., which you can see here. I don't see any node of the name robot_state_publisher here. I always ssh my TB3 and use the command roslaunch turtlebot3_bringup turtlebot3_robot.launch. Im not using ROS2, I use ROS1. Not sure why you say I should ros2 topic list -t .

Asked by distro on 2022-01-30 15:36:05 UTC

I wrote the commands too fast and made a mistake, I mainly work with ROS2 now, sorry. I edited the commands - the info will still be useful to pinpoint the problematic node. ROBOTIS launchfile seems fine. Maybe it is a problem with ROS packages? Did you try to do clean & rebuild?

Asked by ljaniec on 2022-01-30 16:39:45 UTC

This project has an example launcher with laser_filters, maybe it could help you analyze your case

Asked by ljaniec on 2022-01-30 16:51:01 UTC

@ljaniec So I launch my turtlebot3_robot.launch first and then rostopic list and rosnode list. Then I note what info that gives me. In another terminal i launch the file I wanna use for my filter and then rostopic list and rosnode list again?

Asked by distro on 2022-01-30 21:45:26 UTC

Yeah, sort of. You want to see where second robot_state_publisher come from.

Asked by ljaniec on 2022-01-31 05:36:02 UTC

@ljaniec You were right, launching my_laser_filter launch file activated a node robot_state_publisher, launcing my Rviz also activated a node of same name. This is because of this part of my launch file here:

 <include file="$(find turtlebot3_bringup)/launch/turtlebot3_remote.launch">
    <arg name="model" value="$(arg model)" />
  </include>

When I remove that part it's fine, however, the filter seems to not do anything though. This is my .yaml file. I was informed that the speckle filter was what would help me.

scan_filter_chain:
- name: speckle_filter
  type: laser_filters/LaserScanSpeckleFilter
  params:
    filter_type: 0
    max_range: 4.0
    max_range_difference: 0.1
    filter_window: 2

Asked by distro on 2022-02-01 04:29:20 UTC

@ljaniec Do I change the scan topic in Rviz to scan_filtered?

Asked by distro on 2022-02-01 04:31:12 UTC

By the example project I linked above you can see that there is a remap indeed:

<node pkg="laser_filters" type="scan_to_scan_filter_chain" name="laser_filter"> <rosparam command="load" file="$(find laser_filters)/turtlebot3_range_filter.yaml"/> <remap from="scan_filtered" to="/laserscan_filtered" /> </node>

I assume with RViz it should be something similar, just check every scan related topic in RViz.

Asked by ljaniec on 2022-02-01 05:05:00 UTC

@ljaniec Maybe the parameters I have set in my .yaml file are what the problem is now. I don't even know how to set them. The wiki for this package have a poor explanation for what the parameters are, I don't know what max_range or any of the other parameters are really responsible for.

Asked by distro on 2022-02-01 16:39:49 UTC

It was hard to find but not impossible. I edited it in the answer.

Asked by ljaniec on 2022-02-01 18:13:10 UTC

@ljaniec the link you gave gives the same explanaition as whats in the wiki. for instance what does "minimum number of neighbors"?

Asked by distro on 2022-02-01 19:13:07 UTC

Then you should read it more carefully and try more to understand it??? LaserScanSpeckleFilter - this is a filter that removes speckle points in a laser scan by looking at neighbor points. Read the code with the filter mechanism in mind: this filter removes laser data points which satisfies the following: for all points P1, if there exists a point P2 in (P1 - window, P1 + window) so that (angle(P1, O, P2)) < min_angle or (angle(P1, O, P2)) > max_angle, then remove all datapoint in (P1 - neighbor, P1 + neighbor), where O means the origin of the laser. By computing the angle differences between successive readings and discarding those that don't fit within a user-specified range you should get filtered scan. Parameters tuning is a must there - "Err and err and err again but less and less".

Asked by ljaniec on 2022-02-01 19:58:30 UTC

@ljaniec oh thanks! it seems to be working a bit now, but yeah, I think at this point my turtlebot3 might have a hardware issue as well.

Asked by distro on 2022-02-02 00:26:39 UTC