Rosanswers logo


my problem is that after I send a takeoff message to my drone (in gazebo) it doesn't stop taking off. It keeps moving upwards until I publish to land topic. I would like it to hover in place or at least fly forward WITHOUT FLYING UP. I couldn't find any command to stop takeoff.

This is an example of a script that I've tried (takeoff than hover and finally land):

if __name__ == '__main__':
        rospy.init_node('fly_x_meters', anonymous=True)
        rate = rospy.Rate(10)  # 10hz
        pub_takeoff = rospy.Publisher("ardrone/takeoff", Empty, queue_size=1)
        pub_land = rospy.Publisher("ardrone/land", Empty, queue_size=1)
        pub_twist = rospy.Publisher("cmd_vel", Twist, queue_size=1)
        pub_reset = rospy.Publisher("ardrone/reset", Empty, queue_size=10)

        hover_msg = Twist()
        hover_msg.linear.x = 0
        hover_msg.linear.y = 0
        hover_msg.linear.z = 0
        hover_msg.angular.x = 0
        hover_msg.angular.y = 0
        hover_msg.angular.z = 0

        # starts simulated clock
        while rospy.get_time() == 0:

        start_time = rospy.get_time()

        while not rospy.is_shutdown():
            if rospy.get_time() < start_time+3.0:
            elif rospy.get_time() > start_time+10.0:
            elif rospy.get_time() > start_time+8.0:

    except rospy.ROSInterruptException:

In navdata topic I only get two states during running this script: 2-takeoff and 6-land. No hover or fly.

I tried publishing only once to takeoff, latching, nothing helped. I tried flying forward/rotating instead of hovering, but it still keeps moving up (while moving forward). I'm new to ROS, sorry if it's a dumb question, but could anybody help me, please?

Note: using https://github.com/angelsantamaria/tum_simulator

My spawn_quadrotor.launch file:

   <arg name="model" default="$(find cvg_sim_gazebo)/urdf/quadrotor.urdf.xacro"/>
   <arg name="x" default="0"/>
   <arg name="y" default="0"/>
   <arg name="z" default="0.5"/>
   <arg name="R" default="0"/>
   <arg name="P" default="0"/>
   <arg name="Y" default="0"/>
   <!-- send the robot XML to param server -->
   <param name="robot_description" command="$(find xacro)/xacro.py '$(arg model)' --inorder" />
   <!-- push robot_description to factory and spawn robot in gazebo -->
   <node name="spawn_robot" pkg="gazebo_ros" type="spawn_model"
   args="-param robot_description
   -x '$(arg x)'
   -y '$(arg y)'
   -z '$(arg z)'
   -R '$(arg R)'
   -P '$(arg P)'
   -Y '$(arg Y)'
   -model quadrotor"
     respawn="false" output="screen"/>
   <!-- start robot state publisher -->
   <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen" >
     <param name="publish_frequency" type="double" value="50.0" />
     <param name="tf_prefix" type="string" value="" />

   <node name="ground_truth_to_tf" pkg="message_to_tf" type="message_to_tf" output="screen">
     <param name="odometry_topic" value="ground_truth/state" />
     <param name="frame_id" value="nav" />
   <!-- node name="hector_pose_estimation" pkg="hector_pose_estimation" type="hector_pose_estimation_node" output="screen"/-->


My quadrotor_sensors.urdf.xacro file:

<?xml version="1.0"?>

<robot name="quadrotor_hokuyo_utm30lx"
    <xacro:property name="M_PI" value="3.1415926535897931" />
    <!-- Included URDF Files -->
    <xacro:include filename="$(find cvg_sim_gazebo)/urdf/quadrotor_base.urdf.xacro" />
    <!-- Instantiate quadrotor_base_macro once (has no parameters atm) -->
    <quadrotor_base_macro />

    <!-- Sonar height sensor -->
    <xacro:include filename="$(find cvg_sim_gazebo)/urdf/sensors/sonar_sensor.urdf.xacro" />
    <xacro:sonar_sensor name="sonar" parent="base_link" ros_topic="sonar_height" update_rate="10" min_range="0.01" max_range="3.0" field_of_view="${40*M_PI/180}" ray_count="3">
      <origin xyz="-0.15 0.0 0.0" rpy="0 ${90*M_PI/180} 0"/>

    <!-- Hokuyo UTM-30LX mounted upside down below the quadrotor body 
    <xacro:include filename="$(find cvg_sim_gazebo)/urdf/sensors/hokuyo_utm30lx.urdf.xacro" />
    <xacro:hokuyo_utm30lx name="laser0" parent="base_link" ros_topic="scan" update_rate="40" ray_count="1081" min_angle="135" max_angle="-135">
      <origin xyz="0.0 0.0 0.08" rpy="${M_PI} 0 0"/>
    <!-- The following two cameras should be united to one! -->
    <!-- Forward facing camera -->
    <xacro:include filename="$(find cvg_sim_gazebo)/urdf/sensors/generic_camera.urdf.xacro" />
    <xacro:generic_camera name="front" sim_name="ardrone" parent="base_link" update_rate="60" res_x="640" res_y="360" image_format="R8G8B8" hfov="${81*M_PI/180}">
      <origin xyz="0.21 0.0 0.01" rpy="0 0 0"/>

    <!-- Downward facing camera -->
    <xacro:include filename="$(find cvg_sim_gazebo)/urdf/sensors/generic_camera.urdf.xacro" />
    <xacro:generic_camera name="bottom" sim_name="ardrone" parent="base_link" update_rate="60" res_x="640" res_y="360" image_format="R8G8B8" hfov="${81*M_PI/180}">
        <origin xyz="0.15 0.0 0.0" rpy="0 ${M_PI/2} 0"/>

Originally posted by patricia on ROS Answers with karma: 46 on 2017-08-30

Post score: 1

Original comments

Comment by jayess on 2017-08-30:
What packages are you using (links are helpful)?

Comment by patricia on 2017-08-30:
tum simulator: https://github.com/angelsantamaria/tum_simulator

and ros kinetic from the official webpage: http://wiki.ros.org/kinetic/Installation

Comment by jayess on 2017-08-30:
This is from the original repository of the tum_simulator, but it may be relevant https://github.com/tum-vision/tum_simulator/issues/12

Comment by patricia on 2017-08-31:
I added the two mentioned files to my question, but I can't see what's wrong with them.


1 Answer 1


Rosanswers logo

Amazing! Thank you mahe_antoine! :)

I tried installing some hector packages that seemed relevant to me, to be precise I did this:

sudo apt-get install ros-kinetic-hector-gazebo
sudo apt-get install ros-kinetic-hector-sensors-gazebo
sudo apt-get install ros-kinetic-hector-xacro-tools

Not sure which one, but one of them must have fixed it because it works perfectly now :)

Originally posted by patricia with karma: 46 on 2017-09-15

This answer was ACCEPTED on the original site

Post score: 2


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.