-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput_A12.c
59 lines (56 loc) · 956 Bytes
/
input_A12.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include<stdio.h>
#include<math.h>
//T matrix between link 1 and link 2, O1 is joint angle 2 L1 is link length
void input_A12(float *arr, float O2, float L1)
{
*(arr) = sin(O2);
*(arr + 1) = cos(O2);
if((*(arr + 1)) > 0)
{
if((*(arr + 1)) < 0.00001)
{
*(arr + 1) = 0;
}
}
else
{
if(( -1 * (*(arr + 1))) < 0.00001)
{
*(arr + 1) = 0;
}
}
*(arr + 2) = 0;
*(arr + 3) = (L1 * (sin(O2)));
*(arr + 4) = ((-1) * (cos(O2)));
*(arr + 5) = sin(O2);
*(arr + 6) = 0;
*(arr + 7) = (cos(O2));
if((*(arr + 7)) > 0)
{
if((*(arr + 7)) < 0.00001)
{
*(arr + 7) = 0;
}
}
else
{
if(( -1 * (*(arr + 7))) < 0.00001)
{
*(arr + 7) = 0;
}
}
*(arr + 7) = ((-1 * L1) * (*(arr + 7)));
// *(arr + 7) = ((-1 * L1) * (cos(O2)));
/* if((*(arr + 7)) < 0.0001)
{
*(arr + 7) = 0;
}*/
*(arr + 8) = 0;
*(arr + 9) = 0;
*(arr + 10) = 1;
*(arr + 11) = 0;
*(arr + 12) = 0;
*(arr + 13) = 0;
*(arr + 14) = 0;
*(arr + 15) = 1;
}