spencer-project / spencer_people_tracking

Multi-modal ROS-based people detection and tracking framework for mobile robots developed within the context of the EU FP7 project SPENCER.
http://www.spencer.eu/
656 stars 326 forks source link

filter_tracks_confirmed crashes #97

Open kaushikbalasundar opened 3 years ago

kaushikbalasundar commented 3 years ago

Hello!

I am using a realsense camera to run only the upper body detector. While everything works as it should when initially launched, I get the following error after about 2-3 minutes and the filter_tracks_confirmed_by_by_HOG dies. What could be the issue?

` [spencer/perception_internal/people_tracking/post_processing/filter_tracks_confirmed_by_HOG-33] process has died [pid 6199, exit code -11, cmd /opt/ros/melodic/lib/spencer_tracking_utils/filter_visually_confirmed_tracks input_tracks:=/spencer/perception/tracked_persons_orientation_fixed output_tracks:=/spencer/perception/tracked_persons_confirmed_by_HOG composite_detected_persons:=/spencer/perception/detected_persons_composite name:=filter_tracks_confirmed_by_HOG log:=/home/ugv01/.ros/log/06b55506-ae34-11eb-8939-1c697a66977f/spencer-perception_internal-people_tracking-post_processing-filter_tracks_confirmed_by_HOG-33.log].
log file: /home/ugv01/.ros/log/06b55506-ae34-11eb-8939-1c697a66977f/spencer-perception_internal-people_tracking-post_processing-filter_tracks_confirmed_by_HOG-33.log
[spencer/perception_internal/people_tracking/post_processing/filter_tracks_confirmed_by_upper_body-34] process has died [pid 6206, exit code -11, cmd /opt/ros/melodic/lib/spencer_tracking_utils/filter_visually_confirmed_tracks input_tracks:=/spencer/perception/tracked_persons_orientation_fixed output_tracks:=/spencer/perception/tracked_persons_confirmed_by_upper_body composite_detected_persons:=/spencer/perception/detected_persons_composite __name:=filter_tracks_confirmed_by_upper_body __log:=/home/ugv01/.ros/log/06b55506-ae34-11eb-8939-1c697a66977f/spencer-perception_internal-people_tracking-post_processing-filter_tracks_confirmed_by_upper_body-34.log].
log file: /home/ugv01/.ros/log/06b55506-ae34-11eb-8939-1c697a66977f/spencer-perception_internal-people_tracking-post_processing-filter_tracks_confirmed_by_upper_body-34
.log
`

BIRL-xu commented 1 year ago

I found this issue caused by erasing the std::map with a wrong way here The issue codes(commented the issue by me):

    for(std::map<track_id, ros::Time>::const_iterator trackIt = g_trackLastSeenAt.begin(); trackIt != g_trackLastSeenAt.end(); trackIt++) {
        if(currentTime - trackIt->second > ros::Duration(5.0) || currentTime < trackIt->second) {
            track_id trackId = trackIt->first;
            g_trackLastSeenAt.erase(trackId); // trackIt is invalid after erase.
            g_actualMatchesPerTrackAndModality.erase(trackId);
            g_confirmedTracks.erase(trackId);
        }
    }

, and I modified that to

    for(std::map<track_id, ros::Time>::const_iterator trackIt = g_trackLastSeenAt.begin(); trackIt != g_trackLastSeenAt.end();) {
        if(currentTime - trackIt->second > ros::Duration(5.0) || currentTime < trackIt->second) {
            track_id trackId = trackIt->first;
            trackIt = g_trackLastSeenAt.erase(trackIt);
            g_actualMatchesPerTrackAndModality.erase(trackId);
            g_confirmedTracks.erase(trackId);
        }
        else
        {
            trackIt++;
        }

, the crash disappeared! May be it is a bug? @tlind