Lesson 13.6: Build RobotConfig.java and Intake.java
The first five lessons gave you the design rules. You will now use them to build a project that survives beyond one OpMode.
Start with two files. RobotConfig.java owns shared configuration. Intake.java owns the intake hardware and behavior.
RobotConfig.java
package org.firstinspires.ftc.teamcode;
public final class RobotConfig {
public static final String INTAKE_NAME = "intake";
public static final String LIFT_NAME = "lift";
public static final double INTAKE_POWER = 0.8;
public static final int LIFT_SCORE_TICKS = 1200;
public static final double LIFT_POWER = 0.75;
private RobotConfig() {}
}
The private constructor prevents accidental new RobotConfig() calls. The program reads these values through the class name.
Intake.java
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.hardware.CRServo;
import com.qualcomm.robotcore.hardware.HardwareMap;
public class Intake {
private CRServo motor;
public void init(HardwareMap hardwareMap) {
motor = hardwareMap.get(
CRServo.class, RobotConfig.INTAKE_NAME);
stop();
}
public void collect() {
motor.setPower(RobotConfig.INTAKE_POWER);
}
public void eject() {
motor.setPower(-RobotConfig.INTAKE_POWER);
}
public void stop() {
motor.setPower(0.0);
}
}
The Python view shows the class structure only. FTC does not provide this Python hardware API.
The OpMode will not touch the CRServo field. It will state intent by calling collect(), eject(), or stop().
A Competition Team Uses the Same Boundary
Titan Robotics Club's subsystem guide constructs a slide in its own class, stores configuration in RobotParams, and exposes the finished motor to the robot layer. This lesson uses the same boundary with direct FTC SDK types:
public class Lift {
private final TrcMotor liftMotor;
public Lift() {
liftMotor = new FtcMotorActuator(
RobotParams.HWNAME_LIFT,
liftParameters
).getActuator();
}
}
The names and omitted setup were shortened to match this lesson. The ownership pattern is unchanged: the mechanism class creates its hardware from centralized configuration. Adapted from Team 3543 Titan Robotics Club's subsystem guide at a pinned commit under the MIT License.
Project Practice
Complete the intake methods in the project below. Every tab is a separate file in the same TeamCode package.
Ready to move on?
Only mark complete if you genuinely understand the material. Your progress will be saved in this browser.
Stuck on this lesson?
Ask about anything on this page. It can see which lesson you have open and which part you are reading.