def main(): debug = int(os.environ.get("DEBUG", 0)) launcher.set_debug_level(debug) if "MACHINEKIT_INI" not in os.environ: # export for package installs mkconfig = config.Config() os.environ["MACHINEKIT_INI"] = mkconfig.MACHINEKIT_INI hal_mgr = HalMgr() try: hal_mgr.start() hal_mgr.loop() except subprocess.CalledProcessError as e: hal_mgr.shutdown("Process error: %s" % e, 1) except rospy.ROSInterruptException as e: hal_mgr.shutdown("Interrupt: %s" % e, 0) else: hal_mgr.shutdown("Shutting down", 0)
#!/usr/bin/python import sys import os import subprocess import importlib import argparse import time from machinekit import launcher from machinekit import config launcher.set_debug_level(5) def check_mklaucher(): try: subprocess.check_output(['pgrep', 'mklauncher']) return True except subprocess.CalledProcessError: return False os.chdir(os.path.dirname(os.path.realpath(__file__))) c = config.Config() os.environ["MACHINEKIT_INI"] = c.MACHINEKIT_INI parser = argparse.ArgumentParser( description='This is the Replicookie-soc run script ' 'it demonstrates how a run script could look like ' 'and of course starts the Replicookie config')
#!/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 # Uncomment and modify the following line if you create a configuration for the BeagleBone Black #launcher.load_bbio_file('cape-universal') launcher.load_bbio_file('cramps_cape.bbio') # load a BeagleBone Black universal overlay file # Uncomment and modify the following line of you have custom HAL components # launcher.install_comp('gantry.comp') # install a comp HAL component if not already installed launcher.start_process("configserver ~/Machineface") # start the configserver with Machineface an Cetus user interfaces launcher.start_process('machinekit -k ~/machinekit/configs/ARM.BeagleBone.CRAMPS/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
parser = argparse.ArgumentParser(description='This is the CRAMPS2 run script ' 'it demonstrates how a run script could look like ' 'and of course starts the CRAMPS2 config') parser.add_argument('-v', '--video', help='Starts the video server', action='store_true') parser.add_argument('-d', '--debug', help='debug level', type=int, choices=[0 , 1, 2, 3, 4, 5]) args = parser.parse_args() try: launcher.check_installation() # make sure the Machinekit installation is sane launcher.cleanup_session() # cleanup a previous session # set debug level if args.debug: launcher.set_debug_level(args.debug) launcher.load_bbio_file('cramps.bbio') # load a BBB universal overlay launcher.install_comp('thermistor_check.comp') launcher.start_process('configserver -d -n RIGIDBOT ~/ui') # start the configserver # if args.video: # launcher.start_process('videoserver --ini video.ini Webcam1') launcher.start_process('machinekit -vd CRAMPS.ini') # start linuxcnc except subprocess.CalledProcessError: launcher.end_session() sys.exit(1)