callback not working
Hello Everyone, I have problem with my subscriber my code is as bellow, the problem is that, the callback function is not executed, and I cannot see the topic /test in my topic list. Thank you so much in advance.
Best,
def callback(msg):
print("in callback right")
position_right[0] = msg.pose.position.x
position_right[1] = msg.pose.position.y
position_right[2] = msg.pose.position.z
print "position_x = %s" % position_right[0]
orientation_right[0] = msg.pose.orientation.x
orientation_right[1] = msg.pose.orientation.y
orientation_right[2] = msg.pose.orientation.z
orientation_right[3] = msg.pose.orientation.w
pub = rospy.Publisher('/test', Float32 , queue_size=10)
pub.publish('orientation_right')
def listener():
rospy.init_node('listener', anonymous=True)
print("in sub***************")
rospy.Subscriber("robot/limb/right/endpoint_state",EndEffectorState, callback)
if __name__ == '__main__':
listener()
rospy.spin()