PX4 Software-In-The-Loop(SITL) Simulation on Gazebo
来源:互联网 发布:广东亿迅 知乎 编辑:程序博客网 时间:2024/05/21 07:49
404warehouse
Small Projects Big Ideas in Robotics, New Media and other Projects
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 ~/srccd ~/srcgit clone https://github.com/PX4/Firmware.gitcd Firmwaregit submodule update --init --recursivecd ..
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/Firmwaremake posix_sitl_default gazebo
Quadrotor with Optical Flow
cd ~/src/Firmwaremake posix gazebo_iris_opt_flow
Typhoon H 480
cd ~/src/Firmwaremake posix gazebo_typhoon_h480
Standard VTOL
cd ~/src/Firmwaremake posix_sitl_default gazebo_standard_vtol
Tailsitter VTOL
cd ~/src/Firmwaremake 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.
Mission with Quadrotor
Mission with Standard VTOL
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
Trajectory control using position setpoints
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;} </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&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&container_width=220&height=130&hide_cover=false&href=https%3A%2F%2Fwww.facebook.com%2F404warehouse&locale=en_US&sdk=joey&show_facepile=false&show_posts=false&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&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&container_width=220&height=130&hide_cover=false&href=https%3A%2F%2Fwww.facebook.com%2F404warehouse&locale=en_US&sdk=joey&show_facepile=false&show_posts=false&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 -->
- PX4 Software-In-The-Loop(SITL) Simulation on Gazebo
- Ardupilot SITL(Software in the Loop)软件仿真
- 话说apm的sitl(simulation in the loop)开发环境的搭建
- Hardware-in-the-loop Simulation for CPU-GPU Heterogeneous Platforms
- px4 多旋翼SITL仿真
- Doing the simulation in opnet
- Spending the Whole Day in Installing Software on My PC
- Which is the best software for MANET simulation?
- Return on Software: Maximizing the Return on Your Software Investment
- Eric Sink on the Business of Software
- MPEG Software Simulation Group (MSSG)
- The study of loop in Python(20170906)
- in/on the morning
- Communication skill in the software test
- [px4仿真]单独启动编译和Gazebo仿真器
- [px4仿真]取消Gazebo仿真中的传感器噪声
- 再论libmesh,options on engineering simulation software design and develop (现代工程仿真软件设计开发的一个考虑)
- Pixhawk原生固件PX4之SITL软件在环仿真
- 关于地址传参,&被转义为&,汉字被转义为编码,导致参数读取不了的解决方案
- Spring的第一个程序
- 企业数字化转型带来的四大机遇
- tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, name=None) 除去name参数用以指定该操作的nam
- RobotFramework二次开发——文件解析
- PX4 Software-In-The-Loop(SITL) Simulation on Gazebo
- Vue 事件修饰符.self的用法
- python的中的字符串类型:byte string和unicode string
- IntelliJ IDEA(2017)安装和破解
- Web前端初学者_需用了解的7大HTML知识点
- 洛谷 [p1439] 最长公共子序列 (NlogN)
- Nutch二次开发介绍
- ios Error Domain=NSURLErrorDomain Code=-999 "已取消"
- 【JavaScript】兼容IE6的JS模板化