Giter Club home page Giter Club logo

gazebo-sitl's Introduction

DISCONTINUATION OF PROJECT.

This project will no longer be maintained by Intel.

Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.

Intel no longer accepts patches to this project.

If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project.

Gazebo SITL Plugin

Build Status Coverity Scan Build Status

A ROS-independent Gazebo plugin for Ardupilot's SITL.

Requirements

* Python 2.7+ (to generate mavlink headers)
* MavProxy (https://github.com/Dronecode/MAVProxy)
* Ardupilot (https://github.com/ArduPilot/ardupilot)

Build and Install

  1. Make sure you have initialized and updated the Mavlink submodule at least once with:

    git submodule update --init --recursive
    
  2. Create a build folder, make and install using CMAKE as follows:

    mkdir build
    cd build
    cmake ..
    sudo make install
    cd -
    
  3. Download Gazebo models if necessary:

    Gazebo automatically searches and downloads models referenced in the .world file that are not already present into GAZEBO_MODEL_PATH. However, in some cases the download might take a long time for no apparent reason. Download the Quadrotor model manually with:

    curl http://models.gazebosim.org/quadrotor/model.tar.gz | tar xvz -C GAZEBO_MODEL_PATH
    

Run

  1. Open a second terminal and run Ardupilot:

    ${ARDUPILOTDIR}/build/sitl/bin/arducopter --model x --defaults ${ARDUPILOTDIR}/Tools/autotest/default_params/copter.parm
    
  2. In a third terminal, run Mavproxy:

    mavproxy.py --master tcp:127.0.0.1:5760 --out udp:127.0.0.1:15556
    
  3. Open the Gazebo gzsitl_drone_target world file with the following command:

    gazebo ./world/gzsitl_drone_target.world --verbose
    

Interaction

The Plugin first detects if the vehicle being simulated on SITL is Landed or already Airborne.

  • If Landed, store the initial position as home, set flight mode as guided and request take-off.
  • If Airborne, request home position, and keep the current flight mode.

When Airborne, the vehicle follows the transparent sphere (target).

Troubleshooting

Gazebo might fail to open if the needed models or plugins are not found. If that happens, make sure the needed plugins have been successfully built and installed into your shared libraries directory and that all the needed models are present into GAZEBO_MODEL_PATH. The Gazebo --verbose terminal output is useful for determining whether a plugin or a model has not not been found.

gazebo-sitl's People

Contributors

anselmolsm avatar dakerfp avatar guiccbr avatar mbelluzzo-intel avatar rdower avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gazebo-sitl's Issues

Vehicle stuck on INIT mode

Hi, I get an issue similar to #8.

After I run

~/course/UAV/code/ardupilot/build/sitl/bin$ ./arducopter --model x
mavproxy.py --master tcp:127.0.0.1:5760 --out udp:127.0.0.1:14556 --streamrate -1
param load ${ARDUPILOTDIR}/Tools/autotest/default_params/copter.parm
gazebo ./world/gzsitl_drone_target.world --verbose

The quadcopter stays on the floor and does not take off.

Here is the output from gazebo ./world/gzsitl_drone_target.world --verbose

$ gazebo ./world/gzsitl_drone_target.world --verbose
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.1.78
[Msg] Publicized address: 192.168.1.78
[mav_vehicle] Our system id: 1
[mav_vehicle] Waiting for vehicle...
The gzsitl plugin is attached to the model
init
state: INIT
Warning [parser.cc:440] Converting a deprecated SDF source[data-string].

Thank you in advance

Update Requirements

Requirements list needs to be revisited. We don't list gazebo on it, nor its version. Also, python-future is needed for mavlink.

error: ‘mutex’ in namespace ‘std’ does not name a type

drone@dronecode02:/project/gazebo-sitl$ git submodule init
drone@dronecode02:
/project/gazebo-sitl$ git submodule update
drone@dronecode02:/project/gazebo-sitl$ cd gzsitl/build
drone@dronecode02:
/project/gazebo-sitl/gzsitl/build$ cmake ..
-- Boost version: 1.54.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/drone/project/gazebo-sitl/gzsitl/build
drone@dronecode02:~/project/gazebo-sitl/gzsitl/build$ make
[100%] Building CXX object CMakeFiles/gzsitl_plugin.dir/gzsitl_plugin.cc.o
In file included from /home/drone/project/gazebo-sitl/gzsitl/gzsitl_plugin.cc:19:0:
/home/drone/project/gazebo-sitl/gzsitl/gzsitl_plugin.hh:71:5: error: ‘mutex’ in namespace ‘std’ does not name a type
std::mutex svar_access_mtx;
^
/home/drone/project/gazebo-sitl/gzsitl/gzsitl_plugin.hh:72:5: error: ‘mutex’ in namespace ‘std’ does not name a type
std::mutex data_to_send_access_mtx;
^
/home/drone/project/gazebo-sitl/gzsitl/gzsitl_plugin.hh:73:5: error: ‘mutex’ in namespace ‘std’ does not name a type
std::mutex attitude_svar_access_mtx;
^
/home/drone/project/gazebo-sitl/gzsitl/gzsitl_plugin.hh:74:5: error: ‘mutex’ in namespace ‘std’ does not name a type
std::mutex local_pos_ned_svar_access_mtx;
^
/home/drone/project/gazebo-sitl/gzsitl/gzsitl_plugin.hh:105:35: error: expected initializer before ‘:’ token
class GAZEBO_VISIBLE GZSitlPlugin : public ModelPlugin
^
/home/drone/project/gazebo-sitl/gzsitl/gzsitl_plugin.cc:772:1: error: expected ‘}’ at end of input
}
^
make[2]: *** [CMakeFiles/gzsitl_plugin.dir/gzsitl_plugin.cc.o] Error 1
make[1]: *** [CMakeFiles/gzsitl_plugin.dir/all] Error 2
make: *** [all] Error 2

Replace JMavsim

Check if it is possible to remove the need to run JMavsim and run the px4 binary only.

Support for ArduPlane

Does this support ArduPlane, or will have future support for it?

I had some trouble getting it to work for ArduPlane. The plane gets stuck in ACRO mode. I modified the gzsitl_quadcopter model sdf to point to the Cessna model.

Gazebo-SITL unable to simulate tracking and flight mission

Test Environment
Gazebo-SITL version: c1e07c6
Linux: Ubuntu 14.04 64 Bit Laptop
Purpose:
Check if the tracking and flight mission is able to simulate
Step:

  1. Run Ardupilot
  2. Run Mavproxy
  3. From gzsitl root directory execute the command below
    GAZEBO_PLUGIN_PATH=$
    {GAZEBO_PLUGIN_PATH}
    :$
    {PWD}/gzsitl/build GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:${PWD}
    /models gazebo ./world/gzsitl_drone_target.world --verbose
  4. Press T to enter Translate Mode in Gazebo
  5. Drag the sphere to a different position on the grid
  6. Run below steps in Mavproxy
    param load ..\Tools\autotest\copter_params.parm
    mode guided
    arm throttle
    takeoff 40
    wp load ..\Tools\autotest\CMAC-circuit.txt
    mode auto
    Excepted result:
    Gazebo-SITL is able to simulate the tasks
    Actual result:
    Gazebo-SITL unable to simulate the tasks

git bisect results:
c1e07c6 is the first bad commit
commit c1e07c6
Author: Daker Fernandes Pinheiro [email protected]
Date: Fri Jun 10 15:05:01 2016 -0300
Use guard locker and add {} on switch cases

Unify models

Right now we have two models for the mission target" ctrl and vis. Only one can be manually used in gazebo, even though both appear in the model list. This makes it confusing for the end user.

Remove defines.hh

Some of those defines should be replaced by plugin specific tags in its parent model .sdf file. The other few ones could just be put into gzsitl_plugin.cc.

building error: ‘status’ is not a class, namespace, or enumeration

When I build using cmake and make I get this error message. Any idea? Thanks in advance.

/home/gzhang8/course/UAV/code/gazebo-sitl/gzsitl/gzsitl_plugin.cc: In member function ‘void gazebo::GZSitlPlugin::OnUpdate()’:
/home/gzhang8/course/UAV/code/gazebo-sitl/gzsitl/gzsitl_plugin.cc:140:23: error: ‘status’ is not a class, namespace, or enumeration
         if (status == status::STANDBY) {
                       ^
/home/gzhang8/course/UAV/code/gazebo-sitl/gzsitl/gzsitl_plugin.cc:143:30: error: ‘status’ is not a class, namespace, or enumeration
         } else if (status == status::ACTIVE) {
                              ^
/home/gzhang8/course/UAV/code/gazebo-sitl/gzsitl/gzsitl_plugin.cc:173:23: error: ‘status’ is not a class, namespace, or enumeration
         if (status != status::ACTIVE) {
                       ^
/home/gzhang8/course/UAV/code/gazebo-sitl/gzsitl/gzsitl_plugin.cc:193:23: error: ‘status’ is not a class, namespace, or enumeration
         if (status == status::ACTIVE) {
                       ^
gzsitl/CMakeFiles/gzsitl_plugin.dir/build.make:62: recipe for target 'gzsitl/CMakeFiles/gzsitl_plugin.dir/gzsitl_plugin.cc.o' failed
make[2]: *** [gzsitl/CMakeFiles/gzsitl_plugin.dir/gzsitl_plugin.cc.o] Error 1
CMakeFiles/Makefile2:214: recipe for target 'gzsitl/CMakeFiles/gzsitl_plugin.dir/all' failed
make[1]: *** [gzsitl/CMakeFiles/gzsitl_plugin.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Include [gazebo-sitl] prefix on "print" functions.

Include a prefix on the print functions (as the one implemented here, in mavlink_vehicles). Useful to differ the messages that are being printed by the plugin from the ones printed by mavlink_vehicles or by gazebo. All of those messages will be printed together in gazebo stdout.

Use vehicle state in plugin state

Right now the plugin state doesn't check the vehicle state to decide what it should do. Once it has moved its internal state machine, it never goes back.

CMake Error at CMakeLists.txt:16 (install) while making gazebo-sitl

Test Environment
Gazebo-SITL version: eca6bd3
Purpose:
Check if the gazebo-sitl is able to build
Step:

  1. mkdir ./gzsitl/build
  2. cd ./gzsitl/build
  3. cmake ..
    Excepted result:
    Build gazebo-sitl successfully
    Actual result:
    Error "CMake Error at CMakeLists.txt:16 (install):" shows
    Git Bisect Results:
    commit 174e6b5
    Author: Anselmo L. S. Melo [email protected]
    Date: Fri Jun 17 17:06:20 2016 -0300
    CMake: Move CMakeLists to project's root dir
    Log:
    /gzsitl/build$ cmake ..
    – The C compiler identification is GNU 4.8.4
    – The CXX compiler identification is GNU 4.8.4
    – Check for working C compiler: /usr/lib/ccache/cc
    – Check for working C compiler: /usr/lib/ccache/cc – works
    – Detecting C compiler ABI info
    – Detecting C compiler ABI info - done
    – Detecting C compile features
    – Detecting C compile features - done
    – Check for working CXX compiler: /usr/lib/ccache/c++
    – Check for working CXX compiler: /usr/lib/ccache/c++ – works
    – Detecting CXX compiler ABI info
    – Detecting CXX compiler ABI info - done
    – Detecting CXX compile features
    – Detecting CXX compile features - done
    CMake Error at CMakeLists.txt:16 (install):
    install TARGETS given no LIBRARY DESTINATION for shared library target
    "gzsitl_plugin".
    CMake Warning (dev) in CMakeLists.txt:
    No cmake_minimum_required command is present. A line of code such as
    cmake_minimum_required(VERSION 3.2)
    should be added at the top of the file. The version specified may be lower
    if you wish to support older CMake versions for this project. For more
    information run "cmake --help-policy CMP0000".
    This warning is for project developers. Use -Wno-dev to suppress it.
    – Configuring incomplete, errors occurred!
    See also "/home/drone/Dronecode/Upstream/gazebo-sitl/gzsitl/build/CMakeFiles/CMakeOutput.log".

Remove unused subst target

This model was introduced to represent the temporary mission target set by the collision avoidance system. Other than the model, it was never implemented on the coav side.

Vehicle stuck on INIT mode sometimes.

The plugin does not change state from INIT sometimes. The model to which the plugin is attached needs then to be deleted from the world and reinserted a number of times before it starts working properly. This problem occurs very often in an inconsistent way.

After investigation, it has been detected that the plugin stays in INIT mode because Mavlink messages from the flight stack are either not present or not recognized. It appears that, for some reason, the communication socket does not receive messages when the problems is observed.

How to release control from gazebo-sitl

Hi,

I want to use this sitl with Dronekit to run simulations. This plugin compiles and run. Dronekit can connect to MavProxy. But the vehicle inside sitl is always fixed at the transparent sphere (target). Is there a way to disable this feature, so that I can get full control using mavlink massages?

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.