i am using ar track alvar to recieve co ordinates from my camera... The data seems to be fine but i want to use this data.For this i made a subscriber as below
start = (0,0)
def callback(msg):
x=msg.pose.position.x
y=msg.pose.position.y
rospy.loginfo(rospy.get_caller_id() + "I heard x = %f", x)
rospy.loginfo(rospy.get_caller_id() + "I heard y= %f", y)XPos1 =x
YPos1 =y
XPos1 += 0.11
YPos1 += 0.1
XPos1 = XPos1 * 22.69
YPos1 = YPos1 * 24
XPos1 = round(XPos1) -1
YPos1 = round(YPos1)
XPos1 =int(XPos1)
YPos1= int(YPos1)
start = (XPos1,YPos1)
print start
print start
where start is a global variable which i initialize in the begining as start(0,0) but when my code is executed even though this call back function is invoked as i can see the value of x and y on terminal and the value of start ( which is a global variable) is also what i expected but as soon as the program exits callback function the the last print statement prints (0,0) as the value of start (which is what i initialized start variable to in the begining of program as global variable) This is the Output
[INFO] [1535398460.244633]: /listener_11195_1535398438793I heard x = 1.294724
[INFO] [1535398460.250098]: /listener_11195_1535398438793I heard y= -0.089722
(31, 0)
^C(0, 0)
Originally posted by Sufyan on ROS Answers with karma: 17 on 2018-08-27
Post score: 0