Code Monkey home page Code Monkey logo

hil's Introduction

##Hardware in the loop tool for PX4 Firmware

This is a tool for running hardware-in-the-loop (HIL) simulations for the px4 autopilot.

###HIL modes:

  • State-level HIL: tests the control and guidance systems.
  • Sensor-level HIL: tests the navigation system in addition to the control, and guidance systems. This requires a lot of data to be sent to the vehicle and a high baudrate.

Dependencies

PyMAVLink

Pymavlink is the python library required for running the runhil.py script, you can install it with easy install or pypi-install

If you are using a debian based system (e.g. Ubuntu), you can install using pypi-install so that it can be installed as debian package:

sudo apt-get install python-stdeb
pypi-install pymavlink

If you are using mac/ other unix systems:

sudo easy_install pymavlink

JSBSim

JSBSim is the C++ flight dynamics model. It can be built with cmake/ or autotools.

git clone git://git.code.sf.net/p/jsbsim/code jsbsim
cd jsbsim
./autogen.sh
make

Usage

NSH Startup Script

You must use the startup script found in data/rc. The two main lines added to normal startup are:

kalman_demo start
control_demo start

Python Script

This python script runhil.py is used for conducting HIL. Both sensor-level and state-level HIL are supported. You can view the runhil.py usage with:

runhil.py -h

A call to runhil.py might look like this:

./runhil.py --waypoints data/sf_waypoints.txt --master /dev/ttyUSB1 --gcs localhost:14550 --mode sensor

Explanation:

  • load the given waypoints in data/sf_waypoints.txt, NOTE: QGC waypoints are not compatible with pymavlink currently, you simply need to change the version number in the file to 110 if it is 120
  • connect to the px4 autopilot on usb port 1
  • setup external ground station communication of localhost:14550 udp.
  • mode sensor says do sensor-level hardware-in-the-loop (HIL), this can be set to state as well

GroundControl Interface

Note that the script defaults to opening a mavlink slave port on udp:14550, this is the default udp port for QGroundControl. If you start QGC, it should start communicating with runhil.py automatically.

Notes

TODO:

  • Magnetometer measurement model doesn't depend on lat/lot yet.
  • Add noise.
  • Initialization routines for EKF.

Source

This uses pymavlink and is based off of MAVProxy/ ardupilotemga SITL code.

hil's People

Contributors

devbharat avatar jgoppert avatar lorenzmeier avatar syantek avatar

Watchers

 avatar  avatar

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.