示例#1
0
 def do_pwmtest(self, args):
     """pwmtest
     Return some diagnostic data that may be helpful in connecting a PCA9685 device.
     """
     arg_properties = []
     _ = parse_cli_args(args, 'pwmtest', 0, arg_properties)
     self.client.pwm_test()
示例#2
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)
示例#3
0
 def do_bnotest(self, args):
     """bnotest
     Return some diagnostic data that may be helpful in connecting a BNO055 device.
     """
     arg_properties = []
     _ = parse_cli_args(args, 'bnotest', 0, arg_properties)
     self.client.bno_test()
示例#4
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)
示例#5
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)
示例#6
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)
示例#7
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)
示例#8
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)
示例#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)
示例#11
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)
示例#12
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)
示例#13
0
 def do_calibrate(self, args):
     """calibrate
     Detect IMU calibration status and provide instructions on how to
     calibrate if necessary. If calibration is necessary, wait for the user
     to calibrate the device and cease waiting once all sensors are
     calibrated. Regardless of whether calibration is necessary or not, save
     the calibration profile to the config at the end.
     """
     arg_properties = []
     parsed_args = parse_cli_args(args, 'calibrate', 0, arg_properties)
     self.client.calibrate()