コード例 #1
0
def main():
	"""
	Function that gets executed when the script is directly
	called from the command line.

	It sets the PID constants for the Mosquito 90
	"""
	m = mapi.Mosquito()
	m.connect()

	RATE_ROLL_P = 0.05
	RATE_ROLL_I = 0.40
	RATE_ROLL_D = 0.0001

	RATE_PITCH_P = 0.05
	RATE_PITCH_I = 0.55
	RATE_PITCH_D = 0.0001

	RATE_YAW_P = 0.05
	RATE_YAW_I = 0.40

	RATE_D2R = 6.00

	LEVEL_P = 1.00

	ALTH_P = 0.0
	ALTH_V_P = 0.0
	ALTH_V_I = 0.0
	ALTH_V_D = 0.0
	ALTH_MIN_A = 0.0

	PARAM_6 = 1.0
	PARAM_7 = 2.0
	PARAM_8 = 3.0
	PARAM_9 = 4.0

	m.set_mosquito_version(True)
	m.set_position_board(True)
	m.set_PID(RATE_ROLL_P, RATE_ROLL_I, RATE_ROLL_D,RATE_PITCH_P, RATE_PITCH_I, RATE_PITCH_D, RATE_YAW_P, RATE_YAW_I, RATE_D2R, LEVEL_P, ALTH_P, ALTH_V_P, ALTH_V_I, ALTH_V_D, ALTH_MIN_A, PARAM_6, PARAM_7, PARAM_8, PARAM_9)

	m.get_PID()

	m.disconnect()
コード例 #2
0
def main():
    """
	Function that gets executed when the script is directly
	called from the command line.

	What it does is set on and off the LEDs of the board at
	2 seconds intervals
	"""
    Mosquito = mapi.Mosquito()
    Mosquito.connect()

    # turn on and off the LEDs of the board at 2 second intervals
    # Note how, since the method expects keyword arguments, the order
    # in which they are passed doesn't matter. If any of the LEDs is
    # omitted its current status is preserved
    Mosquito.set_leds(red=0, green=0, blue=0)

    print("Turning on blue Led...")
    Mosquito.set_leds(blue=1)  # The status of the other LEDs is preserved
    time.sleep(2)
    Mosquito.set_leds(blue=0)

    print("Turning on red Led...")
    Mosquito.set_leds(red=1)
    time.sleep(2)
    Mosquito.set_leds(red=0)

    print("Turning on green Led...")
    Mosquito.set_leds(green=1)
    time.sleep(2)
    Mosquito.set_leds(green=0)

    print("Turning on all three Leds...")
    Mosquito.set_leds(blue=1, red=1, green=1)
    time.sleep(2)
    Mosquito.set_leds(blue=0, red=0, green=0)

    time.sleep(0.1)

    # Disconnect from the mosquito when finished
    Mosquito.disconnect()
コード例 #3
0
	def __init__(self):
		"""
		Initialize the TX Calibration class
		"""
		self.__calibration = False
		self.Mosquito = mapi.Mosquito()