Pros vision sensor errors _URGENT_

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);

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

It returns sig: 255 then errorcode: 28

Does anyone know of any documentation besides
that might help us?

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

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)…

1 Like

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

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.

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

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.

1 Like

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

Does anyone have any advice on this?

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

Yes, and on the brain screen

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

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

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.


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

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 ?

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, "          ");

1 Like