-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Vision Sensor error reporting #117
Labels
enhancement
This builds on top of an existing feature
p: normal
Normal priority
todo
This will be worked on next
Milestone
Comments
edjubuh
added
p: normal
Normal priority
enhancement
This builds on top of an existing feature
labels
Feb 18, 2019
HotelCalifornia
pushed a commit
that referenced
this issue
Jun 11, 2019
- Changed port number validation to return ENXIO when outside the domain of port numbers - Changed port validation to return ENODEV when the requested device doesn't match the actual device - Vision Sensor read/get functions consistently use EAGAIN when the libv5rts tells us it couldn't get data - Remove docstrings for EACCES since it is practically impossible to get that errno (we wait for mutex indefinitely) - vision_get_by_sig consistently sets errno to EDOM when unable to find objects that match (valid) arguments Right now, our returned errnos aren't that great. Close #117 - [X] When objects are in vision sensors FOV, but none are of a particular signature, signature ID is correct and EDOM is errno ```cpp errno = 0; // set to 0 to make sure errno is being set properly... normally wouldn't do this // errno was 33 b/c there were no objects to see of signature 1 pros::lcd::print(1, "%d (%d)", vision.get_by_sig(0, 1).signature, errno); errno = 0; // errno was 0 b/c it worked fine pros::lcd::print(2, "%d (%d)", vision.get_by_sig(0, 2).signature, errno); errno = 0; // errno was flickered between 0/33 b/c there were sometimes objects of 2 to see pros::lcd::print(3, "%d (%d)", vision.get_by_sig(2, 2).signature, errno); errno = 0; // errno was EINVAL (22) because 8 is an invalid signature id pros::lcd::print(4, "%d (%d)", vision.get_by_sig(8, 2).signature, errno); errno = 0; // errno was EADDRINUSE (112) b/c there was a radio plugged in pros::lcd::print(5, "%d (%d)", pros::c::vision_get_by_sig(21, 0, 1).signature, errno); errno = 0; // errno was ENXIO (6) b/c there's no smart port #22 pros::lcd::print(6, "%d (%d)", pros::c::vision_get_by_sig(22, 0, 1).signature, errno); // errno was ENODEV (19) b/c there's no motor plugged into 2 (or anything for that matter) errno = 0; pros::lcd::print(7, "%d (%d)", pros::c::motor_get_voltage(2), errno); ```
HotelCalifornia
pushed a commit
that referenced
this issue
Jun 11, 2019
Summary - Changed port number validation to return ENXIO when outside the domain of port numbers - Changed port validation to return ENODEV when the requested device doesn't match the actual device - Vision Sensor read/get functions consistently use EAGAIN when the libv5rts tells us it couldn't get data - Remove docstrings for EACCES since it is practically impossible to get that errno (we wait for mutex indefinitely) - vision_get_by_sig consistently sets errno to EDOM when unable to find objects that match (valid) arguments Right now, our returned errnos aren't that great. Close #117 - [X] When objects are in vision sensors FOV, but none are of a particular signature, signature ID is correct and EDOM is errno ```cpp errno = 0; // set to 0 to make sure errno is being set properly... normally wouldn't do this // errno was 33 b/c there were no objects to see of signature 1 pros::lcd::print(1, "%d (%d)", vision.get_by_sig(0, 1).signature, errno); errno = 0; // errno was 0 b/c it worked fine pros::lcd::print(2, "%d (%d)", vision.get_by_sig(0, 2).signature, errno); errno = 0; // errno was flickered between 0/33 b/c there were sometimes objects of 2 to see pros::lcd::print(3, "%d (%d)", vision.get_by_sig(2, 2).signature, errno); errno = 0; // errno was EINVAL (22) because 8 is an invalid signature id pros::lcd::print(4, "%d (%d)", vision.get_by_sig(8, 2).signature, errno); errno = 0; // errno was EADDRINUSE (112) b/c there was a radio plugged in pros::lcd::print(5, "%d (%d)", pros::c::vision_get_by_sig(21, 0, 1).signature, errno); errno = 0; // errno was ENXIO (6) b/c there's no smart port #22 pros::lcd::print(6, "%d (%d)", pros::c::vision_get_by_sig(22, 0, 1).signature, errno); // errno was ENODEV (19) b/c there's no motor plugged into 2 (or anything for that matter) errno = 0; pros::lcd::print(7, "%d (%d)", pros::c::motor_get_voltage(2), errno); ```
HotelCalifornia
pushed a commit
that referenced
this issue
Jun 12, 2019
Summary - Changed port number validation to return ENXIO when outside the domain of port numbers - Changed port validation to return ENODEV when the requested device doesn't match the actual device - Vision Sensor read/get functions consistently use EAGAIN when the libv5rts tells us it couldn't get data - Remove docstrings for EACCES since it is practically impossible to get that errno (we wait for mutex indefinitely) - vision_get_by_sig consistently sets errno to EDOM when unable to find objects that match (valid) arguments Right now, our returned errnos aren't that great. Close #117 - [X] When objects are in vision sensors FOV, but none are of a particular signature, signature ID is correct and EDOM is errno ```cpp errno = 0; // set to 0 to make sure errno is being set properly... normally wouldn't do this // errno was 33 b/c there were no objects to see of signature 1 pros::lcd::print(1, "%d (%d)", vision.get_by_sig(0, 1).signature, errno); errno = 0; // errno was 0 b/c it worked fine pros::lcd::print(2, "%d (%d)", vision.get_by_sig(0, 2).signature, errno); errno = 0; // errno was flickered between 0/33 b/c there were sometimes objects of 2 to see pros::lcd::print(3, "%d (%d)", vision.get_by_sig(2, 2).signature, errno); errno = 0; // errno was EINVAL (22) because 8 is an invalid signature id pros::lcd::print(4, "%d (%d)", vision.get_by_sig(8, 2).signature, errno); errno = 0; // errno was EADDRINUSE (112) b/c there was a radio plugged in pros::lcd::print(5, "%d (%d)", pros::c::vision_get_by_sig(21, 0, 1).signature, errno); errno = 0; // errno was ENXIO (6) b/c there's no smart port #22 pros::lcd::print(6, "%d (%d)", pros::c::vision_get_by_sig(22, 0, 1).signature, errno); // errno was ENODEV (19) b/c there's no motor plugged into 2 (or anything for that matter) errno = 0; pros::lcd::print(7, "%d (%d)", pros::c::motor_get_voltage(2), errno); ```
HotelCalifornia
pushed a commit
that referenced
this issue
Jun 12, 2019
Summary - Changed port number validation to return ENXIO when outside the domain of port numbers - Changed port validation to return ENODEV when the requested device doesn't match the actual device - Vision Sensor read/get functions consistently use EAGAIN when the libv5rts tells us it couldn't get data - Remove docstrings for EACCES since it is practically impossible to get that errno (we wait for mutex indefinitely) - vision_get_by_sig consistently sets errno to EDOM when unable to find objects that match (valid) arguments Right now, our returned errnos aren't that great. Close #117 - [X] When objects are in vision sensors FOV, but none are of a particular signature, signature ID is correct and EDOM is errno ```cpp errno = 0; // set to 0 to make sure errno is being set properly... normally wouldn't do this // errno was 33 b/c there were no objects to see of signature 1 pros::lcd::print(1, "%d (%d)", vision.get_by_sig(0, 1).signature, errno); errno = 0; // errno was 0 b/c it worked fine pros::lcd::print(2, "%d (%d)", vision.get_by_sig(0, 2).signature, errno); errno = 0; // errno was flickered between 0/33 b/c there were sometimes objects of 2 to see pros::lcd::print(3, "%d (%d)", vision.get_by_sig(2, 2).signature, errno); errno = 0; // errno was EINVAL (22) because 8 is an invalid signature id pros::lcd::print(4, "%d (%d)", vision.get_by_sig(8, 2).signature, errno); errno = 0; // errno was EADDRINUSE (112) b/c there was a radio plugged in pros::lcd::print(5, "%d (%d)", pros::c::vision_get_by_sig(21, 0, 1).signature, errno); errno = 0; // errno was ENXIO (6) b/c there's no smart port #22 pros::lcd::print(6, "%d (%d)", pros::c::vision_get_by_sig(22, 0, 1).signature, errno); // errno was ENODEV (19) b/c there's no motor plugged into 2 (or anything for that matter) errno = 0; pros::lcd::print(7, "%d (%d)", pros::c::motor_get_voltage(2), errno); ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
This builds on top of an existing feature
p: normal
Normal priority
todo
This will be worked on next
Expected Behavior:
We'd like the vision sensor to have useful error reporting with
errno
Actual Behavior:
We pretty much always return
EINVAL
for the interesting errors that you'd want to know about.Steps to reproduce:
Mess with
vision_read_by_size
and friendsSystem information:
Platform: V5
PROS Kernel Version: 3.1.5
Additional Information
9ca0364 has the start of this
Screenshots/Output Dumps/Stack Traces
The text was updated successfully, but these errors were encountered: