-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavagatorII.nxc
42 lines (36 loc) · 884 Bytes
/
NavagatorII.nxc
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
#include "Lib\LibV2.c"
#include "Lib\BeepCode.c"
#include "Lib\MotorManager.c"
#include "Lib\TachoNav.c"
#define scale 1.0
Vector2f Coors[3];
inline int round(float x)
{
asm{
add x, x, 0.5
trunc __RETVAL__, x
}
}
void init()
{
TextOut(0, LCD_LINE1, "SetCoorList" , DRAW_OPT_CLEAR);
Coors[0] = v2New(0.5,1.5);
Coors[1] = v2New(1.0,0.0);
Coors[2] = v2New(0.0,0.0);
TextOut(0, LCD_LINE2, "UpdateScale" , DRAW_OPT_NORMAL);
Coors *= scale;
TextOut(0, LCD_LINE3, "Start TachoNav" , DRAW_OPT_NORMAL);
tnSetDefaults();
StartTask(NavigateByTachometer);
TextOut(0, LCD_LINE4, "Init Finished!" , DRAW_OPT_NORMAL);
Wait(500);
}
task main()
{
init();
for(int i = 0; i < ArrayLen(Coors); i++)
{
mmMoveToPt(Coors[i]);
}
mmTurnToHeading(v2Angle(v2Dif(Coors[0], Coors[1])));
}