IndexError: index 0 is out of bounds for axis 0 with size 0
See original GitHub issueI was trying with my own configuration but it gives this error for my scenario:
---
GOAL:
- !!python/tuple [9, 5]
- !!python/tuple [2, 2]
- !!python/tuple [6, 5]
- !!python/tuple [4, 10]
GRID_SIZE: 12
RECT_OBSTACLES:
0:
- [1, 7]
- [3, 9]
1:
- [8, 3]
- [9, 4]
2:
- [3, 1]
- [4, 3]
3:
- [8, 9]
- [9, 10]
ROBOT_RADIUS: 2
START:
- !!python/tuple [0, 0]
- !!python/tuple [0, 11]
- !!python/tuple [2, 11]
- !!python/tuple [2, 0]
Error:
Traceback (most recent call last):
File "visualizer.py", line 146, in <module>
r = Simulator()
File "visualizer.py", line 28, in __init__
self.planner = Planner(GRID_SIZE, ROBOT_RADIUS, static_obstacles)
File "/home/sayan/anaconda3/lib/python3.8/site-packages/cbs_mapf/planner.py", line 31, in __init__
self.st_planner = STPlanner(grid_size, robot_radius, static_obstacles)
File "/home/sayan/anaconda3/lib/python3.8/site-packages/stastar/planner.py", line 30, in __init__
self.neighbour_table = NeighbourTable(self.grid.grid)
File "/home/sayan/anaconda3/lib/python3.8/site-packages/stastar/neighbour_table.py", line 15, in __init__
dimy, dimx = len(grid), len(grid[0])
IndexError: index 0 is out of bounds for axis 0 with size 0
Seems like my yaml file is wrong. Could you help me figure that out.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
What does 'index 0 is out of bounds for axis 0 with size 0' mean?
This is an IndexError in python, which means that we're trying to access an index which isn ...
Read more >IndexError: index 0 is out of bounds for axis 0 with size 0
The Python "IndexError: index 0 is out of bounds for axis 0 with size 0" occurs when we try to access the first...
Read more >IndexError: Index 0 is Out of Bounds for Axis 0 With Size 0 in ...
This error occurs when a list item is attempted to be accessed at an out-of-bounds index.
Read more >indexerror: index 0 is out of bounds for axis 0 with size 0
The Python IndexError: index 0 is out of bounds for axis 0 with size 0 occurs when we try to access the first...
Read more >Pandas IndexError: index 0 is out of bounds for axis 0 with size 0
The error points me towards homologene_id. values[0] in the final hgnc portion, but I can't figure out why.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for the late reply, but @gitLouis is correct on this issue. In my original use case, I had a 1080p raw grid (from a camera feed) and did not require such a high resolution (plus it’s very slow to plan on such a big grid).
grid_size
effectively splits your raw grid into patches, set it to 1 otherwise.to my understanding grid_size is defining the size of each “square” in the grid (aka edge-length). For instance, grid_size = 1 means that the state space is [[0,0],[0,1],[1,0],[1,1], …] grid_size = 2 means that the state space is [[0,0],[0,2],[2,0],[2,2], …]. grid_size =30 means that the state space is [[0,0],[0,30],[30,0],[30,30], …].
Then if you put static_obstacle or location off this grid it is rounded to the grid. e.g. if grid_size = 30 and obstacle is on (5,5) then it might be removed or rounded to (0,0). I didn’t check the exact rounding procedure and behavior here.
The state-space boundaries are then defined by the minimal and maximal obstacles. see for instance in
calculate_boundaries
wheremin_ = np.min(static_obstacles, axis=0)
In @sayan1999’s code all the values are smaller than grid-size, hence the weird behavior (maybe all the obstacles and the locations are rounded down to (0,0)). probably you are getting zero-dimension grid.
on the other hand, in @itaihay’s example, you already have at least 2 actual points. grid_size=50 and you have obstacles in (0,0) but also (50, 25 ) is rounded to grid point (50,0) and therefore you have a proper grid.