-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting2
55 lines (45 loc) · 1.06 KB
/
testing2
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
//Begin page main
//Declare any variables shared between functions here
float pos[12];
float forces[3];
float kp;
float myState[12];
int step;
float myPos[3];
float posA[3];
float posB[3];
float posC[3];
void init(){
//This function is called once when your code is first loaded.
//IMPORTANT: make sure to set any variables that need an initial value.
//Do not assume variables will be set to 0 automatically!
posA[0]=0.35;
posA[1]=0.35;
posA[2]=0.0;
posB[0]=-0.35;
posB[1]=0.35;
posB[2]=0.0;
posC[0]=0.15;
posC[1]=0.15;
posC[2]=0.0;
step = 0;
kp = 0.35;// coeficiente de velocidad. error contra velocidad, mayor más rápido
}
void goTo(float* dest){
api.getMyZRState(pos);
int i = 0;
for(i = 0; i < 3; i++){
float error = dest[i] - pos[i];
if(error < 0.01){
error = 0;
}
forces[i] = kp * error;
}
api.setVelocityTarget(forces);
}
void loop(){
//This function is called once per second. Use it to control the satellite.
goTo(posA);
goTo(posB);
goTo(posC);
}