Skip to content

Import Setup and Init

Ben Rexwinkel edited this page May 20, 2015 · 9 revisions

Importing

 >>> import navio
 >>> # import the constants you need. Check 
 ... # navio.__dict__ for all available options.
 >>> from navio import RPI_MODEL_A, BANANA_PI, BIT_COMPONENTS_GPS, BIT_COMPONENTS_IMU, NAVIO_RAW

Setup and Initialization

navio.Navio(rpi_model = RPI_MODEL_B_2, navio_model = NAVIO_PLUS, rc_input_signal = RC_MODE_PPM, enabled_components = BIT_COMPONENTS_ALL)

Create an instance of the Navio class. Only one instance should exist at a time. If you try to create another instance, you will instead get a reference to the already created one.

 >>> nio = navio.Navio()               # for RPi 2 model B (default)
 >>> # OR
 >>> nio = navio.Navio(RPI_MODEL_A)    # for RPi model A
 >>> # OR
 >>> nio = navio.Navio(BANANA_PI)      # for Banana Pi
 >>> # OR
 >>> # Rpi model A, Navio RAW, only enable GPS and PPM:
 >>> nio = navio.Navio(rpi_model=RPI_MODEL_A, navio_model=NAVIO_RAW, rc_input_signal=RC_MODE_PPM, enabled_components=BIT_COMPONENTS_GPS|BIT_COMPONENTS_PPM)
 >>> # etc.
Constants
rpi_model

RPI_MODEL_A
RPI_MODEL_A_PLUS
RPI_MODEL_B
RPI_MODEL_B_PLUS
RPI_MODEL_B_2
BANANA_PI

navio_model

NAVIO
NAVIO_RAW
NAVIO_PLUS

enabled_components

BIT_COMPONENTS_GPS
BIT_COMPONENTS_IMU
BIT_COMPONENTS_BARO
BIT_COMPONENTS_PWM
BIT_COMPONENTS_ADC
BIT_COMPONENTS_FRAM
BIT_COMPONENTS_PPM
BIT_COMPONENTS_ALL

rc_input_signal

RC_MODE_PPM
RC_MODE_PPM_RAW
RC_MODE_SBUS