how to save data subscriber to a variabel
i'd like to try save data from subscriber to a variabel for my condition statement, but when i launch my program, program only execute the subscriber only but not the condition
this is my program
class sukreb():
def __init__(self):
rospy.init_node('sukreb')
rospy.Subscriber('mode',std_msgs.msg.String, self.callback)
# rospy.Subscriber()
rospy.spin()
def callback(self,data):
mode = data
return mode
if(mode == "a"):
lowobj = lowMagenta
upobj = upMagenta
if(mode == "b"):
lowobj = lowCyan
upobj = upCyan