Upload Code_Generator.json
Browse files- Code_Generator.json +102 -0
Code_Generator.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"text":"Drive forward for a specific distance.",
|
| 4 |
+
"code":"drivetrain.driveFor(forward, DISTANCE, inches);"
|
| 5 |
+
},
|
| 6 |
+
{
|
| 7 |
+
"text":"Drive backward for a specific distance.",
|
| 8 |
+
"code":"drivetrain.driveFor(reverse, DISTANCE, inches);"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"text":"Turn left a specific number of degrees.",
|
| 12 |
+
"code":"drivetrain.turnFor(left, DEGREES, degrees);"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"text":"Turn right a specific number of degrees.",
|
| 16 |
+
"code":"drivetrain.turnFor(right, DEGREES, degrees);"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"text":"Spin motor at a specific speed.",
|
| 20 |
+
"code":"motor1.spin(forward, SPEED, rpm);"
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"text":"Reverse motor at a specific speed.",
|
| 24 |
+
"code":"motor1.spin(reverse, SPEED, rpm);"
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"text":"Stop the drivetrain.",
|
| 28 |
+
"code":"drivetrain.stop();"
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"text":"Lift arm for a specific duration.",
|
| 32 |
+
"code":"armMotor.spin(forward); wait(DURATION, seconds); armMotor.stop();"
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"text":"Rotate using inertial sensor to a specific angle to the left.",
|
| 36 |
+
"code":"while(inertialSensor.heading(degrees) < ANGLE) { drivetrain.turn(left); } drivetrain.stop();"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"text":"Rotate using inertial sensor to a specific angle to the right.",
|
| 40 |
+
"code":"while(inertialSensor.heading(degrees) > ANGLE) { drivetrain.turn(right); } drivetrain.stop();"
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"text":"Spin the flywheel at a specific velocity.",
|
| 44 |
+
"code":"flywheelMotor.spin(forward, VELOCITY, velocityUnits::rpm);"
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"text":"Stop the flywheel.",
|
| 48 |
+
"code":"flywheelMotor.stop();"
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"text":"Run the intake forward.",
|
| 52 |
+
"code":"intakeMotor.spin(forward, SPEED, velocityUnits::pct);"
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"text":"Reverse the intake.",
|
| 56 |
+
"code":"intakeMotor.spin(reverse, SPEED, velocityUnits::pct);"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"text":"Stop the intake.",
|
| 60 |
+
"code":"intakeMotor.stop();"
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"text":"Activate the match loader to load a ball.",
|
| 64 |
+
"code":"matchLoaderMotor.spin(forward, SPEED, velocityUnits::pct); wait(DURATION, seconds); matchLoaderMotor.stop();"
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"text":"Extend a piston to push an object.",
|
| 68 |
+
"code":"piston.set(true);"
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"text":"Retract a piston.",
|
| 72 |
+
"code":"piston.set(false);"
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"text":"Toggle a piston's state.",
|
| 76 |
+
"code":"piston.toggle();"
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"text":"Run the flywheel for a specific duration then stop.",
|
| 80 |
+
"code":"flywheelMotor.spin(forward, VELOCITY, velocityUnits::rpm); wait(DURATION, seconds); flywheelMotor.stop();"
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"text":"Spin the intake and match loader simultaneously to intake and load.",
|
| 84 |
+
"code":"intakeMotor.spin(forward, INTAKE_SPEED, velocityUnits::pct); matchLoaderMotor.spin(forward, LOADER_SPEED, velocityUnits::pct);"
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"text":"Calibrate the inertial sensor.",
|
| 88 |
+
"code":"inertialSensor.calibrate(); while(inertialSensor.isCalibrating()) { wait(100, msec); }"
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"text":"Set the drivetrain velocity to a specific value.",
|
| 92 |
+
"code":"drivetrain.setVelocity(SPEED, velocityUnits::pct);"
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"text":"Set the flywheel velocity for a long-distance shot.",
|
| 96 |
+
"code":"flywheelMotor.setVelocity(LONG_DISTANCE_SPEED, velocityUnits::rpm); flywheelMotor.spin(forward);"
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"text":"Set the flywheel velocity for a short-distance shot.",
|
| 100 |
+
"code":"flywheelMotor.setVelocity(SHORT_DISTANCE_SPEED, velocityUnits::rpm); flywheelMotor.spin(forward);"
|
| 101 |
+
}
|
| 102 |
+
]
|