I have a particular **Grid ** for robot navigation showing as so:
I have scaled this by a factor of 10 to create my Environment. This is given in Cartesian coordinates
I would like to map a point in the Environment (x,y) into Grid index (row, col)
The obstacle format is given in the form:
[[(60.0, 0.0), (70.0, 0.0), (70.0, 10.0), (60.0, 10.0)],
[(70.0, 0.0), (80.0, 0.0), (80.0, 10.0), (70.0, 10.0)],
[(60.0, 10.0), (70.0, 10.0), (70.0, 20.0), (60.0, 20.0)],
[(70.0, 10.0), (80.0, 10.0), (80.0, 20.0), (70.0, 20.0)],
However when i try to plot these using the following code:
fig, ax = plt.subplots()
for obs_corner in self.obstacle_vertices:
ox=obs_corner[0][0]
oy=obs_corner[0][1]
w=self.planner.scaling_factor
h=self.planner.scaling_factor
ax.add_patch(patches.Rectangle((ox,oy),w,h,edgecolor='black',facecolor='black',fill=True))
The graph generated is :
I think i am making a basic mistake in mapping matrix into a 2d environemnt