Open mythrai opened 3 months ago
Hi, would it be possible for you to share your code? I think the most straightforward solution would be to create your own node based on spatial_bb
, since then you will have access to the same data that the markers are created with
For our project, we're trying to use the depthai_filters package to detect objects and we want to send the detection data to the robot arm it'll be attached to. We wrote a ros node that is subscribed to the /spatial_bb topic. The node is of the type and within the spatial_bb.cpp file, there's a publisher declared (markerPub) that is publishing data of the type as well.
The issue comes about when we've been trying to display the data that our subscriber node is receiving. When we try to print msg.markers directly, it prints an address when the camera detects an object (which makes sense since markers is an array). When we try to print an element of the markers array (like msg.markers[0]), we get a segmentation fault once the camera isn't actively detecting something (since the array is empty) and an address/nonsense when it does detect something. We specifically want to access the 'text' field of the markers array as it tells you what's been detected, but we're only able to access the 'text' field within the visualization_msgs::msg::Marker namespace. When we write the node in that namespace however, we are unable to receive data from the spatial_bb.cpp markerPub publisher since its data is of the MarkerArray type.
How should we go about writing a subscriber that successfully receives the markerPub data from spatial_bb.cpp and is able to print it?