So, when I try to run this particular part of the script:
if data.buttons[4]:
while not data.buttons[5]:
motor_msg.data=int(70)
pub_motor0.publish(motor_msg)
if data.buttons[6]:
while not data.buttons[7]:
motor_msg.data=int(60)
pub_motor0.publish(motor_msg)
data.buttons come from a Joy node. When I press button 5 or 6 after button 4 being pressed and the loop initialized it doesn't update the value of button5 or 6 in eyes of the loop. Why is it? Thanks a lot guys ^^
Edit: I wanted to command my robot to walk in a straight line on the activation on button4 indefinetly unless i pressed button 5. The point is that on activation of button5 the data stays at 0, annd I don't know how to force the re-read of variables and as you said, nothing updates the variable's value. I put this part in the callback function.
reedit: Yeah! I was writing a whole new node and looking for a way to make it republish a different velocity message everytime but you are right, it is likely that you are totally right and I don't need to re-update the value of velocity. It is rpetty much what you said! Thanks a lot. When I get to the lab I'll try the new code ^^
Originally posted by koboy on ROS Answers with karma: 5 on 2017-12-24
Post score: 0