Open MathewMacDougall opened 4 years ago
As discussed off-line, robot_filter.cpp
does not keep track of time. It was decided it's worth revisiting to figure out how to refactor to make this ticket more possible. It will be put into triage
for the time being.
Probably the best thing for this ticket is to refactor getFilteredData and update the comments with this observation
Description of the task
The RobotFilter does not properly remove robots if
getFilteredData
is called with an empty vector.This can and should be reproduced with a unit test before fixing to make sure it does indeed get fixed and to prevent future regressions.
File:
software/sensor_fusion/filter/robot_filter.cpp
In
getFilteredData
, if the function is called with an empty vector the first loop does not run. Therefore when we get to thedata_num == 0
check, we still have the temporarylatest_timestamp
Timestamp
that was created above. Because this value is 0, it will never be greater than the expiry buffer + the latest robot timestamp, so the function will never returnstd::nullopt
indicating the robot is no longer detected. Instead it will always return the most recent robot state stored by the class.This should be fixed so that robots that do not appear in a detection for longer than the
expiry buffer
get reported as "nonexistent" by theRobotFilter
, even when the function is called with an empty vector repeatedly.Acceptance criteria
getFilteredData
is called with an empty vectorBlocked By