/
run.py
executable file
·31 lines (25 loc) · 980 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python
import sys
import os
import subprocess
import importlib
from machinekit import launcher
from time import *
launcher.register_exit_handler()
launcher.set_debug_level(5)
os.chdir(os.path.dirname(os.path.realpath(__file__)))
try:
launcher.check_installation() # make sure the Machinekit installation is sane
launcher.cleanup_session() # cleanup a previous session
launcher.load_bbio_file('cramps2_cape.bbio') # load a BBB universal overlay
launcher.start_process("configserver -n SmartCore ~/Machineface ~/Cetus/") # start the configserver with Machineface an Cetus user interfaces
launcher.start_process('linuxcnc CRAMPS.ini') # start linuxcnc
except subprocess.CalledProcessError:
launcher.end_session()
sys.exit(1)
# loop until script receives exit signal
# or one of the started applications exited incorrectly
# cleanup is done automatically
while True:
sleep(1)
launcher.check_processes()