Repository navigation
Add unit tests for CostMap - #332
Open
TheSamarthMehta wants to merge 1 commit into
Open
TheSamarthMehta wants to merge 1 commit into
TheSamarthMehta wants to merge 1 commit into
Conversation
Check the cost that CostMap stores in each grid: two points in the same grid add the cost twice, other grids stay at zero, the cost is capped at max_cost, set_cost() clamps between free_cost and max_cost, and get_cost() returns None outside the map.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds unit tests for
CostMap(src/components/mapping/cost/cost_map.py). Until nowtest_cost_grid_map_construction.pyonly ran the simulation, so nothing checked the cost stored in each grid.The new
test/test_cost_map.pyuses a small 10 m x 10 m map with 1 m grids and checks:cost_increment=1.0give that grid a cost of 2, and every other grid stays at 0max_cost, both in oneupdate_map()call and over many callsset_cost()keeps a value inside the range and clamps values abovemax_costand belowfree_costget_cost()returnsNonefor positions outside the map, including the far edgeCloses #301
Part of #103
How I checked it works
python -m pytest test/test_cost_map.py -v: 8 passed. run_test_suites.sh: 183 passedcost_map.pyon purpose to make sure the tests catch it: removing themax_costcap inupdate_map(), removing the clamp inset_cost(), and counting each grid only once each made two tests fail.Images
Tests only, nothing changed under
src/, so no images needed.Book