team116 / ed2017

1 stars 0 forks source link

Diagnostics to automatically determine if sensors are broken #18

Closed cartycrabber closed 7 years ago

cartycrabber commented 7 years ago

A diagnostics class that monitors the sensors and tries to detect when they are malfunctioning. Possible ways of doing this might include cross referencing multiple sensors to see if their output roughly matches (for example, if the accelerometer reports that we are moving forward but the encoders report 0 movement, we know there is a problem. There are two accelerometers on the robot, one on the navX and one built into the roboRio. You can check those two against each other to make sure they are functioning properly. Thus you have determined the encoders are broken). You can also check to see if we are getting values that we shouldn't (for example, if the encoder reports that we are moving 100mph, we know it is broken and we need to disable it). A way to check sensors like the gyro and accelerometers might be to compare a few of their successive outputs. These types of sensors tend to have constantly fluctuating values even while the robot isn't moving (if only by a tiny amount). For example, getting the exact same angle from the gyro, 138.382938921 degrees, 5 times in a row is improbable, and means the gyro may be malfunctioning.

You will want to make a process function in the diagnostics class that is called by all the periodic functions in Robot.cpp. The process function is where you will want to check the sensor data repeatedly. You will probably have to add public getter functions to the classes containing the sensors you want to check.

When a sensor is malfunctioning, it will need to be disabled and any functions depending on it will need to be put into "dumb mode" (#17)

There are probably more ways to attempt to check the validity of sensor data. I'm sure there is plenty of information online about doing this too.

Sensors that need diagnostics: