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

How to handle or control the start moment of nodes? [closed]

asked 2018-07-11 03:31:01 -0500

harderthan gravatar image

updated 2018-07-11 04:03:05 -0500

Hello, ROS experts. I described my situation.
Could you tell me some advice for me?
I hope it will be not too abstract to you.

I want to handle or control a start moment of nodes.
Is it possible in ROS?

I have make a package included some sensors like camera, lidar, radar, etc...
When our system begin to start process, It have to check whether the sensors is working well at that's time.
So, I added a code on packages of sensors to publish a topic which have a error message.
And, A package we call by Control Node will subscribe to check the error which was published by nodes of sensors.

If it will work as I thought, the Control Node must start before sensors. Is it always will start before the others? If not, How to control that?

I have used ros kinetic on ubuntu 16.04.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by harderthan
close date 2019-01-31 08:12:36.561063

Comments

First, be aware that the nodes are launched in the same order of the launch file so you should have your Control Node at the beginning of your launchfile.

Delb gravatar image Delb  ( 2018-07-11 03:38:01 -0500 )edit

Secondly, if for any reasons the initialization of Control Node is longer than the other nodes then you can have a publisher on a /start topic in your Control Node, publish on it when it's initialized and have your other nodes subscribing to /start waiting for the topic to be published on.

Delb gravatar image Delb  ( 2018-07-11 03:40:57 -0500 )edit

And I would suggest instead of a Control Node to directly check inside your different callbacks if the messages received are correct and do things only if true.

Delb gravatar image Delb  ( 2018-07-11 03:43:22 -0500 )edit

@Delb Do you have a link for that? As far as I know, roslaunch intentionally does not guarantee to start nodes in the order that they're listed in a launch file.

jayess gravatar image jayess  ( 2018-07-11 10:18:41 -0500 )edit

From the tutorial

Roslaunch intentionally does not provide any control on the order or timing of node start up

jayess gravatar image jayess  ( 2018-07-11 10:19:27 -0500 )edit

No I don't, it just always the behavior I've noted so I took it for granted. I'll dig deeper then thank you for pointing that out.

Delb gravatar image Delb  ( 2018-07-11 10:26:25 -0500 )edit

Roslaunch intentionally does not provide any control on the order or timing of node start up

Doesn't it state that there isn't any control on when the ros::init in each node file is called rather than which node file to call ?

Delb gravatar image Delb  ( 2018-07-11 10:30:16 -0500 )edit
1

I'm not sure, I'd have to see the link. But, take a look at the roslaunch Architecture on the wiki.

jayess gravatar image jayess  ( 2018-07-11 10:35:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-11 23:04:41 -0500

harderthan gravatar image

Thank you, @Delb and @jayess.

In my case, I'll use the way that make a topic to publish /start as start signal.

The link @jayess provided is helpful to me.
The point is that roslaunch does not provide and guarantee any control on order or timing of node start up.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-07-11 03:31:01 -0500

Seen: 986 times

Last updated: Jul 11 '18