Skip to content

Hardware Module

The hardware module wraps the raw FTC SDK hardware classes (DcMotorEx, Servo, IMU, and so on) in classes that lazily resolve devices from the hardware map on first use, and give you a more convenient, consistent API across every device type.

Every device wrapper in this module can be constructed the same two ways: by its Lynx Module and port, or by its configuration name from the Driver Station.

// By Lynx Module and port, recommended
val servo = NextServo(RobotController.controlHub, 0)
// Using your configuration name
val servo = NextServo("armServo")

Constructing by Lynx Module and port is recommended, since it skips the hardware map’s name lookup and lets NextFTC talk to the module directly. Either way, the underlying device isn’t actually resolved until you first use it, so it’s always safe to declare hardware as fields on your Mechanism.