Can't get forces in openFrameworks


#1

I don’t seem to be able to get force_array data in an openFrameworks project. I have a working C++ project, a reduced version of the SenselForces C example, that works fine. But, the same code doesn’t work in openFrameworks.

If I call this in setup:
senselSetFrameContent(senselHandle, FRAME_CONTENT_CONTACTS_MASK);

Then something like this will work:
std::cout << senselFrame->n_contacts << std::endl;

But, if I use the pressure mask like this:
senselSetFrameContent(senselHandle, FRAME_CONTENT_PRESSURE_MASK);

then this is always zero:

int totalforce = 0; int arraySize = senselInfo.num_cols * senselInfo.num_rows; for (int j = 0; j < arraySize; ++j) { totalforce += senselFrame->force_array[j]; } std::cout << "totalForce : " << totalforce << std::endl;

Is there any known issue here?


#2

I found my problem. I was linking to the source code from sensel-lib, rather than the files installed by the installer. I added the header and library paths to my project and the -lsensel linker flag, and now it’s working as expected.