Академический Документы
Профессиональный Документы
Культура Документы
1
1.1 Some Trigonometric Identities
Notation used in robotics:
Identities:
sij = si ci + ci sj s2 + c2 = 1
cij = ci cj si sj
q
1 cos( )
sin( =2) = 2 sin( ) = ptan( )
1+tan( )2
q
1+cos( ) 1
cos( =2) = 2 cos( ) = p
1+tan( )2
d
dx sin(x) = cos(x)
d
dx cos(x) = sin(x)
2
1.2 About atan() and atan2()
Functions atan(x) (also called arctan(x)) and atan2(y; x) (also called arctan 2(y; x))
are standard mathematical library functions included in most of the high-level
programming languages.
y
=atan2(y; x) is a qudrant sensitive inverse of tan( ) = x which returns
a value in the range :
8
>
> y>0 1st
>
> atan( xy ) 2 [0; 2 ] if
>
> x>0 quad.
>
>
>
> y y>0 2nd
< atan( jxj ) 2 [2; ] if
x<0 quad.
atan2(y; x) =
>
> jyj y<0 3rd
>
> +atan( jxj ) 2[ 2; ] if
>
> x<0 quad.
>
>
>
> y<0 4th
: atan( jyj
x ) 2 [0; 2] if
x>0 quad.
3
Examples:
3 1
atan2(5; 5) = 4 atan2(5; 5) = 4
3 1
atan2( 5; 5) = 4 atan2( 5; 5) = 4
atan2(0; 5) = atan2(0; 5) = 0
1 1
atan2( 5; 0) = 2 atan2(5; 0) = 2
An important identity:
Proof:
' = atan2(y; x)
sin(') cos( =2 ')
tan(') = xy = cos(') = sin( =2 ')
sin( =2 ') x
tan( 2 ') = cos( =2 ') = y
atan2(x; y) = 2 '= 2 atan2(y; x)
4
More examples:
0 if x > 0
atan2(0; x) =
if x < 0
2 if y > 0
atan2(y; 0) =
2 if y < 0
atan2(y; x) if y > 0
atan2(y; x) =
+atan2(y; x) if y < 0
atan2( y; x) = atan2(y; x)
atan2(0; 0) UNDEFINED!
5
1.3 Equation cos(') a - sin(') b = p
sin(') a + cos(') b = q
then evaluate:
p = cos(') a sin(') b
6
1.3.1 Traditional solution
A traditional way to solve these equations is by substitutions:
a=p r sin( ); and b = r cos( ); where = atan2(a; b) and
r = a2 + b2 , so that (2) becomes:
Using the identity (1), the equation (6) can also be written as:
p
' = atan2(p; a2 + b2 p2 ) atan2(b; a): (7)
q = sin(') a + cos(') b
= sin(') r sin( ) + cos(') r cos( )
= r cos ( ')
p (8)
=r 1 sin( ')2
p
= pr2 p2
= a2 + b2 p2
p
Note that that the square root a2 + b2 p2 needs to be evaluated only
once and than be used in (7) and (8).
7
1.3.2 An Alternative Approach
(p,q)
y
q (a,b)
ϕ b
x
p
a
cos(') sin(') a p
= (9)
sin(') cos(') b q
they clearly suggest a 2D rotation of the vector (a; b) by the angle '; giving
the new vector (p; q): Since the rotation does not change the size of vectors, we
have:
a2 + b2 = p2 + q 2 (10)
It is clear from the …gure above that:
The last two equations we can use now to solve both problems stated above:
p
solve: cos(') a sin(') b = p q= a2 + b2 p2
evaluate: q = sin(') a + cos(') b ' =atan2(q; p) atan2(b; a)
and
8
p
solve: sin(') a + cos(') b = q p= a2 + b2 q 2
evaluate: p = cos(') a sin(') b ' =atan2(q; p) atan2(b; a)