Synchronizing a move command
The goal is to move the robot to a destination point if it is not the same as the old destination point which it has already reached. Here is the final segment of the code that i am trying to tackle.
while not rospy.is_shutdown():
if last_destination_point == destination_point :
reached_check = 1
else:
reached_check = 0
move_to(destination_point)
last_destination_point = destination_point
print "send new destination point now"
rospy.sleep(3)
print "wait a sec.."
This supposed to give a small time interval for the user to send a new destination point which is published using the command line. But the last_destination point is just becoming destination_point automatically thereby failing the check.
P.S. move_to only executes when the reached_check is 0.
Any suggestions as to how to solve this? I think using a service-client mechanism might solve this but i don't exactly know how that works so i have been staying away from it