-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenFeedbackTable.c
60 lines (43 loc) · 1.84 KB
/
GenFeedbackTable.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
#pragma config(Hubs, S1, HTMotor, HTMotor, HTServo, none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Sensor, S3, sensorIR, sensorHiTechnicIRSeeker600)
#pragma config(Sensor, S4, ultrasonic, sensorSONAR)
#pragma config(Motor, mtr_S1_C2_1, mRight2, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_2, mRight1, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_1, mLeft1, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C1_2, mLeft2, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S1_C3_3, tubeHook1, tServoStandard, reversed)
#pragma config(Servo, srvo_S1_C3_4, tubeHook2, tServoStandard, reversed)
//*!!Codez automagically venerated by 'ROWBOT SEA' conflagration lizard !!*//
#include "drivers/teleoputils.h"
/*
This file generates the neccesary power to speed table
to use the feedback loop motor power system.
To use it, hold the robot off the table and run the program.
It uses the right side of the robot, and measures the right1 encoder.
It'll print the table to the debug log.
*/
task main() {
servo[tubeHook1] = 128;
servo[tubeHook2] = 128;
writeDebugStreamLine("int powerToSpeedTable[101] = {");
int newlineCounter = 0;
nMotorEncoder[mLeft1] = 0;
for(int counter = 0; counter <= 100; ++counter)
{
if(newlineCounter++ >= 10)
{
writeDebugStreamLine(" ");
newlineCounter = 1;
}
motor[mLeft1] = counter;
motor[mLeft2] = counter;
nMotorEncoder[mLeft1] = 0;
Sleep(1000);
//in degrees per millisecond
//though, there's not 360 degrees in a revolution
int angularSpeed = leftEncoder;
writeDebugStream(" %d,", angularSpeed);
}
writeDebugStreamLine("};");
}