Ask Your Question
0

rospy.init_node in multiprocessing.Process

asked 2018-07-19 04:56:59 -0600

machinekoder gravatar image

updated 2018-07-19 04:57:37 -0600

Hello everyone,

I have the following setup:

  • The main thread which starts a ROS node with services, pubs, and subs
  • A multiprocessing.Process which also should start an (anonymous) ROS node that has pubs and subs

So far so good. When I start (fork) the new process before calling rospy.init_node, everything works fine when I start from the command line.

However, when I start the application via roslaunch, I get the following error:

shutdown request: new node registered with same name

It looks like roslaunch/node enforces a new name in every node started as a subprocess. Any ideas how to circumvent the problem?

edit retag flag offensive close merge delete

Comments

I found the culprit: https://github.com/strawlab/ros_comm/... Looks like the name mappings override even anonymous nodes.

machinekoder gravatar imagemachinekoder ( 2018-07-19 05:25:50 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-19 05:27:01 -0600

machinekoder gravatar image

I found a workaround:

try:
    del rospy.names.get_mappings()['__name']
except KeyError:
    pass

However, I would prefer if rospy would have an option to force anonymity.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-07-19 04:56:59 -0600

Seen: 336 times

Last updated: Jul 19 '18