Skip to content
IncredibotsAcademy

Creating a Robot Configuration

Map your physical motors and sensors to names you can use in your Java code by creating a robot configuration file.

15 minrookie

By the end you can

  • Understand what a robot configuration file is and why it's needed
  • Learn how to use the Driver Station app to create a configuration
  • Map standard drivetrain motors (left_front, right_front, etc.)

Before you can write code to tell a motor to spin, the Control Hub needs to know which motor is plugged into which port. This mapping is stored in a Robot Configuration file (an .xml file) saved on the Control Hub.

While these files are just XML text, you rarely write them by hand. Instead, you use the FTC Driver Station app on your phone (or the Driver Hub) to create them visually.

What is a Configuration File?

A configuration file links the physical ports on your Control Hub or Expansion Hub to a String name that you will use in your Java code.

For example, if you plug a motor into Port 0 and name it "left_front", your Java code will ask the hardware map for the motor named "left_front", and the system will know to send power to Port 0.

Here is an example of what the underlying XML file looks like once the Driver Station creates it:

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<Robot type="FirstInspires-FTC">
    <LynxUsbDevice name="Control Hub Portal" serialNumber="(embedded)" parentModuleAddress="173">
        <LynxModule name="Control Hub" port="173">
            <NeveRest20Gearmotor name="left_front" port="0" />
            <NeveRest20Gearmotor name="right_front" port="1" />
            <NeveRest20Gearmotor name="left_back" port="2" />
            <NeveRest20Gearmotor name="right_back" port="3" />
        </LynxModule>
    </LynxUsbDevice>
</Robot>

Case Sensitivity

The names you define in your configuration are case-sensitive. If you name a motor "Left_Front" on the Driver Station but ask for "left_front" in your code, your program will crash when you press INIT!

Creating a Configuration on the Driver Station

To create a configuration for a standard 4-wheel drive robot, follow these steps using your Driver Station app or Driver Hub:

  1. Connect to the Robot. Ensure your Driver Station is connected to the Control Hub's Wi-Fi network.

  2. Open Settings. Tap the three dots in the top right corner of the Driver Station app and select Configure Robot.

  3. Create New Configuration. Tap New, then select Control Hub Portal, and then Control Hub.

  4. Add Motors. Tap Motors. You will see a list of ports (0 through 3).

    • Tap the dropdown for Port 0, select your motor type (e.g., Rev Robotics Core Hex Motor), and type left_front for the name.
    • Repeat this for Port 1 (right_front), Port 2 (left_back), and Port 3 (right_back). Ensure the ports match where the wires are actually plugged into the hub!
  5. Save the Configuration. Tap Done to back out of the menus, then tap Save. Name the configuration something memorable, like MyRobot.

  6. Activate the Configuration. Back on the main Configure Robot screen, select your new MyRobot configuration and tap Activate.

Standard Naming Conventions

When working with a team, it's critical to agree on standard names. If the builders plug a servo into Port 0 but don't tell the programmers what it's named, the code can't be written.

For a standard Mecanum or 4-wheel drive, the typical names are:

  • left_front
  • right_front
  • left_back or left_rear
  • right_back or right_rear

Check Your Understanding

Check yourself

You plug a lift motor into Port 2, name it 'liftMotor' in the configuration, but your code asks for 'liftmotor' (lowercase 'm'). What will happen?