The NavQPlus may be considered a generic embedded Linux Computer. When running Ubuntu POC, most linux packages may be installed using apt or apt-get. As with any Linux machine not all packages are suited to the specific hardware.
There is also specific emablement related to the i.MX 8M Plus SOC chip that is used. Please refer to NXP.com for more details. This includes things like hardware acclerated video using gstreamer and hardware accelerated neural net processing using eIQ on the NPU module. Note that the MR-B3RB documentation will demonstrate the usage of NavQPlus as a Robotic platform running ROS and is considered one of our reference development tools. Following the software guides there may be preferable, and provide more detail.
If using an downloaded image, check first that these packages are not already installed.
Below are short examples of using openCV. Refer to NXP.com or other guides for more detail.
You may find more complete application examples in the MR-B3RB documentation
To install OpenCV for Python to the image, run the following command:
To access the Google Coral Camera(s) on NavQ+ in OpenCV, you may use the following VideoCapture instantiation:
You may change the source resolution by editing the width and height values in the GStreamer pipeline. See below for a list of supported resolutions and framerates.
Controlling a NavQPlus with an HTML WebServer
This is an example of how to use a Webserver running locally on the NavQPlus. Note that this is one of several methods available. In this example the idea is to control the robot (or anything), using low level commands written with shell scripts commanded from an HTML page. By not using a higher level language such as Python it helps make the robot responsive and quick to act.
A WebServer is used to control the NavQPlus using low level commands written with shell scripts commanded straight from a HTML page. This page will explain how to set-up a WebServer and control your NAVQ+.
The webserver we will use is called Lighttpd
, for more information on the Lighttpd read the following link:
First step is to install Lighttpd WebServer and components. Use the following code in your NAVQ+ serial console application:
This is the output you should receive after running all three codes above:
Lighttpd is looking for an index.html page at /var/www/html. We will change it, so the index.html will be placed under /var/www. For that, we must edit the Lighttpd config file using nano (if you do not have nano see this chapter):
In this file you should change:
To:
I personally did not have to change the file location. Not sure why
It should look something like this:
Then exit the file and save. For the changes we made just now to take effect, we must reboot the web server. To do that enter both commands in order:
At this point the web server is running and if a page index.html is located at /var/www, we can access it from any browser, typing the NAVQ+ address you can see the default web page by lighttpd. Get the NavQ+ IP address and input it into your browser search bar.
Now let's try and place an example template webpage and access it.
Stop the server for the next few steps.
Clone the following repository to somewhere where you will remember in your home file.
After cloning the repository, you will copy some of the files to /var/www. This can be done with these commands:
Now access the page again using the IP address of your NavQPlus, you should get this:
You have managed to make a simple webserver. This webpage can be quite useful to use as a GUI for robot controls as displayed in the example page above.
I2C configuration and setup
If not already present, the first step is to install the I2C tools to be able to use the I2C ports.
To use the I2C commands without root, you'll need to add the NavQ+ user to the i2c group. To do this, you can run the following command:
Now to check the connection and confirm that the port is working correctly. Connect something to the I2C JST-GH port, then run the command below. It shoudl show you raw output from most devices connected on the I2C bus(es). Note that the onboard NXP secure element SE05x will not respond to this command.
The link below is a 3rd party example that shows the use of I2C from one of the NXP HoverGames participants.