5.2.1 Robot Controller is Unable to Find a USB Device
Each USB device (Motor Controller, Servo Controller, Legacy Module and Device Interface Module) that is connected to the USB hub of the Core Power Distribution Module has a unique serial number. The FIRST Tech Challenge Robot Controller app will scan the USB bus to look for the devices that are listed in its active configuration file. If the FIRST Tech Challenge Robot Controller is unable to find any of the devices that are listed, it will display an error message and communicate this error to the Driver Station.
If you are at an Event and a Team’s FIRST Tech Challenge Robot Controller app keeps displaying an error that reads something like “Unable to open XXXX” or “Unable to find USB device with serial number XXXX”, then you check the following items,
1. You want to first make sure that there is only one FIRST Tech Challenge Robot Controller app installed on the device. Some Teams, particularly those that use the App Inventor to create their op modes, might have more than one FIRST Tech Challenge Robot Controller style app installed on their phone. If more than one FIRST Tech Challenge Robot Controller type of app is installed on a single phone, then the apps can have problems detecting some of the hardware modules that are connected through the USB bus. This can occur if some of the USB modules are associated with one of the apps, while the rest of the USB modules are associated with a different app.
If you encounter a Team that has more than one FIRST Tech Challenge Robot Controller app installed on their Android device, then you can suggest to the Team that they remove all but one app from their device, and that they make the remaining app the default app for all of their USB hardware modules. 2. If the Team is still experiencing problems finding a hardware module, then verify that the Robot
hardware is powered on and connected properly to the Power Distribution module, and select “Restart Robot” from the Settings menu of the Robot Controller.
3. If the Team is still experiencing problems finding a hardware module, then check to make sure that the correct configuration file is activated and select “Restart Robot” from the Settings menu of the Robot Controller.
4. If the Robot Controller is still unable to find the hardware module, then disconnect the Robot Controller from the Power Distribution Module, turn off the Robot and wait a few seconds, turn on the Robot and wait a few seconds, connect the Robot Controller to the Power Distribution Module, and try “Restart Robot”
5. Finally, if there are still issues, disconnect the Robot Controller from the Power Distribution Module, turn off the Robot and the Robot Controller, wait a few seconds, turn them both back on, launch the Robot Controller app, connect the Robot Controller to the Power Distribution Module, and try “Restart Robot”
5.2.2 User code threw an uncaught exception: null
This error occurs when a method is called on an object that is null at the time the method was called. To address this issue, first look at the Robot log file to find where to search for the problem. To access the log files, open the settings in the Robot Controller app, and click “view logs”. Then, scroll up until a block of red text appears, and look for the line that says
“com.qualcomm.ftcRobotcontroller.opmodes.YourOpmodeName.loop(YourOpmodeName.java:XX)” The XX will have a line number where the null error occurred in the code, and is a good starting point to addressing the issue. For example, if this line is accessing a method of an ElapsedTimer object, make sure that the object has been instantiated with “objectname = new ElapsedTimer();” somewhere in the code before this line.
5.2.3 User code threw an uncaught exception: number XXX is invalid;
This is an exception that is typically thrown when a motor or servo is set to a value that is less than -1 or greater than 1. To find which line of code the exception was thrown on, check the Robot logs by opening the settings in the Robot Controller app, and clicking “View logs”. Then scroll up to the first block of text that is red, and find the line that says:
“com.qualcomm.ftcRobotcontroller.opmodes.YourOpModeName.loop(YourOpModeName.java:XX)”
The XX will be the line number where the exception was thrown, and is a good starting point to addressing the issue. Remember: the setPower method for DcMotors can only be passed a value from -1 to 1, and the setPosition method for Servos can only be passed a value from 0 to 1. If this value is likely to be outside of the range, the Range.clip() method can be used to constrain the value to a specified range.
5.2.4 Unable to find a hardware device with the name “…”
A very commonly encountered error occurs when the user tries to run a specific op mode, and the FIRST Tech Challenge Robot Controller app complains that the “User code threw an uncaught exception: Unable to find a hardware device with the name “…”” where “…” is the name of the hardware device that the op mode is trying to access.
This error will occur if the op mode specifies a name for a device that does not match the corresponding name for the device in the FIRST Tech Challenge SDK’s hardware map. This error will occur for apps created using Android Studio and for apps created using the App Inventor.
Figure 42 - The name used by the op mode must match the name used in the configuration file for the device exactly. If you are at an Event an you encounter this error message, ask the Team to verify that the name that they use in their op mode to reference a hardware device matches the name specified for that device in the