Global variable x is not defined
Hello guy ! I am getting a following error Global variable x is not defined.
def where1(msg):
global x1
x1 = msg.data
def where2(msg):
global y1
y1 = msg.data
def ground():
global cmd
cmd = rospy.Publisher("/atrv/motion", Twist)
rospy.init_node("ground")
rospy.Subscriber("/box_positiona", Float64, where1)
rospy.Subscriber("/box_positionb", Float64, where2)
print x1
print y1
rospy.spin() # this will block untill you hit Ctrl+C
if __name__ == '__main__':
ground()
Thanks, looking forward for answers
Please copy and paste error message directly.
NameError: global name 'x1' is not defined