Document

Angle correction note: GPT10_angle_correction_ver2.pro
1.Finite distance of camera to the track
2.Light ray distortion caused by refraction
3.Divergence of light ray caused by the curved surface
4.Chain length consideration
Constants: d=3mm->track width,
d2=1.2mm->wall width
r=110.8mm->radius of track,
l=727.3mm->distance from camera to center of track
s=1.2mm->radius of the sphere
n=1.49 ->refractive index of acrylic
Inputs: angle1, angle2 (two ends of the chain) and phase
(front side or back side of the track)
Output: angle1’,angle2’
Code:
;Jia wrote on 20160727
;input angle is the two end of the chain got by camera
;Two ends are handled separately
;d=track width;d2=wall wedth;r=radius of the track
;l=distance of camera to the center of the track
;s=radius of the sphere;n=refractive index of acrylic
;phase=+1:front side of track;-1:back side of track
;output:(angle1',angle2')
function GPT10_angle_correction_ver2,angle1,angle2,phase
d=3 & r=110.8 & l=727.3 & s=1.2 & d2=1.2 & n=1.49;constants
;let angle1>angle2
if abs(angle2) gt abs(angle1) then begin
a=angle1 & angle1=angle2 & angle2=a
end
angle=[angle1,angle2]
if phase eq 1 then theta=asin(r*sin(angle)/l)+angle
if phase eq -1 then begin
tempt=(r^2+l^2-2*r*l*cos(!pi-angle))^0.5
theta=asin(l*sin(!pi-angle)/tempt)
end
;light ray distortion cause by refraction
phi=asin(sin(theta)/n)
dphi=d2*tan(phi)/r
theta2=asin(n*sin(phi+dphi))
;divergence cause by the curved surface
dtheta=((d+d2)*tan(theta)-d2*tan(phi)-d*tan(theta2))/r
theta=theta2+dtheta
;do the iteration again:
phi=asin(sin(theta)/n)
dphi=d2*tan(phi)/r
theta2=asin(n*sin(phi+dphi))
dtheta=((d+d2)*tan(theta)-d2*tan(phi)-d*tan(theta2))/r
theta=theta2+dtheta
angle(0)=angle(0)-(d/2+s*tan(abs(theta(0))/2))*tan(theta(0))/r
angle(1)=angle(1)-(d/2-s*tan(abs(theta(1))/2))*tan(theta(1))/r
return,angle
end
1.Finite distance of camera to the track
We get the rough estimation of πœƒ first.
Phase = +1
Phase = βˆ’1
πœƒ
r
Input angle
Input angle
r
πœƒ
l
π‘Ÿ sin(𝐼𝑛𝑝𝑒𝑑)
πœƒ = sinβˆ’1 (
)
𝑙
l’
l l’=
𝑙 2 + π‘Ÿ 2 βˆ’ 2 cos(πœ‹ βˆ’ 𝑖𝑛𝑝𝑒𝑑)
πœƒ=
𝑙 sin(πœ‹ βˆ’ 𝑖𝑛𝑝𝑒𝑑)
)
𝑙′
sinβˆ’1 (
2.Light ray distortion caused by refraction
Then, we start correcting πœƒ. We calculate the distortion of refraction
with Snell’s Law, and the refractive index of acrylic is around 1.49:
πœ‘=
d
sinβˆ’1(
π‘‘πœ‘ =
πœƒβ€²
sin πœƒ
)
1.49
𝑑2 tan πœ‘
π‘Ÿ
πœƒβ€² = sinβˆ’1 (𝑛 sin(πœ‘ + π‘‘πœ‘ ))
πœ‘
πœ‘ + π‘‘πœ‘
πœƒ
d2
3.Divergence of light ray caused by the curved surface
It should be the angle difference between blue line and red line.
But for simplification, we only concern the angle difference between blue
line and black line.
π‘‘πœƒ
d
πœƒβ€²
πœ‘
πœƒ
d2
𝑑 + 𝑑2 tan πœƒ βˆ’ 𝑑2 tan πœ‘ βˆ’ 𝑑 tan πœƒβ€²
π‘‘πœƒ =
π‘Ÿ
We got the correction of πœƒ οΌšπœƒ = πœƒ β€² + π‘‘πœƒ, and redo 2-3 again to get a more accurate πœƒ.
4.Chain length consideration
Corrected angle
Input angle
Corrected angle1=Input angle1βˆ’
Corrected angle2=Input angle2βˆ’
πœƒ
2
d
s
πœƒ
𝑑
πœƒ
( +𝑠 tan 1 ) tan πœƒ1
2
2
π‘Ÿ
𝑑
πœƒ
( βˆ’π‘  tan 2 ) tan πœƒ2
2
2
π‘Ÿ
Plus and minus corresponds to two ends of
the chain. And the final output is the average
of the 2 corrected angle.
Errors can’t correct:
𝑑
( βˆ’ 𝑠) tan πœƒ
2
πœƒ
We suppose the chain always stays in the
center of the track, but the deviation will
cause errors.