Setting up a Configuration
Before we can truly dive into programming our robot, we need to help our robot's brain, the Control Hub, to know what is connected to it. Through the configuration process we can tell the Control Hub which port sensors, motors, servos, and any other connected devices can be found.
This is one of the most important steps to always complete BEFORE you can start programming!
The Importance of Configuration
While every REV Control Hub is the same, the robots being controlled by the Control Hub are not. Each Control Hub has the same number of motor ports, servo ports, digital ports, and the like, but how you may utilize these ports varies from system to system. For instance, a Color Sensor V3 may be plugged in to I2C Bus 1 on one person's Hub, but another might use the same bus to host a 2m Distance Sensor.
While the Control Hub may know there is a device attached to a port, it doesn't instinctively know which information needs to be transferred back for use in an OpMode. To help our robot out we need to complete a process called hardware mapping. This is a two step process that includes creating our configuration file using the Driver Hub and calling the hardware map within our OpMode.
When using Blocks, this second step is handled for the user by the tool. However, in OnBot Java it is up to us as the programmer to create our variables and assign an external hardware unit.
Configuring Common Hardware Devices
Accessing the Configuration Utility
Select the menu in the stop right corner of the Driver Station app. Then select Configure Robot.
In the Available configurations page, select New.
In the USB Devices in configuration page select the Control Hub Portal.
Note: If you have an Expansion Hub connected it will appear as an Expansion Hub Portal.
Pressing "Scan" on an existing configuration may result in the already named devices being erased. A new configuration file is needed when adding a camera or Expansion Hub.
Within the Hub Portal select the device you want to configure. In this use case, select the Control Hub.
Note: if you have an Expansion Hub connected to a Control Hub, the Expansion Hub will also appear as a configurable device in the portal.
This will bring you to the page shown in the image. From here you can configure motors, servos and sensors that you are using. Follow through the rest of the guide to figure out how to configure devices that will be used in the Test Bed section.
Note: The way that Digital and Analog devices are configured versus how I2C devices are configure differ significantly. This is because each physical I2C port is a different bus that can host multiple different sensors. For more information on the different types of sensors check out the sensors section.
Configuring Hardware
The following section will show how to configure components that will be used in the Test Bed. The hardware type and names have been chosen in consideration for the Hello World lesson plan. Users should heed notes within the steps to consider when creating configuration files for other instances.
Configuring a Motor
Select Motors.
The Motor page will allow you to configure all four motor ports on the Hub. On Port 0 open the drop down menu and select REV Robotics Core Hex Motor.
Note: In your configuration file you should configure the motor ports to the type of motor you are using.
Name the motor test_motor. Select done.
Note: remember when naming hardware in the configuration file that the REV Control System is Case Sensitive.
Saving the Configuration File
Hit Done twice until you reach the USB Devices in configuration page. On the USB Devices in configuration page hit Save.
Name the configuration helloRobotTest and then select Ok.
Note: The FTC SDK does not force you to abide by a naming convention for but it is common to name configurations in lowerCamelCase.
Press back to activate the saved configuration. Your Robot Controller will restart once you activate a new configuration.
Last updated