Lack of proper error messaging

When I open the “Turning left (degrees)” example code for a V5 Brain that has no gyro attached, the code fails to detect the absence of the gyro, and even prints messages claiming to be calibrating the gyro.

Being new to VEX, I thought perhaps there was an internal gyro in the Brain, but after doing some testing realised this was not the case.

I’ve been programming for a long time, and this sort of thing strikes me as extremely sloppy. The robot-config code is supposed to be generated automatically based on what devices are connected to the Brain, yet this code is oblivious to the absence of the gyro, and throws no error messages. Why is this the case?

1 Like

I don’t imagine the Brain has any way to know for sure if the gyro is connected. It’s not like a motor that is on a two-way communication bus, its just 0V, 5V and an input voltage. Whist it could check for something on the input, it could just as easily be a potentiometer or a bumper switch for example.

7 Likes

When you do your robot configuration it assumes that user know what he/she is doing and will not configure random sensors not connected to the robot.

If you want to test presence of a device connected to a smart port there is vex::device::installed() method that could be called for motors.

Gyro sensor is connected to a legacy 3-wire port and there is no easy way to know if it is not connected or connected and returns no voltage.

4 Likes

“When you do your robot configuration it assumes that user know what he/she is doing”

The problem is that the code claims to be able to do the robot configuration all by itself, without user input. And right off the bat, it makes a mistake, which the user then has to go in and fix. Just seems a little dodgy to me :slight_smile:

1 Like

It does, from a code perspective. Hardware is another matter though.

3 Likes