Skip to content

Provides a ROS wrapper for the Snapdragon Navigator API

License

Notifications You must be signed in to change notification settings

ATLFlight/snav_ros

Repository files navigation

Qualcomm NavigatorTM Flight Controller ROS Example

Qualcomm NavigatorTM is a flight controller that runs on the Qualcomm FlightTM platform. Detailed information about its capabilities can be found on the Qualcomm Developer Network site.

This ROS-based example demonstrates how to interact with the flight controller using the Qualcomm NavigatorTM API. The flight stack uses the Machine Vision SDK's VISLAM feature to estimate the 6DOF pose, enabling accurate indoor localization of the drone. The 6DOF pose estimate and other useful data are published by this node.

This example assumes that you have a flyable Qualcomm-based drone (with RC/WiFi controller, ESC's, propellers, and Qualcomm Flight board) and are comfortable flying a drone.

Version Compatibility

The SNAV parameters in this repository are intended for particular versions of SNAV.

This README is for snav_ros version 2.0, compatible with Qualcomm Navigator v1.2.58. For previous versions, please see the table below

SNAV
Version
snav_ros
Version
1.2.58 2.0
1.2.38.1 1.1.1
1.2.31 1.0.0

Note that you must also recompile snav_ros when installing a new version of SNAV.

Table of Contents

  1. High-level block diagram
  2. Pre-requisites
  3. Clone and build example code
  4. Run example code
  5. Verification
  6. FAQ

High-level block diagram

snav_ros high-level block diagram

Pre-requisites

Hardware

This example requires the following hardware:

Note that if you're using the Dragon DDK, a URDF ros package is available at: qflight_descriptions

Software

To run the example, the following are needed:

Clone and build example code

Building for QFLight Pro

If you are using a QFlight Pro board (8096), you will build the code inside your development docker. Instructions can be found here:

QFlight Pro Buildi Instructions

After building and installing, you can skip to Run example code.

Setup ROS workspace on target

adb shell
source /home/linaro/.bashrc
mkdir -p /home/linaro/ros_ws/src
cd /home/linaro/ros_ws/src
catkin_init_workspace
cd ../
catkin_make
echo "source /home/linaro/ros_ws/devel/setup.bash" >> /home/linaro/.bashrc

This ensures that the ROS workspace is setup correctly.

Clone the sample code

  • The repo may be cloned from here directly on the target, or cloned on the host computer and then pushed to the target using ADB. The recommended method is to clone directly on the target.
adb shell
source /home/linaro/.bashrc
roscd
cd ../src
git clone https://github.com/ATLFlight/snav_ros.git
cd snav_ros
git submodule update --init

Install ROS dependencies

This package depends on other ROS packages to run. To install them, we'll use rosdep

roscd snav_ros
rosdep install . --from-paths

This requires an internet connection as it will install the rosdeps using aptitude.

If you get an apt error while trying to install the dependencies like this:

trying to overwrite '/usr/share/glib-2.0/schemas/gschema.dtd', which is also in package libglib-2.0-0 1:2.38.2-r0. this is while trying to install the dependency libglib2.0-dev_2.40.0-2_armhf.deb

then you will need to force dpkg to overwrite platform files with files from aptitude. To do that, run this command:

sudo apt-get -o Dpkg::Options::="--force-overwrite" –f install

Now re-run the rosdep install:

rosdep install . --from-paths

Build the code

cd /home/linaro/ros_ws
catkin_make

This will compile the executable snav_interface_node. This node uses the Qualcomm NavigatorTM API and therefore needs to be run as root. It is best if the linaro user can run this with root permissions, as this enables use of roslaunch. CMakelists.txt contains a custom command to run when building that sets the UID bit on the node. This allows it to run with root permission from any user. As long as you have password-less sudo access, building this code normally (with catkin_make) should enable roslaunch of the snav_ros node with appropriate permissions.

Run example code

This example assumes that the user is familiar with ROS framework. If you are new to ROS, refer to ROS Start Guide first to get started.

This assumes that the ROS build command is successful.

There is a launch file that will run the snav_interface_node and also start up roscore. To run:

roslaunch snav_ros snav_ros.launch

Take a look at the launch file to see what params are available.

Verification

Data from Qualcomm NavigatorTM such as the 6DOF pose can be viewed on a host machine running ROS.

On your workstation, assuming you have installed ROS, set up you environment variable to point to your target. These values assume you are in softap mode and your target has IP=192.168.1.1

export ROS_MASTER_URI=http://192.168.1.1:11311
export ROS_IP=192.168.1.77

Replace the value of ROS_IP with your real IP address of your workstation. After that, you can check that data is coming in. First, check out what topics are being published:

rostopic list

Use rostopic echo to verify that data is streaming. For example, to view the battery voltage in Volts:

rostopic echo /battery_voltage

To view the transforms being published:

rostopic echo /tf

These commands should show a stream of live data. If they do not, your ROS_IP env variable may need to be set on target. On the target, kill the roslaunch session and run:

export ROS_IP=192.168.1.1

This assumes softap mode. Rerun the launch file and try again. If everything is working:

rosrun rviz rviz

Now set the fixed_frame to "/vio/odom" and add a TF display type. Now watch the /base_link coordinate frame (vio estimate) move around as the quad moves!

FAQ

Why isn't snav_ros publishing anything?

Qualcomm NavigatorTM must be running before snav_ros is launched. If you see the following error messages:

Update checksum_failure. [f0eb75d8,0e5675fe] Possible RPC issue.
[ WARN] [8780.150406550]: sn_update_data failed, not publishing

there is a good chance that Qualcomm NavigatorTM is not running. Kill snav_ros and start Qualcomm NavigatorTM with the following command:

sudo start snav

and then relaunch snav_ros.