I'm running a Python script. When the measured altitude is higher than 1 meter, I need to run this in the terminal:
cd ~
cd ~/catkin_ws_artag/src/launch
roslaunch pr2_indiv_1.launch
and when it's lower than 1 meter, I need to run this in the terminal:
cd ~
cd ~/catkin_ws_artag/src/launch
roslaunch pr2_indiv_0.launch
How can I do that? I tried something like this, but it doesn't work:
position = "low"
if marker.pose.position.z > 1 and position=="low":
os.system("cd ~")
os.system("cd ~/catkin_ws_artag/src/launch")
os.system("roslaunch pr2_indiv_1.launch")
position = "high"
print "HIGH"
################################
if marker.pose.position.z < 1 and position=="high":
os.system("cd ~")
os.system("cd ~/catkin_ws_artag/src/launch")
os.system("roslaunch pr2_indiv_0.launch")
position = "low"
print "LOW"
but it says: [pr2_indiv_0.launch] is not a launch file name.
The traceback for the exception was written to the log file, and I think it's because it doesn't run all the lines in the same terminal.
How can I make this work? I'm using Ubuntu 16.04