Skip to content

Import Setup and Init

bennierex edited this page May 1, 2015 · 9 revisions

Python-Navio

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

Setup and Initialization

navio.Navio(rpi_model = RPI_MODEL_B_2, 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
>>> # model A, only enable GPS and IMU:
>>> nio = navio.Navio(rpi_model=RPI_MODEL_A, enabled_components=BIT_COMPONENTS_GPS|BIT_COMPONENTS_IMU)
>>> # etc.
Constants
rpi_model

RPI_MODEL_A
RPI_MODEL_A_PLUS
RPI_MODEL_B
RPI_MODEL_B_PLUS
RPI_MODEL_B_2
BANANA_PI

enabled_components

BIT_COMPONENTS_GPS
BIT_COMPONENTS_IMU
BIT_COMPONENTS_BARO
BIT_COMPONENTS_PWM
BIT_COMPONENTS_ADC
BIT_COMPONENTS_FRAM
BIT_COMPONENTS_ALL

Clone this wiki locally