👨‍💻
ARC Software
  • Introduction
  • The FTC Control System
  • Setting up the Environment
  • The OpMode
    • Introducing the OpMode
    • OpMode vs LinearOpMode
    • Telemetry and Debugging
    • Stopping LinearOpModes
  • Hardware Interaction
    • Hardware Configuration
    • DcMotor
    • Servos
    • Sensors
    • Inertial Measurement Unit
  • TeleOp
    • FTC Match Structure
    • Accessing Gamepads
    • The TeleOp Period
    • Finite State Machines
  • Autonomous
    • The Autonomous Period
  • Virtual Robot Environment
    • Setting Up The Virtual Robot Environment
    • Programming a Mecanum Drive
  • Working with a Team
    • Integrate with your Team
    • Using Git Effectively
Powered by GitBook
On this page
  • Connecting Two Expansion Hubs
  • Making a Configuration
  • Using a Configuration in Code
  • Check your Understanding

Was this helpful?

  1. Hardware Interaction

Hardware Configuration

How do you call the motor plugged into this port? "motorFL".

PreviousStopping LinearOpModesNextDcMotor

Last updated 4 years ago

Was this helpful?

To be ultimately useful, your OpMode needs to be able to interact with robot hardware. In FTC, each hardware device that you wish to use has a distinct name, using which you reference the device in code. A collection of mappings from device names to their respective hardware ports is a configuration.

Configurations can be created on the Robot Controller or the Driver Station. You can create as many configurations as you want on one device, but only one configuration can be active at any moment. When an OpMode runs, only the mappings from the active configuration can be used.

Connecting Two Expansion Hubs

One REV Expansion Hub only provides four motor ports, and that is not sufficient in most competitive designs. Since it is legal to have up to eight motors in an FTC robot, we typically daisy-chain two Expansion Hubs together and connect electronics to both of them.

Most of the existing Expansion Hubs in the club should be configured for daisy-chaining already, but if we decide to obtain more, refer to FTC's official for how to configure them. Alternatively, you may reference the following video.

Making a Configuration

Follow the flow of the video that corresponds to your control system. When creating a new configuration, ensure that the REV Expansion Hubs or Modern Robotics modules that are connected to the Robot Controller are the ones that will be used on the final competition robot. Since configurations apply to specific hubs and modules, replacing them typically requires a total reconfiguration.

In addition to the configuration itself, we recommend that you put descriptive, distinct labels on the wires that connect to your Expansion Hubs. Not only will this help you reconfigure the robot later on, it will also save time when troubleshooting potential problems with electronics. Make sure that these labels stay up-to-date as you make changes to the wiring scheme of your robot, as misleading labels are far worse than not having any labels.

Although the club does not have official device naming conventions, we recommend that your team establish some guidelines about device names. Following these guidelines reduces inconsistency and helps you remember the names exactly when referencing them in code later.

Using a Configuration in Code

Refer to the HardwareMap class for how to obtain instances of more types of electronics.

Check your Understanding

  1. Why do we need configuration?

  2. What are the steps necessary to connect two REV Expansion Hubs?

  3. What is the name of the class that helps you retrieve hardware devices from configuration in code?

To retrieve instances of hardware devices using the active configuration, we use a field in the OpMode class named . To retrieve a DcMotor with name leftLift in the configuration, for example, we use hardwareMap.dcMotor.get("leftLift"). We can then pass the returned instance to a field in our OpMode, a local variable, or the constructor of another class.

hardwareMap
control system documentation
Configuring with Modern Robotics modules
Configuring with REV Expansion Hubs
https://first-tech-challenge.github.io/SkyStone/doc/javadoc/com/qualcomm/robotcore/hardware/HardwareMap.htmlfirst-tech-challenge.github.io
A label for a wire (from FTC YouTube video "REV - Managing Wires")