Hopefully helpful rosject startup script

I always had to do a few things before starting the roject which I found annoying so I automated it into the following script. Now I just run “rosrun turtlebot starter.py” to do the following: updates, catkin_make for both the catkin_ws and the simulation_ws, source devel/setup.bash for both workspaces, launch simulator. Hope its helpful:

Mods, can you let me know if this setup is problematic in some way, ill take it down if so:

#! /usr/bin/env python

import os
import subprocess
import sys
import stat
from subprocess import call, Popen

os.system(‘sudo apt-get install’)
os.system(‘sudo apt update’)
print (‘update complete’)
os.system(‘sudo apt install -y python3-osrf-pycommon’)
os.chdir(‘catkin_ws’) # relative path: scripts dir is under Lab
os.system(‘catkin_make’)
os.chdir(‘…’)
os.chdir(‘simulation_ws’)
os.system(‘catkin_make’)
os.chdir(‘…’)

def copy2clip(txt):
cmd=‘echo ‘+txt.strip()+’|clip’
return subprocess.check_call(cmd, shell=True)

copy2clip(‘source ~/catkin_ws/devel/setup.bash ; source ~/simulation_ws/devel/setup.bash && roslaunch realrobotlab main.launch || echo “didnt work”!’)

Hello @r.franklinismail ,

Not a problem, don’t worry.