Problems with publishing a cmd_vel message
Hey,
I am just trying to send my robot a msg that he starts moving forward. When it comes to receiving a msg, I can use rospy.wait_for_message to be sure that one has received that one. When it comes to moving the bot around, normally that worked well with the following code:
def moving(self):
self.pub_cmd_vel = rospy.Publisher('cmd_vel', Twist, queue_size=5)
vel_cmd = Twist()
vel_cmd.linear.x = 0.1
self.pub_cmd_vel.publish(vel_cmd)
But the robot wasn´t moving. That´s why I implemented this code, which was working again:
def moving(self):
self.pub_cmd_vel = rospy.Publisher('cmd_vel', Twist, queue_size=5)
self.finish = True
while self.finish:
vel_cmd = Twist()
vel_cmd.linear.x = 0.1
self.pub_cmd_vel.publish(vel_cmd)
My question is now, why is the one option working but the other don´t.
Thanks for your help!
Can you confirm your loop is running with a print or something?
Yes it is running. When i have a print the terminal is full of it. I am thinking about the
while not rospy.is_shutdown
, that might be missing