Giter VIP home page Giter VIP logo

mavcesium's Introduction

MAVCesium - An experimental web based map display for MAVProxy based on Cesium

UPDATE

This project is currently being re-written from the ground up with a reactive javascript framework (vue js) and graphql for communication. It is being integrated into a new web based GCS, designed to configure and control many decentralised vehicles simultaneously. If you would like to learn more about where we are taking this project go to https://github.com/goodrobots/maverick-web or say hello in our developer gitter channel https://gitter.im/goodrobots/dev.

Notes: Your browser will need to support webgl and web sockets. Please view on a desktop machine as the application does not currently support responsive layouts.

About the project

As a ground control station operator I often find myself wishing MAVProxy had a more intuitive way of displaying an air vehicle attitude and position. This project uses Cesium to display the position and attitude information being received by a MAVProxy ground station in real time.

Note: MAVCesium can now run stand alone from MAVProxy. See this issue if you would like to know more.

Video

Demo Video]

Screenshots

screenshot 1 of webapp screenshot 2 of webapp screenshot 3 of webapp

Development

Although currently under development, this module provides a usable position and attitude display, HUD, geofence display and limited mission display capabilities.

On the TODO list...

  • Improved mission display and planning capabilities
  • Real time visualisation of sensor footprints and data feeds (video and image)
  • Support for custom digital elevation maps
  • Support for custom ground imagery
  • Log playback from .tlog and .bin files
  • Support responsive layouts
  • etc...

Development is being undertaken on a Ubuntu 16.04 x64 machine and has been tested on a 14.04 x64 machine. As the (few) dependencies are pure python I expect it will install and run on a windows machine, however this is currently untested.

How it works

When you load the MAVCesium module a single tornado server is created. This server handles handles static data requests while also streaming JSON between MAVProxy and your webgl enabled browser, driving the display.

The display is updated only as new data is received via the telemetry stream, so the faster the telemetry stream the 'smoother' the display update will be.

Getting it running

The following assumes that you have already installed the requirements for MAVProxy

  • Install the python dependencies for MAVCesium located in requirements.txt via pip

  • MAVCesium is avalable as a git submodule of MAVProxy. If you already have an existing MAVProxy repository setup, you can initialise the MAVCesium module by running the following in your MAVProxy base directory:

git submodule init
git submodule update

Otherwise if you would like to clone MAVProxy and get the MAVCesium module at the same time you can run the following command:

git clone --recursive https://github.com/ArduPilot/MAVProxy.git

You can then install MAVProxy as per the developer guide:

cd MAVProxy
python setup.py build install --user
  • Run MAVProxy and load the MAVCesium module with the module load cesium command in the MAVProxy console

  • Point your webgl enabled browser to http://127.0.0.1:5000/mavcesium/ and once you start receiving valid mavlink messages from the vehicle connected to the MAVProxy ground station you will see the vehicle model in the center of your screen with a HUD overlay

  • If you have other computers / tablets / ipads on your network you can also open webgl capable browsers on them and point it to the network facing IP address of the computer that MAVProxy is running on.

  • For bonus points replace the Griffon Aerospace MQM-170 Outlaw gltf model with something that resembles your air vehicle! You can convert .dae models to .gltf using this online tool

Module usage

The top bar of the MAVCesium display contains similar data to the MAVProxy map. Here you will find the cursor lat, lon, alt and information on left click positions. You can access the context menu via single right click, while camera controls and settings can be found in the upper right of the screen. HUD overlay visibility can be toggled by pressing h when the MAVCesium display is active and can be made smaller via a button in the settings menu.

Further documentation is under construction here

If you get it running or find it useful let me know :) Issues and pull requests welcome!

Credits

Some of the other projects which go into MAVCesium are: Cesium MAVProxy Ardupilot tornado jQuery Bootstrap Font Awesome

mavcesium's People

Contributors

samueldudley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mavcesium's Issues

Websocket address logic faulty

The new config parsing in master sets websocket address to the server bind address+port. The default bind address is 0.0.0.0, which is a good thing. However this then makes the browser attempt to connect to websocket over ws://0.0.0.0:5000/ws which is bogus.

WEBSOCKET = "ws://"+SERVER_INTERFACE+":"+SERVER_PORT+"/ws"

Perhaps a better method might be something like this:

        var websocket = '{{ websocket }}';
        if (/0.0.0.0/.test(websocket) || /localhost/.test(websocket)) {
          websocket = ("ws://" + window.location.hostname + ":" + window.location.port + "/ws");
        }

Or perhaps even better would be to make WEBSOCKET an optional configuration item and use it if set, otherwise by default construct the websocket address:

        var websocket = '{{ websocket }}';
        if (!websocket) {
          websocket = ("ws://" + window.location.hostname + ":" + window.location.port + "/ws");
        }

Perspective text corruption

There is some distorted perspective looking text on the screen at all times, see screenshot.
Browser: Chrome 58
OS: MacOS 10.12.4
Hardware: Macbook Pro Intel Graphics

screen shot 2017-05-14 at 06 31 52

3D map not loading

As mentioned in #32 the internet connection is on yet the map is not loading.
I used ArduPilot SITL:
./sim_vehicle.py -v ArduPlane --console
after that:
module load cesium
Tornado server started on http://0.0.0.0:5000/mavcesium/

Am I doing something wrong? why the map is not loading?

Provide user feedback when waiting for mavlink data

This issue is related to #4

The servers need to launch and provide some sort of helpful feedback to the user prior to receiving mavlink data. e.g. Display the cesium globe with text "waiting for mavlink data..." or similar.

Error running module

Hello
I get an error when I run the module

Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mohammad/.local/lib/python3.8/site-packages/MAVProxy-1.8.39-py3.8.egg/MAVProxy/modules/mavproxy_cesium/app/cesium_web_server.py", line 141, in main
  File "/home/mohammad/.local/lib/python3.8/site-packages/MAVProxy-1.8.39-py3.8.egg/MAVProxy/modules/mavproxy_cesium/app/cesium_web_server.py", line 104, in start_app
  File "/home/mohammad/.local/lib/python3.8/site-packages/tornado-6.2.dev1-py3.8-linux-x86_64.egg/tornado/tcpserver.py", line 152, in listen
    self.add_sockets(sockets)
  File "/home/mohammad/.local/lib/python3.8/site-packages/tornado-6.2.dev1-py3.8-linux-x86_64.egg/tornado/tcpserver.py", line 165, in add_sockets
    self._handlers[sock.fileno()] = add_accept_handler(
  File "/home/mohammad/.local/lib/python3.8/site-packages/tornado-6.2.dev1-py3.8-linux-x86_64.egg/tornado/netutil.py", line 246, in add_accept_handler
    io_loop = IOLoop.current()
  File "/home/mohammad/.local/lib/python3.8/site-packages/tornado-6.2.dev1-py3.8-linux-x86_64.egg/tornado/ioloop.py", line 264, in current
    loop = asyncio.get_event_loop()
  File "/usr/lib/python3.8/asyncio/events.py", line 639, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'Thread-1'.



Editable HTML and JS files

After successfully loaded this app, I found out that after making changes to the HTML file and other JS files, it does not reflect when running the app. Is it that it is not possible to make changes or modify the HTML and JS files?

Can't restart cesium

Can't unload and load cesium module from mavproxy.

dule reload cesium
MANUAL> WebSocket connection closed: connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
Unloaded module cesium
MAVCesium display loaded at http://192.168.1.175:6790/
Reloaded module cesium
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1193, in run
    self.startRunning(installSignalHandlers=installSignalHandlers)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1173, in startRunning
    ReactorBase.startRunning(self)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 684, in startRunning
    raise error.ReactorNotRestartable()
ReactorNotRestartable
MANUAL> module unload cesium
MANUAL> Unloaded module cesium

MANUAL> module load cesium
MANUAL> ERROR in command ['load', 'cesium']: Couldn't listen on 192.168.1.175:6790: [Errno 98] Address already in use.

PX4 Support

How can we get this working with PX4? Would be good to have it on both stacks and the majority of the mav messages are common. Happy to help.

Extraction location for python eggs

When the files from the web application are extracted the following warning occurs:

/usr/lib/python2.7/dist-packages/pkg_resources.py:1031: UserWarning: /home/uas/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
warnings.warn(msg, UserWarning)

As I see it there are a few ways to handle this warning:

  1. Change the permissions for ~/.python-eggs with chmod g-wx,o-wx ~/.python-eggs
  2. Set the extraction path to a user defined location at runtime via .set_extraction_path or PYTHON_EGG_CACHE
  3. Suppress / ignore it

I'm not sure if this is an issue on Windows, but option 1 wont work for that use case.

Feature requests to improve usefullness

Please consider adding :
-wind speed & direction. (numerical with an arrow ?)
-xtrack and altitude error
heading, bearing , and next few waypoints
in the the mockup below heading is not very relevant, but in other views it may be.

Together, viewing turns with targets (WP right in the map) - would make it easy to evaluate turns when tuning.
screenshot from 2017-02-13 11-01-43

README.md is out of date and live demo is down

The project is no longer using Flask or autobahn and the live demo server has been re purposed for a different project.

What needs to be done:

  • Update the docs / readme to reflect the use of tornado as the server
  • Bring a live demo of the system online using a new server

Possible to run SITL

Hi, are is there a way to load cesium module from MAVProxy running with SITL?

ConfigParser instance has no attribute 'read_file'

Hello there, i was trying to load the cesium module but i got this error like this, there's an error say that the configparser didn't have attribute 'read_file', how can i fix this ?, this is the error line

Failed to use config file at C:\Python27\lib\site-packages\MAVProxy\modules\mavproxy_cesium\app\mavcesium_default.ini : ConfigParser instance has no attribute 'read_file'
ERROR in command ['load', 'cesium']: 'Configuration' object has no attribute 'MODULE_DEBUG'
Traceback (most recent call last):
  File "mavproxy.py", line 521, in process_stdin
    fn(args[1:])
  File "mavproxy.py", line 343, in cmd_module
    load_module(modname, **kwargs)
  File "mavproxy.py", line 296, in load_module
    module = m.init(mpstate, **kwargs)
  File "C:\Python27\lib\site-packages\MAVProxy\modules\mavproxy_cesium\__init__.py", line 243, in init
    return CesiumModule(mpstate, **kwargs)
  File "C:\Python27\lib\site-packages\MAVProxy\modules\mavproxy_cesium\__init__.py", line 49, in __init__
    ('debug', bool, self.config.MODULE_DEBUG)])
AttributeError: 'Configuration' object has no attribute 'MODULE_DEBUG'

thx

16.04 mate throws unexpected keyword argument 'root_path'

Traceback (most recent call last):
File "/usr/local/bin/mavproxy.py", line 491, in process_stdin
fn(args[1:])
File "/usr/local/bin/mavproxy.py", line 319, in cmd_module
load_module(args[1])
File "/usr/local/bin/mavproxy.py", line 277, in load_module
module = m.init(mpstate)
File "build/bdist.linux-x86_64/egg/MAVProxy/modules/mavproxy_cesium/init.py", line 266, in init
return CesiumModule(mpstate)
File "build/bdist.linux-x86_64/egg/MAVProxy/modules/mavproxy_cesium/init.py", line 72, in init
self.run_web_server()
File "build/bdist.linux-x86_64/egg/MAVProxy/modules/mavproxy_cesium/init.py", line 97, in run_web_server
from app import cesium_web_server
File "build/bdist.linux-x86_64/egg/MAVProxy/modules/mavproxy_cesium/app/cesium_web_server.py", line 26, in
TypeError: init() got an unexpected keyword argument 'root_path'

Standalone mavcesium uses a lot of resource

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
14994 mav       20   0  427996 112960  12180 R  20.1  6.6  26:34.26 python

112Mb resident memory is a lot for a small embedded computer (for example an rpi zero only has 384mb after graphics). Can this be reduced?

The cpu is presumably down to pymavlink?

Make synthetic camera default?

When you first load the webpage it looks like camera points down, so it's very unclear what you're looking at. The 'synthetic' camera provides a familiar horizon. Also, perhaps 'synthetic' might be called 'forward' to be more intuitive?

Does not retry for mavlink connection

If you start the mavcesium standalone server before the mavlink connection is ready (eg. mavlink proxy is not yet fully started), it does not seem to retry and reconnect when the mavlink connection does become available.

In particular I'm testing this on the Maverick 1.1.5 release for Tegra TX1. On boot the mavcesium service starts slighty before or at the same time as mavlink-router@sitl service. The mavlink proxy (mavlink-router@sitl) service does start up very shortly afterwards and is available, however you have to restart mavcesium service before it connects. It should retry connection.

Support more than one vehicle in the same 'world'

  • refactor javascript to allow for 'vehicle' objects

  • each vehicle has its own 3D model, mission and fence

  • each vehicle has a callback to update its location, pose and other info

  • each vehicle will have a unique system ID that will allow the correct vehicle to be targeted for updates

Configurable config?

New config parsing master code loads config (and api key) from mavproxy directory. This has two problems:

  • Config shouldn't live in python mavproxy path - this will usually be owned by root and normal users won't have write access. (Default is /usr/local/lib/python2.7/dist-packages/MAVProxy/modules/mavproxy_cesium/app/).
  • Doesn't allow for multiple instances of mavproxy. There can be any number of instances of mavproxy running (one for flight controller, one for sitl, for example). Currently this will try and load cesium on the same port for both instances, causing a conflict and error in the second loaded instance.

Python bindings for C++ MAVLink processing

Use pybind11 to make a JSON MAVLink bridge in C++ with python interfaces. Device handling and parsing will be in C++ and it will create JSON formatted strings to be passed via websocket. All message processing and sorting will happen client side in JavaScript.

14.04 ImportError: No module named twisted.websocket

STABILIZE> module load cesium
STABILIZE> Traceback (most recent call last):
File "mavproxy.py", line 276, in load_module
m = import_package(modpath)
File "mavproxy.py", line 406, in import_package
mod = import(name)
File "build/bdist.linux-x86_64/egg/MAVProxy/modules/mavproxy_cesium/init.py", line 15, in
ImportError: No module named twisted.websocket

Traceback (most recent call last):
File "mavproxy.py", line 276, in load_module
m = import_package(modpath)
File "mavproxy.py", line 406, in import_package
mod = import(name)
ImportError: No module named cesium

Failed to load module: No module named cesium. Use 'set moddebug 3' in the MAVProxy console to enable traceback

[1]+ Stopped python mavproxy.py --master=tcp:127.0.0.1:5760 --c

License Question

Hi,

I really love the GoodRobots-projects and currently investigate regarding integrating / working on some of them. Is there any chance to get MAVCesium and vision_landing under a permissive license as well? This would make adoption easier.

Peter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.