Пример #1
0
def main():
    if len(sys.argv) < 2:
        print("Serial not specified")
        return

    path = sys.argv[1]
    if not Path(path).exists():
        print("Not found:", sys.argv[1])
        return

    cli = CLI(path)
    sensitive = get_sensitive(cli, 'acceleration')

    try:
        data = collect(cli)
        bias = [
            (data[Attitude.ROLL_LEFT] + data[Attitude.ROLL_RIGHT]) / 2,
            (data[Attitude.PITCH_DOWN] + data[Attitude.PITCH_UP]) / 2,
            (data[Attitude.FLAT] + data[Attitude.REVERSE]) / 2,
        ]
        gain = [
            sensitive * sensitive / (data[Attitude.ROLL_RIGHT] - bias[0]),
            sensitive * sensitive / (data[Attitude.PITCH_UP] - bias[1]),
            sensitive * sensitive / (data[Attitude.REVERSE] - bias[2]),
        ]
        print("bias:", bias)
        print("gain:", gain)
    except EOFError:
        pass

    cli.close()
Пример #2
0
def main():
    if len(sys.argv) < 2:
        print("Serial not specified")
        return

    path = sys.argv[1]
    if not Path(path).exists():
        print("Not found:", sys.argv[1])
        return

    cli = CLI(path)
    print(cli.tx('telemetry'))
    cli.close()