PX4 Software-In-The-Loop(SITL) Simulation on Gazebo

原文链接: [PX4 Software-In-The-Loop(SITL) Simulation on Gazebo](https://404warehouse.net/2016/07/11/px4-software-in-the-loopsitl-simulation-on-gazebo/)

PX4 Software-In-The-Loop(SITL) Simulation on Gazebo

Jaeyoung Lim

Introduction

PX4 is a great platform to implement a UAV system based on a opensource autopilot. One of the great features of PX4 is that you can run a SITL simulation(Software in the loop simulation) to simulate your flight on simulation. This is useful as you can check new mission or control algorithms before actually flying the quadrotor and possibly damaging it. This article shows will show you how to run a SITL for PX4 and how to interact with it through gazebo and qgroundcontrol. The article has mainly the same contents as the tutorial but is reorganized and more specific for the purpose of offboard control.

A brief introduction to Software in the loop simulation

Software in the Loop is a simulation of a system which is modeled and run under software without any hardware. To develop a control software, usually the system will have to pass three simulation verification before the software is implemented into a real system.
The first is sometimes called MITL(Model-In-The-Loop) which only includes a mathematical model of the controller. The next is to verify the controller in a SITl(Software-In-The-Loop). Software in the loop simulations verify the actual software integration of the controller to see if there is any unforeseen problems within the system. The third process is the PITL(Processor-In-The-Loop) which verifies there are no problems within the processor calculations. The last procedure is to have a HITL(Hardware-In-The-Loop) which includes the major hardware components in the control system to verify the controller is working properly.

PX4 SITL

PX4 is a flight control platform and can be run on SITL mode. The diagram shows a simple example of a px4 in SITL mode.
PX4 Software-In-The-Loop(SITL) Simulation on Gazebo_第1张图片

Rererence: https://github.com/PX4/Firmware/tree/master/posix-configs/SITL
The PX4 SITL can be interfaced using MAVLink (Similar to the real flight controller) through a UDP port.

Running the simulation

Installation

ROS

The current article is implemented based on ROS indigo. Other versions of ROS that has been after ROS indigo should work, but have not been verified. For installation instructions of ROS, try this tutorial.

Gazebo

Gazebo6 should be used for the PX4 gazebo plugin. You can check which specific version to use with ROS here.

PX4

PX4 and jMAVSim should be installed and compliled to run PX4 in SITL mode.

Clone the PX4 source.

mkdir -p ~/src
cd ~/src
git clone https://github.com/PX4/Firmware.git
cd Firmware
git submodule update --init --recursive
cd ..

Running the simulation

Different airframes can be selected to run the simulation. Supported airframes include Multirotors(with/without optical flow sensors), Planes, VTOL(tail sitters, quadplanes).

Quadrotor

The default quadrotor model is IRIS from 3DRobotics.

cd ~/src/Firmware
make posix_sitl_default gazebo

PX4 Software-In-The-Loop(SITL) Simulation on Gazebo_第2张图片

Quadrotor with Optical Flow

cd ~/src/Firmware
make posix gazebo_iris_opt_flow

Typhoon H 480

cd ~/src/Firmware
make posix gazebo_typhoon_h480

PX4 Software-In-The-Loop(SITL) Simulation on Gazebo_第3张图片

Standard VTOL

cd ~/src/Firmware
make posix_sitl_default gazebo_standard_vtol

PX4 Software-In-The-Loop(SITL) Simulation on Gazebo_第4张图片

Tailsitter VTOL

cd ~/src/Firmware
make posix_sitl_default gazebo_tailsitter

PX4 Software-In-The-Loop(SITL) Simulation on Gazebo_第5张图片

When the SITL is running properly, the log screen will appear as below.

Interfacing SITL with qgroundcontrol

The default UDP address for the mavlink is as follows
– to connect to a specific IP: “udp://:[email protected]:14557”
– to connect to a local host: “udp://:[email protected]:14557”

If qgroundcontrol is installed properly, it will automatically connect to the UDP port while the simulation is running.PX4 Software-In-The-Loop(SITL) Simulation on Gazebo_第6张图片

PX4 Software-In-The-Loop(SITL) Simulation on Gazebo_第7张图片

Mission with Quadrotor

class="youtube-player" type="text/html" width="560" height="315" src="https://www.youtube.com/embed/NwRfVUqKOT4?version=3&rel=1&fs=1&autohide=2&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent" allowfullscreen="true">

Mission with Standard VTOL

class="youtube-player" type="text/html" width="560" height="315" src="https://www.youtube.com/embed/hNjnxHnjs14?version=3&rel=1&fs=1&autohide=2&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent" allowfullscreen="true">

You can also change parameter files and do automatic missions just as if you are interacting with the real flight controller.

Interfacing SITL with ROS

The biggest advantage of interfacing to SITL through ROS has the same interface with interfacing with a real flight controller. You only need to change the fcl_url on MAVROS.

roslaunch mavros px4.launch fcu_url:=”udp://:[email protected]:14557″

It is good to have arguments on fcu_url in the launch file to be able to change between SITL and the real board to speed up the process.

Examples

Sending position setpoints

class="youtube-player" type="text/html" width="560" height="315" src="https://www.youtube.com/embed/rxV9MsoUJGw?version=3&rel=1&fs=1&autohide=2&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent" allowfullscreen="true">

Trajectory control using position setpoints

class="youtube-player" type="text/html" width="560" height="315" src="https://www.youtube.com/embed/70YCKcesfFo?version=3&rel=1&fs=1&autohide=2&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent" allowfullscreen="true"> div.wpmrec2x{max-width:610px;} div.wpmrec2x div.u > div{float:left;margin-right:10px;} div.wpmrec2x div.u > div:nth-child(3n){margin-right:0px;}
Advertisements
(function(g,$){if("undefined"!=typeof g.__ATA){ g.__ATA.initAd({collapseEmpty:'after', sectionId:26942, width:300, height:250}); g.__ATA.initAd({collapseEmpty:'after', sectionId:114160, width:300, height:250}); }})(window,jQuery);
scrolling="no" width="300" height="250">
scrolling="no" width="300" height="250">
var o = document.getElementById('crt-31909565'); if ("undefined"!=typeof Criteo) { var p = o.parentNode; p.style.setProperty('display', 'inline-block', 'important'); o.style.setProperty('display', 'block', 'important'); Criteo.DisplayAcceptableAdIfAdblocked({zoneid:388248,containerid:"crt-31909565",collapseContainerIfNotAdblocked:true,"callifnotadblocked": function () {var o = document.getElementById('crt-31909565'); o.style.setProperty('display','none','important');o.style.setProperty('visbility','hidden','important'); } }); } else { o.style.setProperty('display', 'none', 'important'); o.style.setProperty('visibility', 'hidden', 'important'); }
var o = document.getElementById('crt-1719407369'); if ("undefined"!=typeof Criteo) { var p = o.parentNode; p.style.setProperty('display', 'inline-block', 'important'); o.style.setProperty('display', 'block', 'important'); Criteo.DisplayAcceptableAdIfAdblocked({zoneid:837497,containerid:"crt-1719407369",collapseContainerIfNotAdblocked:true,"callifnotadblocked": function () {var o = document.getElementById('crt-1719407369'); o.style.setProperty('display','none','important');o.style.setProperty('visbility','hidden','important'); } }); } else { o.style.setProperty('display', 'none', 'important'); o.style.setProperty('visibility', 'hidden', 'important'); }
July 11, 2016 in Articles.

Leave a Reply Cancel reply

Fill in your details below or click an icon to log in:

Gravatar
Name (required)
Website
WordPress.com Logo

You are commenting using your WordPress.com account. ( Log Out / Change )

Twitter picture

You are commenting using your Twitter account. ( Log Out / Change )

Facebook photo

You are commenting using your Facebook account. ( Log Out / Change )

Google+ photo

You are commenting using your Google+ account. ( Log Out / Change )

Cancel

Connecting to %s

var highlander_expando_javascript = function(){ var input = document.createElement( 'input' ), comment = jQuery( '#comment' ); if ( 'placeholder' in input ) { comment.attr( 'placeholder', jQuery( '.comment-textarea label' ).remove().text() ); } // Expando Mode: start small, then auto-resize on first click + text length jQuery( '#comment-form-identity' ).hide(); jQuery( '#comment-form-subscribe' ).hide(); jQuery( '#commentform .form-submit' ).hide(); comment.css( { 'height':'10px' } ).one( 'focus', function() { var timer = setInterval( HighlanderComments.resizeCallback, 10 ) jQuery( this ).animate( { 'height': HighlanderComments.initialHeight } ).delay( 100 ).queue( function(n) { clearInterval( timer ); HighlanderComments.resizeCallback(); n(); } ); jQuery( '#comment-form-identity' ).slideDown(); jQuery( '#comment-form-subscribe' ).slideDown(); jQuery( '#commentform .form-submit' ).slideDown(); }); } jQuery(document).ready( highlander_expando_javascript );

Notify me of new comments via email.





    

/*

你可能感兴趣的:(ROS机器人系统,UAV,Pixhawk开发进阶)