hector_quadrotor not responding cmd_vel message
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 '/cmdvel' and then I check the state with /gazebo/getmodel_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, shareddata, velocityTopic='/cmdvel'):
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.
Asked by Catherine Wong on 2012-10-30 16:50:51 UTC
Comments
What is the result of rostopic info /cmd_vel and rostopic list (when your nodes are all running?)
Asked by SL Remy on 2012-10-31 03:23:20 UTC