Skip to content

Commit

Permalink
chore: things work locally.
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjitRaman committed Jun 13, 2024
1 parent 1a08dd5 commit ad37d35
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 55 deletions.
26 changes: 26 additions & 0 deletions server/map_demo/backend/create_map.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import numpy as np

def create_room_pgm(filename, width, height):
# Create an empty grid with 255 (white space)
grid = np.full((height, width), 255, dtype=int)

# Create walls (0 value)
grid[0, :] = 0 # Top wall
grid[-1, :] = 0 # Bottom wall
grid[:, 0] = 0 # Left wall
grid[:, -1] = 0 # Right wall

# Create a door (255 value in the wall)
door_position = width // 2
grid[0, door_position-1:door_position+2] = 255 # Door in the top wall

# Write to PGM file
with open(filename, 'w') as f:
f.write('P2\n')
f.write(f'{width} {height}\n')
f.write('255\n')
for row in grid:
f.write(' '.join(map(str, row)) + '\n')

# Generate the PGM file
create_room_pgm('output/map.pgm', 20, 20)
2 changes: 1 addition & 1 deletion server/map_demo/backend/process_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
def read_pgm(filename):
with filename.open('r') as file:
assert file.readline() == 'P2\n'
next(file) # Skip the comment line
# next(file) # Skip the comment line
width, height = [int(i) for i in file.readline().split()]
max_val = int(file.readline())
data = []
Expand Down
73 changes: 21 additions & 52 deletions server/map_demo/website/data/map_raw/map.pgm
Original file line number Diff line number Diff line change
@@ -1,54 +1,23 @@
P2
# Simple 10x10 map
10 50
20 20
255
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
150 150 150 150 150 150 150 150 150 150
0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 0 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 changes: 2 additions & 2 deletions server/map_demo/website/data/map_raw/map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ free_thresh: 0.196
waypoints:
- x: -0.3
y: -0.3
image: incident1.jpg
image: data/incidents/incident1.jpg
- x: 0.3
y: 0.3
image: incident2.jpg
image: data/incidents/incident2.jpg

0 comments on commit ad37d35

Please sign in to comment.