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

Know if the other nodes are ready

asked 2021-03-25 05:04:55 -0600

felixN gravatar image

Hi, I have a python node (a state machine) launching a launch file (using the python api) containing lots of nodes (sensors, navigation modes, ...) In order for the state machine to be operational, I need all (or at least most) of the nodes to be "ready".

For now, I just add some fixed delays to make sure that all nodes are ready : it works (at least I didn't noticed a case were I know it caused a problem), but it adds some "useless" delay to the startup process of the robot.

Is there a way to find out if a given node (or all nodes) are "ready"? That way, I could gain a significant amount of time in the power-up sequence of the robot.

Note that I can change the way things are launched if needed (for now, a bash script start the state machine (with rosrun), which in turn launches a launch file containing all the other nodes). The nodes are a mix between python2 and C++ nodes, some I wrote, other that are standard nodes

Thanks a lot in advance

Felix

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-25 07:54:34 -0600

luchko gravatar image

Hi, it may exists some better way but in a personnal project i used 2 ways to "determine if a (set of) node is ready" :

  • use rosnode ping if you just need to know if a "child node" is up. That should be easily pythonified if needed.
  • if you need to know that your child node is publishing something, you could wait to receive a message (eg. using waitForMessage)

Please, tell me if that not suit your needs! BR

edit flag offensive delete link more

Comments

Thanks! For ping, when exactly does a node answer to ping commands?

For the wairForMessage, it's a good solution for all node supposed to publish continuously. For the other ones, if I wrote them, I can add a dedicated "ready" message

felixN gravatar image felixN  ( 2021-03-25 10:22:06 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2021-03-25 05:04:55 -0600

Seen: 560 times

Last updated: Mar 25 '21