예제 #1
0
 def do_set(self, args):
     """set <CONFIG_PARAM> <NEW_VAL>
     Set a parameter in the configuration file to a new value."""
     arg_properties = [
         CLIArgumentProperty(str, None),
         CLIArgumentProperty(str, None)
     ]
     parsed_args = parse_cli_args(args, 'set', 2, arg_properties)
     key, new_val = parsed_args
     self.client.set(key, new_val)
예제 #2
0
 def do_startmotion(self, args):
     """startmotion <INITIAL AZIMUTH> <INITIAL ELEVATION>
     Sets the azimuth and elevation to the provided values and enables motion.
     """
     arg_properties = [
         CLIArgumentProperty(float, None),
         CLIArgumentProperty(float, None)
     ]
     parsed_args = parse_cli_args(args, 'startmotion', 2, arg_properties)
     az, el = parsed_args
     self.client.startmotion(az, el)
예제 #3
0
 def do_motortest(self, args):
     """motortest <EL | AZ> <ANGLE>
     Test the motors to plot their accuracy against the measured IMU values.
     """
     arg_properties = [
         CLIArgumentProperty(str, {'EL', 'AZ'}),
         CLIArgumentProperty(float, None)
     ]
     parsed_args = parse_cli_args(args, 'motortest', 2, arg_properties)
     motor, pos = parsed_args
     self.client.motor_test(motor, pos)
예제 #4
0
 def do_track(self, args):
     """track <SATELLITE_NAME>
     Tracks a satellite across the sky. Satellite data is taken from Active-Space-Stations file from Celestrak."""
     arg_properties = [CLIArgumentProperty(str, None)]
     parsed_args = parse_cli_args(args, 'track', 1, arg_properties)
     sat_name, = parsed_args
     self.client.track(sat_name)
예제 #5
0
 def do_switch(self, args):
     """switch <CONFIG_FILE>
     Switch to using a different config file."""
     arg_properties = [CLIArgumentProperty(str, None)]
     parsed_args = parse_cli_args(args, 'switch', 1, arg_properties)
     name, = parsed_args
     self.client.switch(name)
예제 #6
0
    def do_open(self, args):
        """open <TARGET>
        Open connection to device with given target. TARGET might be:
        - a serial port, e.g.       ttyUSB0, ser:/dev/ttyUSB0
        - a telnet host, e.g        tn:192.168.1.1 or tn:192.168.1.1,login,passwd
        - a websocket host, e.g.    ws:192.168.1.1 or ws:192.168.1.1,passwd
        """
        arg_properties = [
            CLIArgumentProperty(
                str,
                None
            )
        ]
        parsed_args = parse_cli_args(args, 'open', 1, arg_properties)
        port, = parsed_args
        if (
                not port.startswith("ser:/dev/")
                and not port.startswith("ser:COM")
                and not port.startswith("tn:")
                and not port.startswith("ws:")
        ):

            if platform.system() == "Windows":
                args = "ser:" + args
            else:
                args = "ser:/dev/" + args

        return self._connect(args)
예제 #7
0
 def do_antkontrol(self, args):
     """antkontrol <start | status>
     Create a new global AntKontrol instance or query the status of an existing one
     """
     arg_properties = [CLIArgumentProperty(str, {'start', 'status'})]
     parsed_args = parse_cli_args(args, 'antkontrol', 1, arg_properties)
     mode, = parsed_args
     self.client.antkontrol(mode)
예제 #8
0
 def do_elevation(self, args):
     """elevation <ELEVATION>
     Set the elevation to the level given in degrees by the first argument.
     """
     arg_properties = [CLIArgumentProperty(float, None)]
     parsed_args = parse_cli_args(args, 'elevation', 1, arg_properties)
     el, = parsed_args
     self.client.elevation(el)
예제 #9
0
 def do_setup(self, args):
     """setup <CONFIG_FILE>
     Interactive script to populate a config file.
     Switches to new config after finishing setup.
     To keep config persistent after reboots, name it "config.json"
     """
     arg_properties = [CLIArgumentProperty(str, None)]
     parsed_args = parse_cli_args(args, 'setup', 1, arg_properties)
     name, = parsed_args
     self.client.setup(name)
예제 #10
0
    def do_azimuth(self, args):
        """azimuth <AZIMUTH>
        Set the azimuth to the level given in degrees by the first argument.
        """
        # TODO: merge this function with do_elevation in one move command

        arg_properties = [CLIArgumentProperty(float, None)]
        parsed_args = parse_cli_args(args, 'azimuth', 1, arg_properties)
        az, = parsed_args
        self.client.azimuth(az)