Gray Matter
WorkshopHardware Setup
WPILib 2027 is still in alpha: these pages change as the APIs settle.
LESSON 04

Hardware Setup

This lesson powers up your mechanism. Nothing turns yet. No robot controller, and no code.

9 minutes
You’ll need
  • The mechanism assembled and wired, with a charged battery. See Mechanism CAD.
  • Phoenix Tuner X installed, from Prerequisites, and a USB cable to the CANivore.

The most important part of FRC programming is getting the hardware set up properly. If it isn't, your code ends up fighting reality.

The components

Every mechanism has three parts: a motor, a sensor that knows what the mechanism is doing, and a bus to your laptop. Our arm uses all three. Our flywheel does not need all three, for a reason the cards below explain.

Kraken X44 motor

Kraken X44

A brushless motor with its controller built into the back. The inside runs position and velocity loops on the motor itself, a thousand times a second.

Free speed is about 125 rotations per second. It also reports its own position over the , so the motor is a sensor too.

WCP ThroughBore encoder
Arm only

WCP ThroughBore Encoder

An absolute position that mounts on a rotating shaft and reads a magnet. It still knows the arm angle after the power has been off all week.

The inside the motor does not. It reads zero wherever it happens to sit at boot. The parts list says ThroughBore. The part is a inside, and CANcoder is what the code calls it.

CANivore USB to CAN FD adapter

CANivore

A USB adapter that gives your devices their own CAN FD bus.

It is also why Workshop 1 needs no robot. The laptop plugs into the CANivore, and the CANivore talks to the devices.

The flywheel has no CANcoder. It is tuned for speed rather than angle, and the encoder inside the motor already measures speed. On a flywheel mechanism, skip the CANcoder wherever it comes up.

Connect Tuner X

Power the mechanism first, then run USB from the laptop to the CANivore. There is no team number to type and no robot to find.

  1. Open and check CANivore USB.
  2. Set Team # or IP to localhost.
  3. Open the CANivores tab on the left. The CANivore should be listed there.
  4. Rename it to canivore. Every later lesson and every code sample uses that name.
  5. Open the Devices tab on the left and confirm the motor is listed, along with the CANcoder if you built the arm.

Update the firmware

Now update everything. A device on old firmware still connects and still answers, so showing up in the list does not mean it is current.

  1. Update the CANivore.
  2. Update the motors and the other devices. Select one device, then use the batch update icon to flash every device of that model at once.
  3. Check the card colours once the flashing finishes.

Card colour is the fastest read on the screen. The same meaning is printed under the device name, in words.

CardMeaning
GreenDevice has the latest firmware.
YellowA newer version is available.
PurpleUnexpected or beta firmware version.
RedDuplicate ID. Two devices answer to the same number, and Motor Setup sorts that out.
BlueTuner X could not download the list of firmware versions.

Check your work

Power cycle the mechanism: battery off, USB out, then both back on. The firmware and the CANivore name are stored on the devices themselves.

Check

You should see

  • The CANivore reconnects as canivore, with Tuner X still pointed at localhost.
  • The motor is listed on the Devices tab, and the CANcoder too on the arm.
  • Every device card is green.
  • On the arm, turning the mechanism by hand changes the CANcoder position in Tuner X.

Check yourself

Which devices does the arm build use in this workshop?

What does the CANivore do?

What does a green device card in Tuner X mean?

Pick an answer for each.