By Bolun Dai | Jan 4th 2021
HouseExpo
Before we do anything we need to first figure out the coordinate system used in HouseExpo. For any map the origin \((0, 0)\) is at the upper left corner. If we use a Cartesian coordinate as comparison, the positive \(x\)-axis in HouseExpo is along the negative \(y\)-axis and the positive \(y\)-axis co-aligns with the positive \(x\)-axis of the Cartesian coordinates. As for the orientation, going from the positive \(x\)-axis in the Cartesian coordinates to the negative \(x\)-axis counterclockwise is going from \(0^\circ\) to \(180^\circ\), if going clockwise then it is from \(0^\circ\) to \(-180^\circ\) in HouseExpo.
The following can be dissected into two steps: centering the agent and rotating the map. To do this we need to know the size of the background canvas \((h, w)\), the position of the agent in the global map \((p_x, p_y)\) and the size of the global map \((g_x, g_y)\). The we can assign the corresponding cells in the canvas to have equal values as in the global map.
The next step is to rotate the canvas, if the current orientation of the robot is \(+\theta\), then we would need to rotate the canvas \(-\theta\). After this we have the rotated image where the robot is heading right, if we want the robot to face up, we would need to rotate the canvas \(90^\circ\). We use the following image to illustrate this process.