Pros vision sensor errors _URGENT_


#1

When I run this code, it shows that the errno is 23. I am very new to pros and vision sensor programming, at the moment I am trying to get it to print the position and size of a certain signature. This is oppcontrol.cpp:

#include “main.h”
#define VISION_PORT 1
#define BALL

void opcontrol() {
pros::Vision vision_sensor (VISION_PORT);
while (true) {
pros::vision_object_s_t rtn = vision_sensor.get_by_sig(0,1);
printf(“sig: %d”, rtn.signature);
printf(“errorcode: %d”, errno);
pros::delay(50);
}
}


PROS error code meanings (errno)
#2

The vision sensor will never report ENFILE. What is the returned signature on the printf above?


Vision Sensor Viability
#3

It returns sig: 255 then errorcode: 28


#4

Does anyone know of any documentation besides https://pros.cs.purdue.edu/v5/tutorials/topical/vision.html
that might help us?


#5

Sorry to if I sound beggy but we really need help in the next few days!


#6

From a lack of foresight on our part, if the vision signature detects objects but none are what you want get_by_sig could potentially return nothing and also not set the errno appropriately. Fortunately, it’s the only code path/possibility for that to happen. I have a couple PRs (#124 and #125) to clean up a lot of the vision sensor code, but am needing to get around to testing it. Currently working on getting stack traces when you get a memory permission error (#112)…


#7

But basically, the vision sensor isn’t reporting any objects matching signature 1.


#8

Are you sure that ‘No space on device’ means that no object is detected because V5 vision utility shows that it is detected and so does the brain itself.


#9

The error doesn’t seem to be a ‘no match found’


#10

Yes. As I poorly explained, it’s due to a bug in the get_by_sig function. If you get an error returned but errno doesn’t make sense, then it’s probably because there weren’t any matching objects.


#11

Ok thank you, but I still don’t understand why no object is detected since on the brain screen, it shows the signature1 square.


#12

Does anyone have any advice on this?


PROS Vision sensor problems
#13

Are you picking up objects using the vision utility that ships with PROS?


#14

Yes, and on the brain screen


#15

Does anyone think this is an error with pros or the code itself or maybe the sensor?


#16

Does anyone know where I should post this to get more feedback?!


#17

I guess no one has much more feedback for you. Perhaps post the whole program (preferably a simple example, not your competition code) that demonstrates the issue you are having.


#18

This is all my code, what do mean by a ‘single example’?


#19

I said “simple” not “single”
so is the code you posted at the beginning of this topic 4 days ago is still the code you are trying to get working ? No changes since then ?


#20

I had a look at vision sensor with PROS, I don’t see any particular issues, this was the test code I used having saved one signature in the vision sensor SIG_1 location.

#define SIG_1			1

pros::Vision vision_sensor (20);

void opcontrol() {
	while (true) {
		int n = vision_sensor.get_object_count();
		pros::lcd::print(0, "%d ", n );

		if( n > 0 ) {
			pros::vision_object_s_t  obj = vision_sensor.get_by_sig(0, SIG_1 );
			pros::lcd::print(1, "x: %3d y: %3d", obj.x_middle_coord, obj.y_middle_coord );
			pros::lcd::print(2, "w: %3d h: %3d", obj.width, obj.height );
		}
		else {
			pros::lcd::print(1, "no objects");
			pros::lcd::print(2, "          ");
		}

		pros::delay(20);
	}
}