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

Scripts don't see ROS if executed by ProcessBuilder()

asked 2019-06-14 09:56:48 -0600

Cipek gravatar image

I want to execute a script with a ProcessBuilder(). My code is:

new ProcessBuilder().inheritIO().command("/bin/bash", "-c", "./deploy.sh").start();

In the bash script I have:

#!/bin/bash
rosrun my_package ardrone_test_1.py

It works if I run the bash script manually in the terminal, but if I do with the ProcessBuilder I got an error:

rosrun: command not found

The same if I run python scripts which uses ROS. There are errors that some package are not found, whereas it works fine if run via terminal.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-06-20 11:10:49 -0600

davrsky gravatar image

You need to source setup.bash first in order for the environment to work. In your deploy.sh add a line like "source /your/ros_ws/devel/setup.bash" before you call rosrun

edit flag offensive delete link more

Comments

I have been looking for the solution really long and that worked! Thank you.

Cipek gravatar image Cipek  ( 2019-06-20 14:15:07 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-06-14 09:56:48 -0600

Seen: 394 times

Last updated: Jun 20 '19