I am receiving data from a topic, I subscribed to this topic in a separate node I want to do some mathematical operation on these data but I get an error this is the code
def __init__(self):
rospy.init_node('extreme_values', annonymous=True)
self.x= rospy.subscriber('x_values', float32, callback)
self.y= rospy.subscriber('y_values', float32, callback)
self.theta= rospy.subscriber('theta_values', float32, callback)
self.extreme = (self.x - self.y) + ((self.x * self.y) * cos(self.theta))
What you have done was wrong, you could try something to similar to bellow,
rospy.subscriber
does not return anything, however when messages come corresponding callback, i.e., callback_xvalues, triggered, so your logic should be implemented inside one of those call backs, i.e., callback_zvalues. Do not register a same callback for a different topic, it is not recommended. Let me know you get the idea