One way to get started with lighthouse 2 is to create a conversion from lighthouse 2 angles to lighthouse 1 angles,
and use the functionality that has already been implemented for lighthouse 1. Even though it is an easy way to get started, the main drawback is that we need both sweeps for the conversion. Lighthouse 1 angles are also easier to
understand and can be a useful debugging tool.
Lighthouse 1 to lighthouse 2
Start from the measurement model for the kalman filter .
For a point ( x , y , z ) (x, y, z) ( x , y , z ) , the sweep angles are
{ α 1 l h 2 = tan − 1 ( y x ) + sin − 1 ( z tan ( − t ) x 2 + y 2 ) α 2 l h 2 = tan − 1 ( y x ) + sin − 1 ( z tan ( t ) x 2 + y 2 ) \begin{cases}
\alpha^{lh2}_1 = \tan^{-1}(\frac{y}{x}) + \sin^{-1}(\frac{z\tan(-t)}{\sqrt{x^2 + y^2}})\\
\alpha^{lh2}_2 = \tan^{-1}(\frac{y}{x}) + \sin^{-1}(\frac{z\tan(t)}{\sqrt{x^2 + y^2}})
\end{cases} ⎩ ⎨ ⎧ α 1 l h 2 = tan − 1 ( x y ) + sin − 1 ( x 2 + y 2 z t a n ( − t ) ) α 2 l h 2 = tan − 1 ( x y ) + sin − 1 ( x 2 + y 2 z t a n ( t ) )
where t = π 6 t = \frac{\pi}{6} t = 6 π
x x x , y y y and z z z are given by the lighthouse 1 sweep angles
{ x = 1 y = tan ( α 1 l h 1 ) z = tan ( α 2 l h 1 ) \begin{cases}
x = 1 \\
y = \tan(\alpha^{lh1}_1) \\
z = \tan(\alpha^{lh1}_2)
\end{cases} ⎩ ⎨ ⎧ x = 1 y = tan ( α 1 l h 1 ) z = tan ( α 2 l h 1 )
this leads to
{ α 1 l h 2 = α 1 l h 1 + sin − 1 ( tan ( α 2 l h 1 ) tan ( − t ) 1 + tan 2 ( α 1 l h 1 ) ) α 2 l h 2 = α 1 l h 1 + sin − 1 ( tan ( α 2 l h 1 ) tan ( t ) 1 + tan 2 ( α 1 l h 1 ) ) \begin{cases}
\alpha^{lh2}_1 = \alpha^{lh1}_1 + \sin^{-1}(\frac{\tan(\alpha^{lh1}_2)\tan(-t)}{\sqrt{1 + \tan^2(\alpha^{lh1}_1)}})\\
\alpha^{lh2}_2 = \alpha^{lh1}_1 + \sin^{-1}(\frac{\tan(\alpha^{lh1}_2)\tan(t)}{\sqrt{1 + \tan^2(\alpha^{lh1}_1)}})\\
\end{cases} ⎩ ⎨ ⎧ α 1 l h 2 = α 1 l h 1 + sin − 1 ( 1 + t a n 2 ( α 1 l h 1 ) t a n ( α 2 l h 1 ) t a n ( − t ) ) α 2 l h 2 = α 1 l h 1 + sin − 1 ( 1 + t a n 2 ( α 1 l h 1 ) t a n ( α 2 l h 1 ) t a n ( t ) )
or
{ α 1 l h 2 = α 1 l h 1 + sin − 1 ( q tan ( − t ) ) α 2 l h 2 = α 1 l h 1 + sin − 1 ( q tan ( t ) ) \begin{cases}
\alpha^{lh2}_1 = \alpha^{lh1}_1 + \sin^{-1}(q\tan(-t))\\
\alpha^{lh2}_2 = \alpha^{lh1}_1 + \sin^{-1}(q\tan(t))\\
\end{cases} { α 1 l h 2 = α 1 l h 1 + sin − 1 ( q tan ( − t )) α 2 l h 2 = α 1 l h 1 + sin − 1 ( q tan ( t ))
where
q = tan ( α 2 l h 1 ) 1 + tan 2 ( α 1 l h 1 ) q = \frac{\tan(\alpha^{lh1}_2)}{\sqrt{1 + \tan^2(\alpha^{lh1}_1)}} q = 1 + tan 2 ( α 1 l h 1 ) tan ( α 2 l h 1 )
Lighthouse 2 to lighthouse 1
The strategy when creating an equation to convert from lighthouse 2 sweep angles to lighthouse 1, is to find the intersection line between the two light planes. From the intersection line we can easily calculate the lighthouse 1 sweep angles.
The following calculations are all in the base station reference frame.
Assume we know the normals for the two light planes, n 1 ⃗ \vec{n_1} n 1 and n 2 ⃗ \vec{n_2} n 2 . The cross product of the normals v ⃗ = n 1 ⃗ × n 2 ⃗ \vec{v} = \vec{n_1} \times \vec{n_2} v = n 1 × n 2
gives us the direction of the intersection line. We also know it is passing through the origin as we are using the base station
reference frame.
Normals of the light planes
Start by figuring out the normals when α = 0 \alpha=0 α = 0 , and then rotate them around the Z-axis using a rotation matrix.
The rotation matrix is
R z = [ c o s α − s i n α 0 s i n α c o s α 0 0 0 1 ] R_{z} = \left[\begin{array}{ccc}
cos{\alpha} & -sin{\alpha} & 0 \\
sin{\alpha} & cos{\alpha} & 0 \\
0 & 0 & 1
\end{array}\right] R z = cos α s in α 0 − s in α cos α 0 0 0 1
and the resulting normals
{ n 1 ⃗ = R z ⋅ [ 0 − c o s ( t ) s i n ( t ) ] = [ c o s ( t ) s i n ( α 1 l h 2 ) − c o s ( t ) c o s ( α 1 l h 2 ) s i n ( t ) ] n 2 ⃗ = R z ⋅ [ 0 − c o s ( t ) − s i n ( t ) ] = [ c o s ( t ) s i n ( α 2 l h 2 ) − c o s ( t ) c o s ( α 2 l h 2 ) − s i n ( t ) ] \begin{cases}
\vec{n1}=R_z \cdot \begin{bmatrix}0 & -cos{(t)} & sin{(t)}\end{bmatrix} = \begin{bmatrix}cos{(t)}sin{(\alpha^{lh2}_1)} & -cos{(t)}cos{(\alpha^{lh2}_1)} & sin{(t)}\end{bmatrix} \\
\vec{n2}=R_z \cdot \begin{bmatrix}0 & -cos{(t)} & -sin{(t)}\end{bmatrix} = \begin{bmatrix}cos{(t)}sin{(\alpha^{lh2}_2)} & -cos{(t)}cos{(\alpha^{lh2}_2)} & -sin{(t)}\end{bmatrix}
\end{cases} { n 1 = R z ⋅ [ 0 − cos ( t ) s in ( t ) ] = [ cos ( t ) s in ( α 1 l h 2 ) − cos ( t ) cos ( α 1 l h 2 ) s in ( t ) ] n 2 = R z ⋅ [ 0 − cos ( t ) − s in ( t ) ] = [ cos ( t ) s in ( α 2 l h 2 ) − cos ( t ) cos ( α 2 l h 2 ) − s in ( t ) ]
where t = π / 6 t=\pi/6 t = π /6 is the tilt angle of the light planes.
The intersection vector
v ⃗ = n 1 ⃗ × n 2 ⃗ = [ − sin ( t ) cos ( t ) ( cos ( α 1 l h 2 ) + cos ( α 2 l h 2 ) ) − sin ( t ) cos ( t ) ( sin ( α 1 l h 2 ) + sin ( α 2 l h 2 ) ) cos 2 ( t ) ( sin ( α 1 l h 2 ) cos ( α 2 l h 2 ) − cos ( α 1 l h 2 ) sin ( α 2 l h 2 ) ) ] \vec{v} = \vec{n_1} \times \vec{n_2} = \begin{bmatrix}-\sin{(t)}\cos{(t)}(\cos{(\alpha^{lh2}_1)} + \cos{(\alpha^{lh2}_2)}) & -\sin{(t)}\cos{(t)}(\sin{(\alpha^{lh2}_1)} + \sin{(\alpha^{lh2}_2)}) & \cos^2{(t)}(\sin{(\alpha^{lh2}_1)}\cos{(\alpha^{lh2}_2)}-\cos{(\alpha^{lh2}_1)}\sin{(\alpha^{lh2}_2)})\end{bmatrix} v = n 1 × n 2 = [ − sin ( t ) cos ( t ) ( cos ( α 1 l h 2 ) + cos ( α 2 l h 2 ) ) − sin ( t ) cos ( t ) ( sin ( α 1 l h 2 ) + sin ( α 2 l h 2 ) ) cos 2 ( t ) ( sin ( α 1 l h 2 ) cos ( α 2 l h 2 ) − cos ( α 1 l h 2 ) sin ( α 2 l h 2 ) ) ]
Lighthouse 1 angles
Finally we can calculate the lighthouse 1 angles
{ α 1 l h 1 = tan − 1 ( v 2 v 1 ) α 2 l h 1 = tan − 1 ( v 3 v 1 ) \begin{cases}
\alpha^{lh1}_1 = \tan^{-1}(\frac{v_2}{v_1})\\
\alpha^{lh1}_2 = \tan^{-1}(\frac{v_3}{v_1})
\end{cases} { α 1 l h 1 = tan − 1 ( v 1 v 2 ) α 2 l h 1 = tan − 1 ( v 1 v 3 )
{ α 1 l h 1 = tan − 1 ( − sin ( t ) cos ( t ) ( sin ( α 1 l h 2 ) + sin ( α 2 l h 2 ) ) − sin ( t ) cos ( t ) ( cos ( α 1 l h 2 ) + cos ( α 2 l h 2 ) ) ) α 2 l h 1 = tan − 1 ( cos 2 ( t ) ( sin ( α 1 l h 2 ) cos ( α 2 l h 2 ) − cos ( α 1 l h 2 ) sin ( α 2 l h 2 ) ) − sin ( t ) cos ( t ) ( cos ( α 1 l h 2 ) + cos ( α 2 l h 2 ) ) ) \begin{cases}
\alpha^{lh1}_1 = \tan^{-1}(\frac{-\sin{(t)}\cos{(t)}(\sin{(\alpha^{lh2}_1)} + \sin{(\alpha^{lh2}_2)})}{-\sin{(t)}\cos{(t)}(\cos{(\alpha^{lh2}_1)} + \cos{(\alpha^{lh2}_2)})})\\
\alpha^{lh1}_2 =
\tan^{-1}(\frac{\cos^2{(t)}(\sin{(\alpha^{lh2}_1)}\cos{(\alpha^{lh2}_2)}-\cos{(\alpha^{lh2}_1)}\sin{(\alpha^{lh2}_2)})}{-\sin{(t)}\cos{(t)}(\cos{(\alpha^{lh2}_1)} + \cos{(\alpha^{lh2}_2)})})
\end{cases} ⎩ ⎨ ⎧ α 1 l h 1 = tan − 1 ( − s i n ( t ) c o s ( t ) ( c o s ( α 1 l h 2 ) + c o s ( α 2 l h 2 ) ) − s i n ( t ) c o s ( t ) ( s i n ( α 1 l h 2 ) + s i n ( α 2 l h 2 ) ) ) α 2 l h 1 = tan − 1 ( − s i n ( t ) c o s ( t ) ( c o s ( α 1 l h 2 ) + c o s ( α 2 l h 2 ) ) c o s 2 ( t ) ( s i n ( α 1 l h 2 ) c o s ( α 2 l h 2 ) − c o s ( α 1 l h 2 ) s i n ( α 2 l h 2 ) ) )
{ α 1 l h 1 = α 1 l h 2 + α 2 l h 2 2 α 2 l h 1 = tan − 1 ( sin ( α 2 l h 2 − α 1 l h 2 ) tan ( t ) ( cos ( α 1 l h 2 ) + cos ( α 2 l h 2 ) ) ) \begin{cases}
\alpha^{lh1}_1 = \frac{\alpha^{lh2}_1 + \alpha^{lh2}_2}{2}\\
\alpha^{lh1}_2 = \tan^{-1}(\frac{\sin{(\alpha^{lh2}_2 - \alpha^{lh2}_1)}}{\tan{(t)} (\cos{(\alpha^{lh2}_1)} + \cos{(\alpha^{lh2}_2)})})\end{cases} ⎩ ⎨ ⎧ α 1 l h 1 = 2 α 1 l h 2 + α 2 l h 2 α 2 l h 1 = tan − 1 ( t a n ( t ) ( c o s ( α 1 l h 2 ) + c o s ( α 2 l h 2 ) ) s i n ( α 2 l h 2 − α 1 l h 2 ) )