ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Built in mechanism to prevent multiple instances of same Node

asked 2022-12-26 09:49:33 -0500

sameh4 gravatar image

This question was already asked here on ROS answers but no answer was given. Only a suggestion in the comments.

I am building a mobile robot, and using GPIO on the Jetson Nano for the wheel encoder, motor drivers etc. For the wheel encoders, I have a node that maintains the total ticks of both wheel encoders, and publishes those ticks on different topics; left_wheel_encoder and right_wheel_encoder.

Wheel encoders work by incrementing total ticks, which is kept in two variables (one left and one right) within the WheelEncoderNode class.

It's too easy to launch two WheelEncoderNode nodes that are 1 min apart and will end up publishing different total tick values; obv. the latter one will have a lower count.

Is there a built in mechanism to prevent me from doing that? I mean other than launch files for all packages, which is a requirement.

But I am thinking of maybe a lock file that the WheelEncoderNode creates and checks if it exists, similar to how daemons run. But hoping there's a built-in mechanism in ros for this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-12-26 16:22:18 -0500

ljaniec gravatar image

updated 2022-12-26 16:31:25 -0500

Related issues from ROS2 GitHub I read through:

In general, as per this feature ideas log, uniqueness of node names (see ros2/design#187) is yet to be implemented in the ROS2. So there is no official tool yet for it.

Other place suggests using bondcpp(https://github.com/ros/bond_core/tree...) or other type of software watchdogs. First one is used in the Nav2, so it is a good recommendation.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-12-26 09:49:33 -0500

Seen: 78 times

Last updated: Dec 26 '22