hector_quadrotor not responding cmd_vel message [closed]

asked 2012-10-30 16:50:51 -0600

Catherine Wong gravatar image

updated 2012-10-30 16:51:28 -0600

Hello, I am having the 1.6.16s ros-fuerte-simulator gazebo with Ubuntu 12.04 (64bit). I am having a similar problem as this post:

link:Hector_Quadrotor Gazebo - Quadrotor x/y position does not update

The difference is I can control the quadrotor in the two demos but not when I tried to control the robot with my own code. The one extra thing is my robot pose is not updated as well after I publish the msg. So basically right now when I publish a twist message to '/cmd_vel' and then I check the state with /gazebo/get_model_state', the linear and angular component under twist are all zero. Does anyone know why? Here's my code (without the part that I set my robot's pose):


def __init__(self, proj, shared_data, velocityTopic='/cmd_vel'):

    self.pose_handler = proj.h_instance['pose']
    print self.pose_handler.model_name
    try:
        #open a publisher for the base controller of the robot
        self.pub = rospy.Publisher(velocityTopic, Twist)

        # for the pr2, use /base_controller/command
        # the turtlebot takes /cmd_vel
    except:
        print 'Problem setting up Locomotion Command Node'


def sendCommand(self, cmd):

    #Twist is the message type and consists of x,y,z linear velocities
    #and roll, pitch, yaw orientation velocities (x,y,z)
    twist=Twist()

    #Positive x is forward on robots in Gazebo
    twist.linear.x=cmd[0]*4   

    #Angluar z is yaw or rotation in the xy plane
    twist.angular.z=cmd[1]*1.5

    try:
        #Publish the command to the robot
        self.pub.publish(twist)
        rospy.wait_for_service('/gazebo/get_model_state')
        gms = rospy.ServiceProxy('/gazebo/get_model_state', GetModelState)
        resp = gms(self.pose_handler.model_name,'world')
        print >>sys.__stdout__,'resp:' + str(resp)
    except:
        print 'Error publishing Twist Command'

Thank you for your help.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-09-18 18:45:32.209794

Comments

1

What is the result of rostopic info /cmd_vel and rostopic list (when your nodes are all running?)

SL Remy gravatar imageSL Remy ( 2012-10-31 03:23:20 -0600 )edit