Open mengyuest opened 6 years ago
@mengyuest Do you solve the problem or has any clue about this problem? I have the same issue here.
Yes, though tough for me at first. Notice that they have three buffers to handle things(cache image, detection and publishing) in different stages (like in a pipeline, for raising the throughput I guess). So you need to fetch data in correct index, or will in wrong order. My solution is to also set buffers for headers. When receiving an image, save its header to the corresponding index(same as the index of image buffers) of header buffers, and finally when publishing messages, extract the corresponding header from header buffers. Or you can try to remove all the threads and handle things in one strict sequence as an image callback function (I tried, but got efficiency lost).
@mengyuest Thanks a lot. Will work on it later. BTW: is it possible for you to share your darknet ros package?
@mengyuest @rpfly3 Hi. Potentially fixed. Only tested on my setup. Would appreciate other people testing it.
PR here: https://github.com/leggedrobotics/darknet_ros/pull/113 Branch for testing here: https://github.com/Texas-Aerial-Robotics/darknet_ros/tree/headerFixForUpsteam
@umer936 Thanks a lot. Will checkout
You can always change the header that is being published in darknetros/src/YoloObjectDetector.cpp line 622. This might do the work: boundingBoxesResults.imageheader = headerBuff[(buffIndex + 1) % 3]; //boundingBoxesResults.header.stamp = ros::Time::now(); //line replaced by the next one boundingBoxesResults.header.stamp = boundingBoxesResults.image_header.stamp;
Hi. I am trying to sync boundingboxes with images and I am using message filter to do that. Before that I also modified the header of bbx using
_imageHeader
. Then I found out the message doesn't coordinate to each other between bbx and images. I used an image publisher working at 0.2Hz and it publishes two pictures in turns. I usedrostopic echo /darknet_ros/bounding_boxes
to check the message and got the output below.(Followed with an analysis of this sequence)Actually there are only two timestamps "1532613366.48888444" and "1532613371.51276922" with five frames("sheep*7", "sheep*7", "sheep*7", "bicycle, car", "bicycle, car"), as the node keeps publishing bbxs at some other frequency. The first timestamp corresponds with an image with sheep, whereas the second timestamp is about cars. In the middle of the sequence there are two frames (57527,57528) that the bbxs have the timestamp with "1532613371.51276922" but detecting "sheep", which can be seen as a wrong correspondency between image and bbx. I wonder why that will happen, and are there any ways to fix that? Thanks.
If any help, here is my image_publisher code.