atstest.py 1.01 KB
Newer Older
PERNOT Guillaume's avatar
PERNOT Guillaume committed
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 31 32 33 34 35 36
import cmd
import time


class ATS_Shell(cmd.Cmd, object):
    intro = """    ____  ________  __   _____
   / __ \/_  __/ / / /  / ___/____  ____  ________
  / / / / / / / / / /   \__ \/ __ \/ __ `/ ___/ _ \\
 / /_/ / / / / /_/ /   ___/ / /_/ / /_/ / /__/  __/
/_____/ /_/  \____/   /____/ .___/\__,_/\___/\___/
                          /_/                      """
    intro += '\nWelcome to the ATS shell Rev.2. Type help or ? to list commands.\n'

    prompt = 'ATS>'
    file = None

    def __init__(self, config=None):
        # Initialize the superclass
        super().__init__()

    def do_stop(self, arg):
        """ Immediately stops any movement """
        print('STOP')

    def do_get_enc_position(self, arg):
        """ Returns the current encoder position corrected for origin offset """
        print('-1.1,2.2,-3.3,4.4,-5.5')

    def do_wait_move(self, arg):
        time.sleep(2)

if __name__ == "__main__":

    # TODO: Make option for loading a configuration file
    shell = ATS_Shell()
    shell.cmdloop()