Hello Blue Robotics Community!
We are excited to announce our new tool especially designed for our Navigator flight controller, the navigator-web-assistant
!
Navigator Web Assistant is a web server that enables using the Navigator hardware with web technologies. You can run it directly on the Raspberry Pi and control your hardware from a web page, or create your own application using REST APIs and WebSockets.
Now, you can develop your own projects, extensions, and solutions, accessing the vehicle hardware using web technologies!
While previously hardware access required using our Rust, C++, and Python libraries, now we also have access to web-based services and supported languages such as JavaScript, Flutter, Node-RED, Python (including pyscript!), and others that can harvest the power of our RestAPI and Websockets.
The easiest way to try Navigator WebAssistant is by installing its BlueOS Extension from the BlueOS Extensions manager:
With this extension you can directly read data from sensors and control the output PWM values, and there’s included documentation (with a Swagger UI) that allows exploring and testing the available API endpoints. The WebSocket follows the same pattern as shown on the GitHub project page.
Try it with Node-RED
If you also install the Node-RED extension, you can interface with the Navigator WebAssistant extension using block code elements and create custom dashboards:
Node-RED requires the node-red-contrib-br_navigator-webassistant
package to be installed through its palette manager (see detailed instructions).
Note: the package provides an example that includes a fully Node-RED based dashboard, which requires installing the
node-red-dashboard
package to view.
Try it with Python
The Jupyter extension allows interfacing with with the Navigator WebAssistant using Python code in a Jupyter notebook:
Try it with JavaScript
The VS Code extension provides a general programming environment, and can be used to interface with the WebAssistant using JavaScript (and other languages):
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
const url = "ws://192.168.15.200:32770/ws";
const WebSocket = require('ws');
const ws = new WebSocket(url);
ws.onopen = function () {
console.log("Connection established!");
};
ws.onmessage = function (event) {
const message = event.data;
const data = JSON.parse(message);
console.log(data);
for (var element of data.input) {
if ("Temperature" == element.type) {
console.log(`Found: ${JSON.stringify(element)}`);
}
}
};
Navigator Development Options
Navigator Web Assistant now allows you to control the Navigator hardware using web services. The following chart provides an overview of how the available libraries and languages can be used used:
In BlueOS (Recommended)
- Open the Autopilot Firmware page, enable Pirate Mode, and “change board” to SITL
- This stops the autopilot firmware from trying to operate while the WebAssistant is in use
- Reboot the vehicle computer, and wait for the interface to re-connect
Note: Since this library access the Navigator hardware, it can´t run in parallel with ArduPilot.
If you are running ArduPilot, be sure to disable it or set the board as SITL (Software Simulation) before running Navigator WebAssistant