Ask Your Question

hector_quadrotor not listening to teleop_twist_keyboard

asked 2015-05-13 23:48:38 -0500

AbdealiJK gravatar image

I'm using hector_quadrotor, and am trying to get a simple quadrotor moving in it using my keyboard.

I run the demo using roslaunch hector_quadrotor_demo outdoor_flight_gazebo.launch and it gives out a few messages which can be seen here (There are no errors, but a few warnings are there)

Then I run rosrun teleop_twist_keyboard which gives out the following output

When i press u,i,o,j,k,l,m ... nothing happens

My understanding is that they send/recv messages on /cmd_vel to talk to each other. So, I read that I can see that using rostopic info /cmd_vel and i get :

Type: geometry_msgs/Twist

 * /teleop_twist_keyboard (http://ajk-VPCSB38GG:49644/)

 * /gazebo (http://ajk-VPCSB38GG:46506/)

So, it seems both are connected to the node, and rostopic echo /cmd_vel gives:

$ rostopic echo /cmd_vel
WARNING: no messages received and simulated time is active.
Is /clock being published?
  x: 0.5
  y: 0.0
  z: 0.0
  x: 0.0
  y: 0.0
  z: 1.0

when I press u in the teleop_twist_keyboard. So, it seems to be sending, but the hector_quadrotor_demo isn't catching it.

A bit more info : I am using Ubuntu 14.04 and ROS indigo. I installed all packages using the Ubuntu ppa for ROS and apt-get.

edit retag flag offensive close merge delete


Yeah, even I am facing the same issue!!!

creative_cimmons gravatar image creative_cimmons  ( 2015-06-06 17:09:19 -0500 )edit

Same for myself.

c123 gravatar image c123  ( 2015-06-07 06:19:40 -0500 )edit

I guess the problem is because of missing imu plugin,, could anybody debug that!!!

creative_cimmons gravatar image creative_cimmons  ( 2015-06-09 22:40:09 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2015-06-10 07:12:51 -0500

AbdealiJK gravatar image

updated 2015-06-10 07:16:06 -0500

So, as there has been no answer - I am posting the solution I found myself... It seems the We wrote a code to teleop_twist_keyboard doesn't give the quadrotor linear z velocity to go upward. So, if you start the quadrotor at a height (let's say 1000 m) ... while it falls down you can move left/right and so on.

We wrote our own module to test it out which works. Here's the code :

#!/usr/bin/env python

import rospy
import Tkinter as tk
import threading
import thread
import time
from geometry_msgs.msg import Twist
import pygame, sys

def talker():
    global clock

    pub = rospy.Publisher('cmd_vel', Twist, queue_size=10)
    rospy.init_node('controller', anonymous=True)
    rate = rospy.Rate(10) # 10hz
    while not rospy.is_shutdown():
        msg = Twist()
        for event in pygame.event.get():
            if event.type == pygame.QUIT:

        array = pygame.key.get_pressed()
        if array[pygame.K_UP]:
            msg.linear.z = 1;
        elif array[pygame.K_DOWN]:
            msg.linear.z = -1;

        if array[pygame.K_w]:
            msg.linear.y = 1;
        elif array[pygame.K_s]:
            msg.linear.y = -1;

        if array[pygame.K_d]:
            msg.linear.x = 1;
        elif array[pygame.K_a]:
            msg.linear.x = -1;


size = [100, 100]
screen = pygame.display.set_mode(size)
clock = pygame.time.Clock()

if __name__ == '__main__':
    # threading.Thread(target=tk_func())    
    except rospy.ROSInterruptException:
edit flag offensive delete link more

answered 2015-06-16 15:05:44 -0500

creative_cimmons gravatar image

And here is the link to cpp version.

I am not sure about the 1000 m initialization,, I don't think that is required

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2015-05-13 23:44:19 -0500

Seen: 430 times

Last updated: Jun 16 '15