James Goppert's Posts (25)

Sort by
Developer

px4fmuv1.6_top.png?w=400The PX4 autopilot is an amazing open source platform for research. It is one of the first open source autopilots capable of running an on-board extended kalman filter and other advanced control and navigation algorithms. It is also mass produced by 3D Robotics and very affordable.

Hardware Accelerated Extended Kalman Filter

Recently I have completed a C++ matrix library wrapper around the CMSIS digital signal processing library. This means we can now type matrix math like this:


// continuous covariance prediction
P = P + (F * P + P * F.transpose() + G * V * G.transpose()) * dt;

// attitude correction
Vector y = zAtt - zAttHat; // residual
Matrix S = HAtt * P * HAtt.transpose() + RAttAdjust; // residual covariance
Matrix K = P * HAtt.transpose() * S.inverse();
Vector xCorrect = K * y;
P = P - K * HAtt * P;

// attitude fault detection
float beta = y.dot(S.inverse() * y);

// position correction
Matrix S = HPos * P * HPos.transpose() + RPos; // residual covariance
Matrix K = P * HPos.transpose() * S.inverse();
Vector xCorrect = K * y;
P = P - K * HPos * P;

// position fault detection
float beta = y.dot(S.inverse() * y);

Not only is this very easy to read (similar to Matlab/ScicosLab), it is also hardware accelerated! Thanks to the CMSIS library, multiple floating point operations are executed in one CPU cycle. The result is running a 9 state, 9 measurement discrete time extended kalman filter only consumes 20% of the ARM cortex M4 processor.

You can see the entire example here.

Sensor Level HIL

In order to develop and test the EKF I also developed the capability for full sensor-level hardware-in-the-loop testing. Simulated sensor data is sent from the flight simulator directly to the autopilot. This means you can run a very high fidelity UAV simulation while sitting at your desk.

You can see the python script to run PX4 hardware in the loop here.

Object Oriented Control Library

For those that have followed my development, you know that I am a big fan of object-oriented code. While developing the fixed-wing autopilot, I also created a new control library that has a similar feel to what I wrote for ArduPilotOne. This makes it easy for control engineers and the like , who are familiar with block diagram control systems, to easily translate their ideas to code.

You can see an example here for fixed wing.

The features above are just some that I have recently contributed. There are many developers working on PX4 from around the world and many new developments happening every day! Soon a very powerful optical flow board will be released! I hope that you will join this great community!

Read more…
Developer

ArkToolbox is a toolbox for ScicosLab/ XCos (similar to Matlab simulink, but free). ArkToolbox is useful for drone control design, simulation, and testing and is compatible with FlightGear, MAVLink (QGroundControl/ArduPilotMega), and the JSBSim Trimming GUI software. This creates a completely open source toolchain for developing aircraft models, finding trim states for control, and developing controllers. The ArkToolbox also supports hardware in the loop communication  via MAVLink.

Download Here: https://github.com/arktools/arktoolbox/downloads

More Demo Videos:

arducopter simulation with hardware/software in the loop: http://youtu.be/6ho8OXavEsc

rover hardware in the loop: http://youtu.be/ddysKBCKTSw

sailboat control system: http://youtu.be/5jYfah5Pcps

rocket control system: http://youtu.be/Un1YITQHUV0

Wiki for getting started on ArkToolbox for ScicosLab:

https://github.com/arktools/arktoolbox/wiki

 

Grab JSBSim Trimming GUI here:

https://github.com/jgoppert/jsbsim/downloads

Video tutorial for JSBSim Trimming GUI: http://youtu.be/JCjRGJTWe5k

Grab Aircraft Models to Run/ Fly in FlightGear Here (includes Arducopter/ EasyStar): 

https://github.com/arktools/arkhangar

All the demos have been well tested on all platforms. If you find any errors let me know. The MAVLink blocks are running version 0.9 so I will be upgrading to version 1.0 when I get a chance to support the latest APM versions. If you have time to contribute to ArkToolbox, send me an email.

Read more…
Developer

JSBSim Trimming Demo for F16 and Shadow UAS

A gui for JSBSim is demonstrated. The gui is capable of trimming any aircraft modeled in JSBSim at various flight conditions. It can simulate the aircraft at the calculated trim conditions, save the linearizations around these trim states, and output the linearization to a form readable by ScicosLab. The software is demonstrated on the standard f16 model included with JSBSim and a shadow UAV model, part of arkhangar. The linearized state space models output at the trim conditions are used to generate bode and root locus plots in ScicosLab.
https://github.com/jgoppert/jsbsim
https://github.com/arktools/arkhangar

Read more…
Developer

This is a heading hold test for the ArduPilotMega based (ArduBoat) sailboat autopilot. The boat is sailed manually on a reach and then heads downwind holding a heading of 0 degrees and performs a jibe.We have waypoint guidance working in hardware-in-the-loop, so we expect to do waypoint testing soon. We might have to figure out a better solution for our digital wind vane as the potentiometer from radio-shack is too sticky to detect light winds well. The digital weather station from sparkfun might be a good option.

Read more…
Developer

Sailboat Autopilot Design for ArduPilotMega

We just finished up modeling sailboat dynamics and implemented a controller. The dynamics were interesting due to the swinging airfoil. We modeled the winch system using a basic spring model that can only pull the sail in. It works well and can simulate irons, tacking, and jibing. All of the drag coefficients etc. are very rough at this point but the overall dynamics seem realistic.

 

The sailboat we are using is a 1/3 scale laser sailboat and we hope to have it sailing with the autopilot soon. The autopilot will be implemented for ArduPilotMega using the ArduPilotOne library.

 3689435320?profile=original

For the controller we are using a feedback system on the rudder to hold the commanded course. We are using a lookup table for the desired sail position given the apparent wind direction.

 

We have rigged up a wind indicator using a coil wound variable resistor that can easily plug into one of the existing 5 v adc slots on the apm. We removed the stopper so it can freely rotate.

3689435337?profile=original

Read more…
Developer

What is ArduPilotOne?

An object oriented fork of the APM autopilot code supporting multiple vehicle types and with the goal of supporting multiple ArduPilot boards in the future (currently only ArduPilotMega).

 

Some clarification:

It started as an object oriented (C++) branch of ArduPilotMega. It provides an abstraction layer between the different modules of the autopilot so that they can be shared among different vehicle types. After several discussions, we on the development team choose not to use it as a base for ArduPilotMega and ArduCopter. Think of it more as ArduPilotMega++ if you like.

 

Currently ArduPilotOne supports: rover(full autopilot), quad (manual flight), boat(full autopilot, not yet tested), plane(full autopilot, not yet tested)

 

The quad full auto support will be online in a month or so when I have time to sit down with my arducopter again and get the rest of the gains. This isn't meant to compete with ArduCopter, ArduPilotMega, it is simply a different option if you want something that you can have the same code base and is object oriented. The quad/plane code doesn't have nearly as many options as ArduCopter/ ArduPilotMega, but for my research with multiple vehicle cooperation I want a platform where all vehicles run the same c++ code using different modules for unique vehicle differences. It is fairly extensible so it will be easy to add more options as needed.

 

Notes:

1. There is no command line mode.

2. You must run it with a ground station talking mavlink. If a mavlink packet is not received by the vehicle from the ground station it will go into a failsafe mode.

3. The main ardupilotone.pde sketch is meant as a template. You can easily copy it and modify it to your liking in a different sketch.

4. In ardupilotone.pde the vehicle configuration file is included. Make sure you include CarStampede.h if you want to test the ArduRover functionality. PlaneEasystar.h if you want to test the plane, BoatGeneric.h if you want to test the boat, QuadArducopter.h for the quad etc.

5. Feel free to make your own vehicle config file for your specific vehicle, you can use the others as a template.

 

Tech Specs:

memory: only 80k

speed: 150 Hz attitude loop, 100 Hz control loop @ 60% load

 

Hosting site:

https://github.com/arktools/ardupilotone/

Read more…
Developer

The ArduRover (based on ArduPilotOne) user base is growing and it is time for a beta release. Right now, as the core developer, I do not have enough time to test the code thoroughly on all platforms. If you have an unmanned rover, boat, or quad, and a mavlink compatible ground station (free for download/ qgroundcontrol, hk gcs etc.) then feel free to become a beta tester.

As the community grows, documenting the code behavior for the end user will be important. A comprehensive wiki like the one currently available for ArduPilotMega would be a huge help. So if you can contribute to the documentation also contact me and I'll get you added to the google code project.

Finally, if you have C++ coding experience and have patches to the code for improved functionality feel free to send them to me. If you submit enough helpful patches, I'll invite you to the development team.

email: james.goppert@gmail.com  <-- email me to join the team
https://github.com/arktools/ardupilotone

Read more…
Developer
All of this is open source and freely available for download. You can find the core autopilot here. We developed it using eclipse, but the environment is fully arduino compatible as well thanks to the hardwork of Mike!
http://code.google.com/p/ardupilotone/
This repository is for rover specific configuration files and a wiki site for ardupilotone based rovers.
http://code.google.com/p/ardurover/
To run the hardware in the loop you will need the mavsim scicoslab toolbox here.
https://github.com/openmav/mavsim
Read more…
Developer

A digital control system model of the pixhawk quadrotor was constructed in scicoslab along with a continuous model of the quadrotor dynamics (the visual model is an arducopter). The user can input the guidance commands to the autopilot through sliders. As the video shows, the yaw response it not optimal, which also happens in the actual system. Using the mavsim Scicoslab toolbox (https://github.com/openmav/mavsim/) , the model can be simulated and then, once the system has been correctly identified, the dynamics can be linearized. The linear model of the system makes the problematic modes clear and aids in designing an improved controller.

Read more…
Developer

Trimming Software for JSBSim Models


Trimming is an important part of control design. By finding natural equilibrium points in a system, less control effort is required to keep the plane flying as desired. This software lets you compute trim points for aircraft ranging from the easystar and quadrotors to f16's and 737's. Anything that can be modelled with a JSBSim model will work.

 

There are many JSBSim models already developed for flight simulators like FlightGear that can be used as low fidelity models. For higher fidelity models, wind tunnel data can be used within the JSBSim file as done with the easystar model in mavsim. All of this software is open source and available for download.


download: https://github.com/openmav/mavsim
wiki: https://github.com/openmav/mavsim/wiki

If you find any bugs please post them here:
https://github.com/openmav/mavsim/issues

Read more…
Developer

Here are some vehicle models that are currently under development. The simple 3d models display control input and attitude information to the user. This is much more intuitive than charts but the models require very limited cpu resources and can run on most laptops. You can find all of the vehicle models and scicoslab blocks on the oooark sourceforge site: https://sourceforge.net/projects/oooark/ These models will also be incorporated into qgroundcontrol soon.

Read more…
Developer

With the latest ArduPilotMega trunk you can perform in flight gain and waypoint adjustment along with many other parameters. This enables hardware in the loop flight control law debugging and testing. QGroundControl serves as the interface to the onboard parameter adjustment and also displays map views and real-time data plots with logging available.

Read more…
Developer

The new ArduPilotMega Mavlink branch with the latest QGroundControl development branch enables the operator to dynamically load waypoints and set gains in flight. To test out the communication we setup a small ground based experiment with an RC Car. No gains were changed from the default ArduPilotMega gains. Also the inertial navigation code was used between GPS updates but the GPS reset the position/ velocity when each GPS packet was received. This led to some oscillations that will be corrected in later tests. The autopilot trim throttle/ steering is set at the beginning of the experiment using the autotrim feature of the ArduPilotMega autopilot system. At the end of the experiment the trim throttle was insufficient off-pavement and led to the end of the test. More experiments to come! We will be testing out the data-logging and in flight gain adjustment.


Below we have included a screenshot of the ground trajectory. We were using a ublox gps. Note that there was significant GPS signal degradation due to the surrounding buildings that led to the trajectory deviations from the flight plan.

Read more…
Developer

ArduPilotMega integration with QGroundControl is finally finished. All of the basic functionality is there although there are some finishing touches that need to be done. I added the ability to set local/global waypoints and also actions (takeoff/land/etc.) to easily integrate with the existing APM autopilot software. A 3d osgearth view inspired from dronegcs is in the works and we hope to have it together soon.
Read more…
Developer
This is a quick how-to to get going with ArduPilotMega QGroundControl Integration. Note that this is a work in progress and that the gains/ waypoints sent to the apm are not currently setting the values in the autopilot. I'll be working today to hook these up. I could really use help debugging and coding though so I've posted this to get everyone else up to speed.
  1. Get ArduPilotMega mavlink branch: svn checkout http://ardupilot-mega.googlecode.com/svn/ArduPilotMega/branches/mavlink "pathtosketchbook"/ArduPilotMega
  2. Get Arducopter libraries: svn checkout http://arducopter.googlecode.com/svn/trunk/libraries "pathtosketchbook"/libraries
  3. Get Mavlink: git clone https://github.com/pixhawk/mavlink.git "pathtosketchbook"/libraries/mavlink
  4. Get QGroundControl: http://qgroundcontrol.org/downloads or build from source: git clone https://github.com/pixhawk/qgroundcontrol.git "base directory"/qgroundcontrol, if you build from source you will need to copy "pathtosketchbook"/libraries/mavlink to "base directory" or create a symbolic link
  5. Set sketchbook path for arduino to "pathtosketchbook", then restart arduino IDE.
  6. Create an APM_Config.h file as seen below.
  7. Compile and upload code to board.
  8. Start QGroundControl, select network, add link, set to comm port (/dev/ttyUSB* on linux, COM* on windows) and then set the baud rate to 115200 (if using GCS_PORT 3)
Here is some documentation:

APM_Config.h file:

#define DEBUG_SUBSYSTEM 0

#define FLIGHT_MODE_CHANNEL 8
#define FLIGHT_MODE_1 AUTO
#define FLIGHT_MODE_2 RTL
#define FLIGHT_MODE_3 FLY_BY_WIRE_A
#define FLIGHT_MODE_4 FLY_BY_WIRE_B
#define FLIGHT_MODE_5 STABILIZE
#define FLIGHT_MODE_6 MANUAL

#define GCS_PROTOCOL GCS_PROTOCOL_MAVLINK
#define ENABLE_HIL ENABLED
#define GCS_PORT 3
#define GPS_PROTOCOL GPS_PROTOCOL_IMU
#define AIRSPEED_CRUISE 25

#define THROTTLE_FAILSAFE ENABLED
#define AIRSPEED_SENSOR ENABLED
Read more…