This repo contains a number of example programs for interfacing with the Qualcomm Snapdragon NavigatorTM API. This assumes you have access to the appropriate Qualcomm Snapdragon Flight development hardware as well as the latest version of Snapdragon NavigatorTM.
- Obtain the most recent version of Snapdragon NavigatorTM from the Qualcomm Developer Network site and install the package on your device using the instructions in the User Guide.
- Clone this repo:
git clone https://github.com/ATLFlight/snav_api_examples.git
- If appropriate, copy the repo to your device. If you cloned the repo on your device itself, you can skip this step. If you cloned the repo on a host machine, copy the files over using a USB cable and
adb
. For example, from this repo's root directory run: adb shell "mkdir -p /home/linaro/examples"
adb push . /home/linaro/examples
- Login to your device either through
adb
(adb shell
) or via the network (e.g.ssh username@deviceip
) and navigate to your examples directory. In our case, this is/home/linaro/examples
- To compile the example programs, run
make
. You should see a series of compilation lines, e.g.gcc -Wall -I/usr/include/snav ...
for each example program. - The example binaries are placed in the
build
subdirectory. Each is described in more detail below.
To run an example, navigate to the build
directory. Here, the binaries can be executed directly--e.g. ./snav_read_attitude
. Each example is described in detail below:
snav_read_attitude
:- Usage:
./snav_read_attitude
- Result: this prints the roll, pitch, and yaw angles (in radians) as estimated by Snapdragon NavigatorTM.
- Usage:
snav_read_gps_raw
:- Usage:
./snav_read_gps_raw
- Result: When a GPS unit is attached and a fix has been acquired, this prints timing, location, altitude, and velocity measurements.
- Usage:
snav_read_sonar
:- Usage:
./snav_read_sonar
- Result: This prints the raw sonar range measurement in meters.
- Usage:
snav_send_esc_commands
- Warning: This will spin the motors, if attached. Please use with caution.
- Usage:
./snav_send_esc_commands
- Result: This will set the ESC LED colors and spin each motor to a low RPM in round-robin fashion.
snav_send_esc_commands_keybaord
- Usage:
./snav_send_esc_commands_keybaord [mode]
[mode]
is one of-r
for RPM mode or-p
for PWM mode.- Once running, the keybindings are:
=
: increase PWM/RPM-
: decrease PWM/RPM]
: increase PWM by 5[
: decrease PWM by 5Q
: quit
- Usage:
snav_send_led_colors
:- Usage:
./snav_send_led_colors
- Result: sets the ESC LEDs to a few different colors
- Usage:
snav_test_receive_data
:- Usage:
./snav_test_receive_data
- Result: Initially prints command min and max values, then loops continuously printing a number of different params reported by Snapdragon NavigatorTM.
- Usage:
Attitude estimation requires a calibrated IMU. You need to run the on-ground accelerometer calibration before attempting to read the attitude for the first time. Refer to the Snapdragon NavigatorTM User Guide for more information on sensor calibration procedures.
Contributing is encouraged! In order to contribute, we recommend the following procedure:
- Fork this repo
- Create a new branch, e.g.
git checkout -b feature/new_feature
- Commit and push changes to your forked repo:
git add
each changed file / foldergit commit -m "commit message"
git push origin feature/new_feature
- Submit a pull request to initiate code review.