[ROS Q&A] 191 – How to Launch the Parrot Drone Simulation Locally

Written by Miguel Angel


Welcome to the ROS Q&A series again. In this post, we are going to answer and solve a question from a user on Gazebo Answers which asks how to launch a Parrot Drone simulation locally. The question can be found here.

What will you learn in this post

  • How to spawn a drone simulation in your local computer

List of resources referenced in this post

Downloading the required materials

Before downloading the repositories, let’s first create a catkin workspace for the parrot drone, which we will call parrot_ws. Let’s do that with the commands below:

mkdir -p ~/parrot_ws/src
cd ~/parrot_ws/

Now we have the parrot_ws (parrot workspace). Let’s then download the required git repositories which contain the simulation:

cd ~/parrot_ws/src
git clone --branch kinetic-gazebo7 https://bitbucket.org/theconstructcore/parrot_ardrone.git
git clone https://bitbucket.org/theconstructcore/spawn_robot_tools.git

You should now have the folders parrot_ardrone and spawn_robot_tools on the ~/parrot_ws/src folder.

Installing ignition-math, used by sjtu_drone

Before compiling the packages we downloaded in the previous step, we will need to install the Ignition Math library, which is used by the sjtu_drone drone found on the parrot_ardrone repository we cloned previously.

We can install the Ignition Math library with the following commands:

sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install libignition-math4-dev -y

Now that we have the Ignition Math library installed, we can proceed to compile the packages in our workspace.

Compiling the drone package

Now that we have everything in place, we can compile our packages we downloaded previously.

IMPORTANT: it may happen that when compiling the package, catkin_make can’t find the ignition library, so we need to export the CXXFLAGS accordingly. In my local computer, the ignition library is found at /usr/include/ignition/math4, so to compile we use the following commands:

cd ~/parrot_ws

export CXXFLAGS=-isystem\ /usr/include/ignition/math4

source /opt/ros/kinetic/setup.bash


If everything worked as expected, great. If not, try removing the devel and build first with cd ~/parrot_ws/; rm -rf build/ devel/  and compile it again with the commands exemplified above.

If everything went ok, you should have something like:

root@79e5b2505ede:~/parrot_ws# export CXXFLAGS=-isystem\ /usr/include/ignition/math4 
root@79e5b2505ede:~/parrot_ws# source /opt/ros/kinetic/setup.bash; catkin_make
Base path: /root/parrot_ws
Source space: /root/parrot_ws/src
Build space: /root/parrot_ws/build
Devel space: /root/parrot_ws/devel
Install space: /root/parrot_ws/install
#### Running command: "cmake /root/parrot_ws/src -DCATKIN_DEVEL_PREFIX=/root/parrot_ws/devel -DCMAKE_INSTALL_PREFIX=/root/parrot_ws/install -G Unix Makefiles" in "/root/parrot_ws/build"
-- catkin 0.7.14
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 6 packages in topological order:
-- ~~  - custom_teleop
-- ~~  - drone_demo
-- ~~  - ardrone_as
-- ~~  - sjtu_drone
-- ~~  - spawn_robot_tools_pkg
-- ~~  - drone_construct
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'custom_teleop'
-- ==> add_subdirectory(parrot_ardrone/custom_teleop)
-- +++ processing catkin package: 'drone_demo'
-- ==> add_subdirectory(parrot_ardrone/drone_demo)
-- +++ processing catkin package: 'ardrone_as'
-- ==> add_subdirectory(parrot_ardrone/ardrone_as)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Generating .msg files for action ardrone_as/Ardrone /root/parrot_ws/src/parrot_ardrone/ardrone_as/action/Ardrone.action
Generating for action Ardrone
-- ardrone_as: 7 messages, 0 services
-- +++ processing catkin package: 'sjtu_drone'
-- ==> add_subdirectory(parrot_ardrone/sjtu_drone)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   thread
--   signals
--   system
--   filesystem
--   program_options
--   regex
--   iostreams
--   date_time
--   chrono
--   atomic
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so  
-- Generating done
-- Build files have been written to: /root/parrot_ws/build
#### Running command: "make -j4 -l4" in "/root/parrot_ws/build"
Scanning dependencies of target _ardrone_as_generate_messages_check_deps_ArdroneActionFeedback
Scanning dependencies of target _ardrone_as_generate_messages_check_deps_ArdroneGoal
Scanning dependencies of target _ardrone_as_generate_messages_check_deps_ArdroneActionGoal
Scanning dependencies of target _ardrone_as_generate_messages_check_deps_ArdroneResult
[  0%] Built target _ardrone_as_generate_messages_check_deps_ArdroneResult
Scanning dependencies of target plugin_drone
[  1%] Building CXX object parrot_ardrone/sjtu_drone/CMakeFiles/plugin_ros_cam.dir/src/plugin_ros_cam.cpp.o
[  3%] Building CXX object parrot_ardrone/sjtu_drone/CMakeFiles/plugin_ros_imu.dir/src/plugin_ros_imu_native.cpp.o
[  5%] Building CXX object parrot_ardrone/sjtu_drone/CMakeFiles/plugin_drone.dir/src/plugin_drone.cpp.o
[  7%] Building CXX object parrot_ardrone/sjtu_drone/CMakeFiles/plugin_ros_sonar.dir/src/plugin_ros_sonar.cpp.o
[  9%] Linking CXX shared library /root/parrot_ws/src/parrot_ardrone/sjtu_drone/plugins/libplugin_ros_imu.so
[ 11%] Linking CXX shared library /root/parrot_ws/src/parrot_ardrone/sjtu_drone/plugins/libplugin_ros_sonar.so
[ 11%] Built target plugin_ros_sonar
[ 13%] Building CXX object parrot_ardrone/sjtu_drone/CMakeFiles/plugin_ros_cam.dir/src/util_ros_cam.cpp.o
[ 13%] Built target plugin_ros_imu
Scanning dependencies of target plugin_ros_init
[ 15%] Building CXX object parrot_ardrone/sjtu_drone/CMakeFiles/plugin_ros_init.dir/src/plugin_ros_init.cpp.o
[ 17%] Building CXX object parrot_ardrone/sjtu_drone/CMakeFiles/plugin_drone.dir/src/pid_controller.cpp.o
[ 19%] Linking CXX shared library /root/parrot_ws/src/parrot_ardrone/sjtu_drone/plugins/libplugin_drone.so
[ 19%] Built target plugin_drone
Scanning dependencies of target spawn_drone
[ 21%] Building CXX object parrot_ardrone/sjtu_drone/CMakeFiles/spawn_drone.dir/src/spawn_drone.cpp.o
[ 23%] Linking CXX executable /root/parrot_ws/src/parrot_ardrone/sjtu_drone/bin/spawn_drone
[ 23%] Built target spawn_drone
Scanning dependencies of target spawn_robot_tools_pkg_xacro_generated_to_devel_space_
[ 23%] Built target spawn_robot_tools_pkg_xacro_generated_to_devel_space_
Scanning dependencies of target ardrone_as_generate_messages_cpp
[ 25%] Generating C++ code from ardrone_as/ArdroneFeedback.msg
[ 27%] Generating C++ code from ardrone_as/ArdroneActionResult.msg
[ 29%] Generating C++ code from ardrone_as/ArdroneAction.msg
[ 31%] Generating C++ code from ardrone_as/ArdroneResult.msg
[ 33%] Generating C++ code from ardrone_as/ArdroneActionGoal.msg
[ 35%] Generating C++ code from ardrone_as/ArdroneGoal.msg
[ 37%] Generating C++ code from ardrone_as/ArdroneActionFeedback.msg
Scanning dependencies of target ardrone_as_generate_messages_py
[ 37%] Built target ardrone_as_generate_messages_cpp
[ 39%] Generating Python from MSG ardrone_as/ArdroneFeedback
Scanning dependencies of target ardrone_as_generate_messages_nodejs
[ 41%] Generating Javascript code from ardrone_as/ArdroneFeedback.msg
[ 43%] Generating Javascript code from ardrone_as/ArdroneActionResult.msg
[ 47%] Generating Javascript code from ardrone_as/ArdroneAction.msg
[ 47%] Generating Python from MSG ardrone_as/ArdroneActionResult
[ 49%] Generating Javascript code from ardrone_as/ArdroneResult.msg
[ 50%] Generating Javascript code from ardrone_as/ArdroneActionGoal.msg
[ 52%] Generating Python from MSG ardrone_as/ArdroneAction
[ 54%] Generating Javascript code from ardrone_as/ArdroneGoal.msg
[ 56%] Generating Javascript code from ardrone_as/ArdroneActionFeedback.msg
[ 58%] Generating Python from MSG ardrone_as/ArdroneResult
[ 58%] Built target ardrone_as_generate_messages_nodejs
Scanning dependencies of target ardrone_as_generate_messages_eus
[ 60%] Generating EusLisp code from ardrone_as/ArdroneFeedback.msg
[ 62%] Generating EusLisp code from ardrone_as/ArdroneActionResult.msg
[ 64%] Generating Python from MSG ardrone_as/ArdroneActionGoal
[ 66%] Generating EusLisp code from ardrone_as/ArdroneAction.msg
[ 68%] Generating Python from MSG ardrone_as/ArdroneGoal
[ 70%] Generating EusLisp code from ardrone_as/ArdroneResult.msg
[ 72%] Generating EusLisp code from ardrone_as/ArdroneActionGoal.msg
[ 74%] Generating Python from MSG ardrone_as/ArdroneActionFeedback
[ 76%] Generating EusLisp code from ardrone_as/ArdroneGoal.msg
[ 78%] Generating EusLisp code from ardrone_as/ArdroneActionFeedback.msg
[ 80%] Generating Python msg __init__.py for ardrone_as
[ 82%] Generating EusLisp manifest code for ardrone_as
[ 82%] Built target ardrone_as_generate_messages_py
Scanning dependencies of target ardrone_as_generate_messages_lisp
[ 84%] Generating Lisp code from ardrone_as/ArdroneFeedback.msg
[ 86%] Generating Lisp code from ardrone_as/ArdroneActionResult.msg
[ 88%] Generating Lisp code from ardrone_as/ArdroneAction.msg
[ 90%] Generating Lisp code from ardrone_as/ArdroneResult.msg
[ 92%] Generating Lisp code from ardrone_as/ArdroneActionGoal.msg
[ 94%] Generating Lisp code from ardrone_as/ArdroneGoal.msg
[ 96%] Generating Lisp code from ardrone_as/ArdroneActionFeedback.msg
[ 96%] Built target ardrone_as_generate_messages_lisp
[ 96%] Built target ardrone_as_generate_messages_eus
Scanning dependencies of target ardrone_as_generate_messages
[ 96%] Built target ardrone_as_generate_messages
[ 98%] Linking CXX shared library /root/parrot_ws/src/parrot_ardrone/sjtu_drone/plugins/libplugin_ros_cam.so
[ 98%] Built target plugin_ros_cam
[100%] Linking CXX shared library /root/parrot_ws/src/parrot_ardrone/sjtu_drone/plugins/libplugin_ros_init.so
[100%] Built target plugin_ros_init

Once the package is compiled, in every shell you need to source the parrot_ws so that ROS can find the compiled packages. In each shell you can run the commands below:

cd ~/parrot_ws/
source devel/setup.bash
rospack profile

Launching the simulation

Now that you have everything in place, you should be able to launch the simulation with the command below:

source ~/parrot_ws/devel/setup.bash

rosrun drone_construct start_simulation_localy.sh

That is it. You should now have something like the image below:

drone_construct simulation in ROSDS

drone_construct simulation in ROSDS


Moving the drone around

With the simulation running, you should now be able to make the robot take off, be able to move it and then make it land using the commands below:

rostopic pub /drone/takeoff std_msgs/Empty "{}"
rostopic pub /drone/land std_msgs/Empty "{}"

rostopic pub /drone/takeoff std_msgs/Empty "{}"
rosrun teleop_twist_keyboard teleop_twist_keyboard.py

After running rosrun teleop_twist_keyboard teleop_twist_keyboard.py you can easily move the robot using the keyboard.

So that is the post for today. You can also find a live version of this post on our YouTube channel in the link below. Also, please consider subscribing to our channel if you liked the content and press the bell for a new video every day.


Related course:



#drone #parrot #Simulation #Gazebo #Robot #rostutorials #Ubuntu

Post Edited by Miguel, Yuhong and Ruben.

Topics: drone | gazebo | ROS Q&A

Check Out These Related Posts


  1. Wimbo

    Can I mobe to real hardware after I simulate it, are there any significant changes parameters such as sensors and others? I use it for RL applications.

  2. Oliver

    Thanks for the heads up on the Parrot drone simulation. The step-by-step instructions were handy for my DIY project. I would love to see the simulation of Ryze Tello drone listed here as well: https://mydeardrone.com/brands/dji/tello/

  3. serhat

    ı have a error like that:
    serhat@serhat-VirtualBox:~$ rosrun drone_construct start_simulation_localy.sh
    [rospack] Error: package ‘drone_construct’ not found

    how can ı solve this problem ?

    • Anonymous

      I find this error too, did you solve it

    • Vishal Maddeshiya

      use command

      step .1: roscore (terminal 1)

      step 2: source ~/parrot_ws/devel/setup.bash (terminal 2) # MOST IMPORTANT

      step3: roslaunch drone_construct main.launch (terminal 2)

      step4: source ~/parrot_ws/devel/setup.bash (terminal 3) # MOST IMPORTANT

      step 5: roslaunch gazebo_ros empty_world.launch (terminal 3)

  4. Anonymous

    Hello, I have some issue that Gazebo don’t open, even though i did exactly what you have instructed

    • Anonymous

      The result said that “process has finished cleanly” but still nothing else happened. Here is the result when i run your command “rosrun drone_construct start_simulation_localy.sh”


      * /rosdistro: kinetic
      * /rosversion: 1.12.17

      gazebo (sjtu_drone/start_gzserver)
      sjtu_drone_spawn_urdf (gazebo_ros/spawn_model)

      auto-starting new master
      process[master]: started with pid [15493]

      setting /run_id to 5984a742-4529-11eb-8939-54353083af3f
      process[rosout-1]: started with pid [15506]
      started core service [/rosout]
      process[gazebo-2]: started with pid [15518]
      process[sjtu_drone_spawn_urdf-3]: started with pid [15525]
      SpawnModel script started
      [INFO] [1608732948.108913]: Loading model XML from file
      [INFO] [1608732948.109354]: Waiting for service /gazebo/spawn_sdf_model
      [INFO] [1608732949.324783]: Calling service /gazebo/spawn_sdf_model
      [INFO] [1608732949.792983]: Spawn status: SpawnModel: Successfully spawned entity
      [sjtu_drone_spawn_urdf-3] process has finished cleanly
      log file: /home/cuongchutan/.ros/log/5984a742-4529-11eb-8939-54353083af3f/sjtu_drone_spawn_urdf-3*.log

      • Vishal Maddeshiya

        i was also facing same problem, my Gazeo did not opening but gave some time ,again and again watch video then get the solution.

        step .1: roscore (terminal 1)

        step 2: source ~/parrot_ws/devel/setup.bash (terminal 2)

        step3: roslaunch drone_construct main.launch (terminal 2)

        step4: source ~/parrot_ws/devel/setup.bash (terminal 3)

        step 5: roslaunch gazebo_ros empty_world.launch (terminal 3)

        • smile

          Hi,I did what you said,but my gazebo just can not open,it just loading………what can i do?

  5. Abdullah

    Everything worked fine. However, I have one question. How can I respown multiple drones & publish data to each one of them individually.

    I followed your instructions regarding including the model to the world and i did successfully respown two drones. However, when I publish data to the main one, the data gets published to both.

  6. Anonymous

    I’m using ROS Noetic and it nearly runs smoothly. Although I can make the drone to takeoff and land, I cannot control the drone with my keyboard. Everytime I run the command “rosrun teleop_twist_keyboard teleop_twist_keyboard.py”, it said: “[rospack] Error: package ‘teleop_twist_keyboard’ not found”.
    Can you help me solve this pls!

    • Anonymous

      Did you get the answer

  7. Amar Behera

    Hi, I am able to get the drone to run locally. However, when I try to start the action server, I get the following error –

    … logging to /home/amar/.ros/log/8c96c174-6297-11ec-ac95-b13131e1c3a6/roslaunch-amar-VirtualBox-3953.log
    Checking log directory for disk usage. This may take a while.
    Press Ctrl-C to interrupt
    Done checking log file disk usage. Usage is <1GB.

    started roslaunch server http://localhost:36683/


    * /rosdistro: noetic
    * /rosversion: 1.15.13

    ardrone_as (ardrone_as/action_server.py)


    RLException: Roslaunch got a 'No such file or directory' error while attempting to run:

    /home/amar/parrot_ws/src/parrot_ardrone/ardrone_as/scripts/action_server.py __name:=ardrone_as __log:=/home/amar/.ros/log/8c96c174-6297-11ec-ac95-b13131e1c3a6/ardrone_as-1.log

    Please make sure that all the executables in this command exist and have
    executable permission. This is often caused by a bad launch-prefix.
    The traceback for the exception was written to the log file


Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This