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.

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

Screenshot from 2016-01-15 14:00:10

Quadrotor with Optical Flow

cd ~/src/Firmware
make posix gazebo_iris_opt_flow

Typhoon H 480

cd ~/src/Firmware
make posix gazebo_typhoon_h480

Standard VTOL

cd ~/src/Firmware
make posix_sitl_default gazebo_standard_vtol

Tailsitter VTOL

cd ~/src/Firmware
make posix_sitl_default gazebo_tailsitter

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://:14540@192.168.1.36:14557”
– to connect to a local host: “udp://:14540@127.0.0.1:14557”

If qgroundcontrol is installed properly, it will automatically connect to the UDP port while the simulation is running.그림3

그림2

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://:14540@127.0.0.1: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'); }

Leave a Reply Cancel reply

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

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 )

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 );





    </div><!-- #content -->
</div><!-- #primary -->

<div id="secondary" class="widget-area" role="complementary">
            <aside id="facebook-likebox-3" class="widget widget_facebook_likebox">      <div id="fb-root" class=" fb_reset"><div style="position: absolute; top: -10000px; height: 0px; width: 0px;"><div><iframe name="fb_xdm_frame_https" frameborder="0" allowtransparency="true" allowfullscreen="true" scrolling="no" id="fb_xdm_frame_https" aria-hidden="true" title="Facebook Cross Domain Communication Frame" tabindex="-1" src="https://staticxx.facebook.com/connect/xd_arbiter/r/hsBwMj6iLmk.js?version=42#channel=f24c01ce4da7db8&amp;origin=https%3A%2F%2F404warehouse.net" style="border: none;"></iframe></div></div><div style="position: absolute; top: -10000px; height: 0px; width: 0px;"><div></div></div></div>
    <div class="fb-page fb_iframe_widget" data-href="https://www.facebook.com/404warehouse" data-width="200" data-height="130" data-hide-cover="false" data-show-facepile="false" data-show-posts="false" fb-xfbml-state="rendered" fb-iframe-plugin-query="app_id=249643311490&amp;container_width=220&amp;height=130&amp;hide_cover=false&amp;href=https%3A%2F%2Fwww.facebook.com%2F404warehouse&amp;locale=en_US&amp;sdk=joey&amp;show_facepile=false&amp;show_posts=false&amp;width=200"><span style="vertical-align: bottom; width: 200px; height: 130px;"><iframe name="f33b11415e82fb4" width="200px" height="130px" frameborder="0" allowtransparency="true" allowfullscreen="true" scrolling="no" title="fb:page Facebook Social Plugin" src="https://www.facebook.com/v2.3/plugins/page.php?app_id=249643311490&amp;channel=https%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FhsBwMj6iLmk.js%3Fversion%3D42%23cb%3Df1e766b2c14ac4c%26domain%3D404warehouse.net%26origin%3Dhttps%253A%252F%252F404warehouse.net%252Ff24c01ce4da7db8%26relation%3Dparent.parent&amp;container_width=220&amp;height=130&amp;hide_cover=false&amp;href=https%3A%2F%2Fwww.facebook.com%2F404warehouse&amp;locale=en_US&amp;sdk=joey&amp;show_facepile=false&amp;show_posts=false&amp;width=200" style="border: none; visibility: visible; width: 200px; height: 130px;" class=""></iframe></span></div>
    </aside>    </div><!-- #secondary -->
</div><!-- #main -->

<footer id="colophon" class="site-footer" role="contentinfo">
    <div class="site-info">
        <a href="https://wordpress.com/?ref=footer_website">Create a free website or blog at WordPress.com.</a>
    </div><!-- .site-info -->
</footer><!-- #colophon -->

/*
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值