while loop only executes subscriber callback()
Hi,
the key code parts:
def callback(data):
global value
value = data.data
def listener():
#init.node and creating a subscriber for a topic are performed
if __name__ == "__main__":
listener()
while not rospy.is_shutdown():
print('inside main')
rospy.spin()
My problem is that the print statement 'inside main' is executed only once and I don't understand why, shouldn't it be looping for as long as the rospy is up and running? However, after rospy.spin() the callback() function is executed constantly, but the print statement is not repeated.
Thanks.