From PaparazziUAV
Revision as of 02:24, 6 February 2018 by Openuas (talk | contribs) (→‎Gazebo)
Jump to navigation Jump to search


The nice sim framework Gazebo from here can now be use from withing Paparazzi. Are you doing work on UAS in combination with e.g. Vision based navigation check it out. I might make testing your new work so much simpler.

Be warned, using it can be highly addictive, and might tempt youinto buying a new computer with hight spacification. To be able to use Gaxzebo a very good Video card is needed, considder upgrading you yadware if everything runs to slow.

Installation and use take alook here

Gazebo backend for NPS NPS simulator

{TODO: Animated GIF here}}


We assume you already have Paparazzi installed via the One liner. If Not install Paparzzi first plz. Then come back to this page.

Gazebo Installation=

Steps to install Gazebo

     1. Make sure gazebo 9 is installed. (sudo apt-get install gazebo8 libgazebo8-dev)


     2. Prepare the Gazebo world and model:
        a) Prepare the UAV model (see conf/simulator/gazebo/models/ardrone/):
             Place the aircraft model in the conf/simulator/gazebo/models/
             folder, this folder is added to Gazebo's search path when NPS is
             Gazebo uses a Front, Left, Up coordinate system for aircraft, so
             make sure the +x axis points forwards.
             The model should include a link for each motor with the same names
             as those listed in NPS_ACTUATOR_NAMES (see below), e.g. 'nw_motor'.
             Camera links should have the name specified in .dev_name in the
             corresponding video_config_t struct, see sw/airborne/boards/pc_sim.h
             and sw/airborne/modules/computer_vision/video_thread_nps.c.


        b) Prepare the world (see conf/simulator/gazebo/worlds/ 
           Pay attention to the following:
             The real-time update rate should be set to zero, as this is
             already handled by Paparazzi:
               <physics type="ode">
         <real_time_update_rate>0</real_time_update_rate><!-- Handled by Paparazzi! -->
       Spherical coordinates should be provided for navigation.
       At this moment, there is an issue where Gazebo incorrectly
       uses a WSU coordinate system instead of ENU. This can be fixed
       by setting the heading to 180 degrees as shown below:
         <heading_deg>180</heading_deg><!-- Temporary fix for issue -->


Prepare the airframe file (see examples/ardrone2_gazebo.xml):

        a) Select Gazebo as the FDM (Flight Dynamics Model)
             <target name="nps" board="pc">
           <module name="fdm" type="gazebo"/>
    b) Add actuator thrusts and torques to the SIMULATOR section:
         <section name="SIMULATOR" prefix="NPS_">
           <define name="ACTUATOR_NAMES" value="nw_motor, ne_motor, se_motor, sw_motor" type="string[]"/>
           <define name="ACTUATOR_THRUSTS" value="1.55, 1.55, 1.55, 1.55" type="double[]"/>
           <define name="ACTUATOR_TORQUES" value="0.155, -0.155, 0.155, -0.155" type="double[]"/>
       The thrusts and torques are expressed in SI units (N, Nm) and should
       be in the same order as the ACTUATOR_NAMES.
    c) In the same section, bypass the AHRS and INS as these are not
       supported yet:
         <section name="SIMULATOR" prefix="NPS_">
           <define name="BYPASS_AHRS" value="1"/>
         <define name="BYPASS_INS" value="1"/>
    d) If required, enable video thread simulation:
         <section name="SIMULATOR" prefix="NPS_">
           <define name="SIMULATE_VIDEO" value="1"/>
    e) If required, specify the Gazebo world and aircraft name:
         <section name="SIMULATOR" prefix="NPS_">
           <define name="GAZEBO_WORLD" value=""/>
           <define name="GAZEBO_AC_NAME" value="my_uav"/>
   4. Make sure all included modules work with nps. At the moment, most of
      the modules that depend on video_thread are only built when ap is
      selected as the target. As a quick fix, try to remove the target
      attribute from the makefile element in the module xml, e.g.:
        <makefile target="ap"> ---> <makefile> 


Never forget... A sim is not reality... validate via testflights in the real world after you think everything you created works perfectly.