Rotation matrix in 2D Asteroid shooting

70 Views Asked by At

I got stuck solving this Asteroid shooting game. The game is described as follows:

A ship is moving and trying to shoot asteroids in a 2D plane. The ship has a 360-degree ring sensor that can sense an asteroid (will give range and bearing measurements). This picture shows what I mean: enter image description here Let $\beta$ be a shooting angle. Asteroid's diameter is 3 meters. We do not know the ship's motions. Asteroids move with constant velocity. Given a ship's pose and an asteroid's positions (relative to a fixed frame), calculate $\beta$ in the ship's frame.

This seems to be simple. We transform from the fixed frame to the ship's frame using the ship's pose and then calculate the bearing of the asteroid in the ship's frame. However, the results do not checkout with the ground truths. The following table shows the ground truth measurement including the ship's poses, asteroid's positions, and correct shooting angles.

No|          Ship                                ||           Asteroid            || check shot
  |x(m)   | y(m)  | vx(m/s)| vy(m/s)|heading(rad)|| x(m)  | y(m)  |vx(m/s)|vy(m/s)||Min(rad)| Max(rad)
1 |411.542|421.371|6.919   |1.402   |-1.402      ||313.626|373.795|7.802  |1.780  ||-1.2999 | -1.2724
2 |385.232|395.177|-0.784  |-1.626  |-2.792      ||400.358|412.789|1.636  |-2.61  ||-2.7772 | -2.6487
3 |227.302|391.359|-5.638  |-1.819  |0.008       ||481.877|282.792|1.636  |-2.61  ||-0.3459 | -0.3351
4 |382.034|376.118|-4.236  |8.931   |2.692       ||458.633|319.859|1.636  |-2.61  || 2.747  |  2.7786
5 |377.154|375.831|5.868   |-10.205 |1.492       ||447.502|337.611|1.636  |-2.61  ||-1.8522 | -1.8147

For example, the calculated bearing in the ship's frame given the information in row 3 is -0.4031, which does not agree with the provided ground truth.

I am not sure what I have overlooked and/or misunderstood that gives me the wrong results. I greatly appreciate any hints.

EDIT1. I forgot to include that one can fire at any angle around the ship.