# Navigator WebAssistant

**URL:** <https://discuss.bluerobotics.com/t/navigator-webassistant/16029>\
**Category:** BlueOS\
**Created:** [February 15, 2024, 6:15pm UTC](https://discuss.bluerobotics.com/t/navigator-webassistant/16029 "2024-02-15T18:15:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaulTrombin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/raultrombin/32/11853_2.png) [@RaulTrombin](https://discuss.bluerobotics.com/u/RaulTrombin)\
**Post date:** [February 15, 2024, 6:15pm UTC](https://discuss.bluerobotics.com/t/navigator-webassistant/16029/1 "2024-02-15T18:15:43Z")

</div>

# Hello Blue Robotics Community! 🌊 🌊

We are excited to announce our new tool especially designed for our [Navigator flight controller](https://bluerobotics.com/new-product-the-navigator-flight-controller-and-blueos/), the ✨ [**`navigator-web-assistant`**](https://github.com/bluerobotics/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](https://developer.mozilla.org/en-US/docs/Glossary/REST) and [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications).

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](https://discuss.bluerobotics.com/t/navigator-library/14838) libraries, now we also have access to web-based services and supported languages such as [JavaScript](https://www.w3schools.com/js/js_examples.asp), [Flutter](https://docs.flutter.dev/), [Node-RED](https://nodered.org/), [Python (including pyscript!)](https://www.infoworld.com/article/3661628/intro-to-pyscript-run-python-in-your-web-browser.html), 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](https://blueos.cloud/docs/blueos/latest/advanced-usage/#extensions-manager):

 ![Navigator WebAssistant card in the BlueOS Extensions Manager](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/5/5ff11883486811acdd3e469d564897cb8f2d6b82.png)

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](https://github.com/bluerobotics/navigator-web-assistant).

 ![Swagger UI for REST API exploration and documentaiton](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/0/07f10e80a99a90e6b355f344272063eabfe4ef59.png)  
 ![Minimal dashboard for viewing live sensor values and controlling PWM outputs](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/4/4d459591912304c1e87a4c48c1599cb9236f05fd.png)

## Try it with Node-RED

📦 If you also install the [Node-RED extension](https://docs.bluerobotics.com/BlueOS-Extensions-Repository/#:~:text=Node%2DRED,-Maintainer), you can interface with the Navigator WebAssistant extension using block code elements and create custom dashboards:

 ![Node-RED card in the BlueOS Extensions Manager](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/3/314484ea9e2338a73483702c2c7f2df9e836c9df.png)

Node-RED requires the [`node-red-contrib-br_navigator-webassistant`](https://flows.nodered.org/node/node-red-contrib-br_navigator-webassistant) package to be installed through its palette manager ([see detailed instructions](https://github.com/RaulTrombin/node-red-contrib-br_navigator-webassistant#usage)).

> **Note:** the package provides an example that includes a fully Node-RED based dashboard, which requires installing the [`node-red-dashboard`](https://flows.nodered.org/node/node-red-dashboard) package to view.

 ![Node-RED flow example showcasing the navigator webassistant package components](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/7/7802c6f9ae08a26a379e566afb6a75ca43e341c1.png)  
 ![Node-RED based dashboard showing graphs of sensor data over time](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/d/dfcaef8a549ca249b09a3177da1c3483ea66b68f.png)

## Try it with Python

📦 The [Jupyter extension](https://docs.bluerobotics.com/BlueOS-Extensions-Repository/#:~:text=Jupyter,-Maintainer) allows interfacing with with the Navigator WebAssistant using Python code in a Jupyter notebook:

 ![Jupyter card in the BlueOS Extensions Manager](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/0/00b70e704958c9015ff2e4a67ee1d3edee82f93a.png)

 ![The Jupyter BlueOS Extension interface, showing a Navigator WebAssistant example](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/5/574312dc7f6254df6dbc9b01449fe8f3e2bfc206.png)

## Try it with JavaScript

📦 The [VS Code extension](https://docs.bluerobotics.com/BlueOS-Extensions-Repository/#:~:text=OpenVSCoder,-Maintainer) provides a general programming environment, and can be used to interface with the WebAssistant using JavaScript (and other languages):

 ![VS Code card in the BlueOS Extensions Manager](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/f/f83c49354f39cc0ce8359820182feade0f06ad7e.png)

```js
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:

 ![Flowchart showing the path from Navigator Hardware to solutions, including the new options made available through the WebAssistant](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/9/97329ef05d269f01639ce15a0cfa6ddd6149799e.png)

### In BlueOS (Recommended)

1. Open the [Autopilot Firmware](https://blueos.cloud/docs/blueos/latest/advanced-usage/#autopilot-firmware) page, enable [Pirate Mode](https://blueos.cloud/docs/blueos/latest/advanced-usage/#pirate-mode), and “change board” to SITL
  - This stops the autopilot firmware from trying to operate while the WebAssistant is in use

2. [Reboot](https://blueos.cloud/docs/blueos/latest/advanced-usage/#power) 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

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [February 29, 2024, 7:30pm UTC](https://discuss.bluerobotics.com/t/navigator-webassistant/16029/4 "2024-02-29T19:30:39Z")

</div>


