5 from nav_msgs.msg
import OccupancyGrid
43 print (
"Error, index too big!")
52 print (
"Error, get index failed")
61 print (
"Error, wrong index")
90 if(self.
getData(x-1,y-1) == -1):
94 if(self.
getData(x-1,y+1) == -1):
100 if(self.
getData(x+1,y-1) == -1):
102 if(self.
getData(x+1,y ) == -1):
104 if(self.
getData(x+1,y+1) == -1):
111 print(
"Wrong coordinate")
117 my_file = io.BytesIO()
118 pgmHeader =
'P5' +
'\n' +
' ' + str(self.
mapWidth) +
' ' + str(self.
mapHeight) +
'\n' +
' ' + str(255) +
'\n'
119 pgmHeader_byte = bytearray(pgmHeader,
'utf-8')
120 my_file.write(pgmHeader_byte)
126 my_file.write((0).to_bytes(1,
'big'))
128 my_file.write((254).to_bytes(1,
'big'))
130 my_file.write((205).to_bytes(1,
'big'))
133 t_image = Image.open(my_file)
134 image = t_image.copy()
142 if( x1 == -1
or x2 == -1):
143 print(
"Error, wrong Index!")
145 if(x1 == x2
and y1 == y2):
147 if(x1 == (x2-1)
and y1 == (y2-1)):
149 if(x1 == x2
and y1 == (y2-1)):
151 if(x1 == (x2+1)
and y1 == (y2-1)):
153 if(x1 == (x2-1)
and y1 == y2):
155 if(x1 == (x2+1)
and y1 == y2):
157 if(x1 == (x2-1)
and y1 == (y2+1)):
159 if(x1 == x2
and y1 == (y2+1)):
161 if(x1 == (x2+1)
and y1 ==(y2+1)):