-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswervetest.c
81 lines (73 loc) · 2.09 KB
/
swervetest.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#pragma config(Hubs, S1, HTServo, none, none, none)
#pragma config(Sensor, S2, proto, sensorI2CCustom9V)
#pragma config(Sensor, S3, gyro, sensorI2CHiTechnicGyro)
#pragma config(Servo, srvo_S1_C1_1, pod0Steer, tServoContinuousRotation)
#pragma config(Servo, srvo_S1_C1_2, pod1Steer, tServoStandard)
#pragma config(Servo, srvo_S1_C1_3, pod2Steer, tServoStandard)
#pragma config(Servo, srvo_S1_C1_4, pod3Steer, tServoStandard)
#pragma config(Servo, srvo_S1_C1_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C1_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#define GYRO gyro
//#include "JoystickDriver.c"
#include "LordSwerve.c"
/*
task changer()
{
while ( true )
{
for ( int i = 0; i < 4; i++ )
{
setModuleTarget(i, 512);
}
wait1Msec(2000);
for ( int i = 0; i < 4; i++ )
{
setModuleTarget(i, 1512);
}
wait1Msec(2000);
}
}
*/
//int speed = 127;
task main()
{
//waitForStart();
//bDisplayDiagnostics = false;
//initGyro();
initSwerveDrive();
//StartTask(changer);
// waitForStart();
while ( true )
{
//servo[pod0Steer] = speed;
servo[pod1Steer] = 127;
servo[pod2Steer] = 127;
servo[pod3Steer] = 127;
// getJoystickSettings(joystick);
//for ( int i = 0; i < 4; i++ )
//{
// nxtDisplayString(i+1, "%i - %i - %i", i, modules[i].truePos, modules[i].Rollovers);
//}
/* if ( abs(modules[3].turnPID.error) > 500 )
{
eraseDisplay();
while( true )
{
servo[pod0Steer] = 127;
servo[pod1Steer] = 127;
servo[pod2Steer] = 127;
servo[pod3Steer] = 127;
eraseDisplay();
nxtDisplayString(1, "Prev: %i", modules[3].lastPos);
nxtDisplayString(2, "Cur: %i", modules[3].truePos);
}
}*/
// if ( abs(joystick.joy1_x2) > 10 )
// chassisRotation();
// else
// fieldCentricCrab();
debugPID(modules[0].turnPID);
updateSwerveDrive();
}
}