While there are many errors one may run into in the programming and software world we're going to focus for now on the two major errors that may occur when hardware mapping.
Interface Errors - errors between how an interface should work and how it actually behaves
Runtime Errors - errors that occur when a program is being executed
Interface errors occur in the SDK when the parameters of the SDK interface are not met. These errors are more common in Blocks due to it handling much of the hardwareMapping process for the user.
Below you can see a comparison of Blocks when a configuration file is not selected (left) versus when one is active (right):
Within the SDK runtime errors occur during initialization or run. One of the most common runtime errors within the Control Hub can be seen below:
There are a few different reasons this error typically occurs:
No configuration file is currently active or created
The incorrect configuration file is active
There is a mismatched name between the configuration file and code (ex: rightmotor vs right_motor)
What results is when the program begins the robot is forced to stop running when the first hardware device is not properly identified. That first hardware device is the one indicated in the error. If there are multiple issues the next will show once the initial is fixed.
A similar error may occur when using OnBot Java, which will appear like the following:
Similarly, this error is likely due to a typo or mismatched name between the program and configuration file. I can see in the error that I've accidentally set my motor to be named "test_moto" instead of "test_motor"!
There are many errors that could appear while compiling, however let's look at a common one for the hardwareMap.
Looking at line 48 of the program we can see the following:
In this scenario, the name from the configuration file is correct within the string, however the variable name is wrong.
Remember to click the "Build Everything" button to compile your program after making changes!