ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I don't know how if it is possible in a clean way. A quick and dirty hack for Linux would be the misuse of the launch-prefix attribute.
In your package foo, create a file named kickstart with the content
#!/bin/bash
rosservice call --wait /global_localization &
exec "$@"
Then, make it executable using
chmod +x kickstart
Fainnly, add the following attribute to one of your <node> declarations in the launch file:
launch-prefix="$(find foo)/kickstart"
This will coax roslaunch into executing the kickstart script with the real node launch command line as parameters. The script performs the service call and executes the remainder of the command line, thus launching the node.
The --wait parameter ensures that the service is actually available, and the ampersand at the end of the rosservice line runs the call in the background, so the node launch will not be delayed.
I don't know how if it is possible in a clean way. A quick and dirty hack for Linux would be the misuse of the launch-prefix attribute.
In your package foo, create a file named kickstart with the content
#!/bin/bash
rosservice call --wait /global_localization &
exec "$@"
Then, make it executable using
chmod +x kickstart
Fainnly, Finally, add the following attribute to one of your <node> declarations in the launch file:
launch-prefix="$(find foo)/kickstart"
This will coax roslaunch into executing the kickstart script with the real node launch command line as parameters. The script performs the service call and executes the remainder of the command line, thus launching the node.
The --wait parameter ensures that the service is actually available, and the ampersand at the end of the rosservice line runs the call in the background, so the node launch will not be delayed.