I am using darknet_ros_3d package and writing a subscriber. So far, I have followed the code given as under:
import rospy
from sensor_msgs.msg import Image
from darknet_ros_msgs.msg import BoundingBoxes
from std_msgs.msg import Header
from std_msgs.msg import String
def callback(data):
for box in data.bounding_boxes:
rospy.loginfo(
"Xmin: {}, Xmax: {} Ymin: {}, Ymax: {}".format(
box.xmin, box.xmax, box.ymin, box.ymax
)
)
def main():
while not rospy.is_shutdown():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber('/darknet_ros/bounding_boxes', BoundingBoxes , callback)
rospy.spin()
if __name__ == '__main__':
try :
main()
except rospy.ROSInterruptException:
pass
How can I save the values coming from Xmin: {}, Ymin: {}, etc. into the variables for the later usage?