Ellipse contained in Bounding box?

#1

Hi

Below are two captures of a same moving contact separated by 50ms. It shows both the ellipse and bounding box data returned by the API. From the documentation I deduced that the ellipse figure should contained within the bounding box. As can be seen here, this is not the case at all.

Can anybody help me interpret the meaning of the bounding box.

The raw captured data is below.

INITIAL CONTACT DATA (Red)
x_pos: 169.96484375 mm
y_pos: 82.55078125 mm
orientation: -0.8125 º
major_axis: 10.0 mm
minor_axis: 10.0 mm
min_x: 165.0 mm
min_y: 80.0 mm
max_x: 170.0 mm
max_y: 85.0 mm

CONTACT DATA 50MS LATER (Blue)
x_pos: 159.82421875 mm
y_pos: 78.6171875 mm
orientation: 8.4375 º
major_axis: 11.578125 mm
minor_axis: 11.13671875 mm
min_x: 135.0 mm
min_y: 70.0 mm
max_x: 160.0 mm
max_y: 80.0 mm

0 Likes

#2

Hello, I am not sure what setup you are using, but I modified the C contact example from GitHub to confirm that bounding boxes are working as expected.

0 Likes

#3

Alex, those results are what I expected. Can you share your code so I can run it on my board? I can send you mine. it is written in Python.

Use a private message if you prefer…

0 Likes

#4

Here is my C code.

    //Handle that references a Sensel device
	SENSEL_HANDLE handle = NULL;
	//List of all available Sensel devices
	SenselDeviceList list;
	//SenselFrame data that will hold the contacts
	SenselFrameData *frame = NULL;

	//Get a list of avaialble Sensel devices
	senselGetDeviceList(&list);
	if (list.num_devices == 0)
	{
		fprintf(stdout, "No device found\n");
		fprintf(stdout, "Press Enter to exit example\n");
		getchar();
		return 0;
	}

	//Open a Sensel device by the id in the SenselDeviceList, handle initialized 
	senselOpenDeviceByID(&handle, list.devices[0].idx);

	//Set the frame content to scan contact data
	senselSetFrameContent(handle, FRAME_CONTENT_CONTACTS_MASK);
	senselSetContactsMask(handle, 0x0F);
	//Allocate a frame of data, must be done before reading frame data
	senselAllocateFrameData(handle, &frame);
	//Start scanning the Sensel device
    senselStartScanning(handle);
    
    fprintf(stdout, "Press Enter to exit example\n");
    #ifdef WIN32
        HANDLE thread = CreateThread(NULL, 0, waitForEnter, NULL, 0, NULL);
    #else
        pthread_t thread;
        pthread_create(&thread, NULL, waitForEnter, NULL);
    #endif
    
    while (!enter_pressed)
    {
		unsigned int num_frames = 0;
		//Read all available data from the Sensel device
		senselReadSensor(handle);
		//Get number of frames available in the data read from the sensor
		senselGetNumAvailableFrames(handle, &num_frames);
		for (int f = 0; f < num_frames; f++)
		{
			//Read one frame of data
			senselGetFrame(handle, frame);
			//Print out contact data
			if (frame->n_contacts > 0) {
				fprintf(stdout, "Num Contacts: %d\n", frame->n_contacts);
				for (int c = 0; c < frame->n_contacts; c++)
				{
					unsigned int state = frame->contacts[c].state;
					fprintf(stdout, "Contact: X %f MinX %f MaxX %f Y %f MinY %f MaxY %f \n", frame->contacts[c].x_pos, frame->contacts[c].min_x, frame->contacts[c].max_x, frame->contacts[c].y_pos, frame->contacts[c].min_y, frame->contacts[c].max_y );

					//fprintf(stdout, "Contact ID: %d State: %s\n", frame->contacts[c].id, CONTACT_STATE_STRING[state]);

					//Turn on LED for CONTACT_START
					if (state == CONTACT_START) {
						senselSetLEDBrightness(handle, frame->contacts[c].id, 100);
					}
					//Turn off LED for CONTACT_END
					else if (state == CONTACT_END) {
						senselSetLEDBrightness(handle, frame->contacts[c].id, 0);
					}
				}
				fprintf(stdout, "\n");
			}
		}
	}
	return 0;
0 Likes

#5

Alex, can I run a test or diagnosis on my board?

0 Likes

#6

The best tests/diagnostics are running the visualizer and the examples in the API.

Did the C code work for you?

Also, if you need additional support, I recommend contacting us at support@sensel.com

0 Likes