Start from a blank slate
For your own robot design.
You start with the smallest robot that works: it drives. Then you add your parts one at a time, on the five files pages. Why: when only one part is new, a problem can only be in that part.
There are two ways to get the first files. Pick one:
| Your robot | Use |
|---|---|
| It is wired, and its configuration is on the Driver Hub (Set up 7) | Way A: from your configuration (best) |
| It is not wired yet, or you only use the simulator, or you want to type each part in yourself | Way B: copy the smallest files |
Way A: from your configuration
Section titled “Way A: from your configuration”The library reads your configuration and writes the five files for you, with a line for each part. Why: it copies the names for you, so they cannot have typos.
-
Copy the configuration file off the Control Hub. It is
/sdcard/FIRST/<name>.xml, where<name>is your configuration’s name (forMyRobot, it isMyRobot.xml). Use Android Studio’s Device Explorer (View > Tool Windows > Device Explorer) with the hub connected, or the REV Hardware Client. Save it in the project folder, next toTeamCode. -
Run the file maker. The first time, do the laptop setup.
Where: Android Studio’s Terminal tab, in the
ftc-helper-libfolder (typecd ftc-helper-libfirst). (Which folder)Terminal window ./gradlew :sim:newRobot -Pconfig=../MyRobot.xml -PteamCode=../TeamCodeChange
MyRobot.xmlto your file’s name. It writesRobot.java,Tunables.java,Controls.java,Actions.javaandautos/LeaveStart.javaintoTeamCode. It never writes over your work: if one of the files is already there, it writes nothing and stops. -
Check each
TODOline inRobot.java. ATODOis a guess the file maker was not sure of, for example which part a motor drives. -
Build: click Build > Make Project.
In Tunables.java, each number is DEFAULT (the library’s starting value) or MEASURE (a number
only your robot can give). Leave them for now. The Tunables.java page
says how to find each one.
Way B: copy the smallest files
Section titled “Way B: copy the smallest files”The smallest files are in the library, in the
firstrobot folder:
ftc-helper-lib/examples/src/main/java/com/crossbotics/ftchelper/examples/firstrobot/.
They are a mecanum drive and nothing else. They are the same files the five files pages show.
- Copy the folder into
TeamCode: Copy example files into TeamCode. Then come back here. - Change the drive line in
Robot.java: your four motor names, your motor and wheels, and the IMU (the drive line, how your Control Hub is mounted). For a tank drive, read A tank drive instead. - Build: click Build > Make Project.
Your other parts come later, one at a time, on the Robot.java page.
Done when
Section titled “Done when”- The five files are in
TeamCode:Robot.java,Tunables.java,Controls.java,Actions.java, and theautosfolder. - Build > Make Project ends with no red errors.
Problems
Section titled “Problems”| Problem | Fix |
|---|---|
... is already there: nothing written (move it away first) |
One of the five files is already in TeamCode. Move it to another folder, then run the command again. |
./gradlew: No such file or directory |
You are not in the ftc-helper-lib folder. Type cd ftc-helper-lib. |
A line is red: cannot find symbol |
A package or import line still names the example folder (Copy example files, step 3). |
Next: The five files. They explain every line, and you make the robot drive.
Look it up: Robot.java, Tunables.java and Drive.
Something wrong on this page? Tell us with a short GitHub form.