My question is how to pass a value from one subscriber's callback function to another.
does this make sense ?
import rospy
from sensor_msgs.msg import LaserScan, Int32
from xxx2.msg import xxyy2
global x
x = None
def callback2(data):
x=data[0]
def callback(data):
if x > data.ranges[0]:
print("nice")
rospy.Subscriber("/scan", LaserScan, callback)
rospy.Subscriber("topic", xxyy2, callback2)
rospy.spin()