Adjuvo / SenseGlove-API

Sense Glove API for native C++ development
https://senseglove.gitlab.io/SenseGloveDocs/native/core-api-intro.html
MIT License
15 stars 11 forks source link

COREDUMP while running the SGCoreCpp_Example.cpp on Ubuntu 20.04.1 LTS x64 #3

Open fahdovski003 opened 4 years ago

fahdovski003 commented 4 years ago

Hello,

@MaxLammers

We tried to run the SenseGlove demo at SenseGlove-API/Examples/Cpp/SGCoreCpp_Example.cpp. We are using the Eclipse IDE.

However the Haptics sending functions did not seem to work. The code was stuck there. So we disabled this section of the code to make the demo worked correctly :

#if 0
            testGlove.SendHaptics( SGCore::Haptics::SG_BuzzCmd(80, 0, 0, 0, 0) ); //vibrate the index fingerat 80% intensity.
            std::this_thread::sleep_for(std::chrono::milliseconds(1000)); //vibrating for for 200ms.

            testGlove.SendHaptics(SGCore::Haptics::SG_BuzzCmd::off); //turn off all Buzz Motors.
            testGlove.StopHaptics();
            std::this_thread::sleep_for(std::chrono::milliseconds(10)); //wait for 10ms.
#endif

I join the call stack where the demo is stuck while running in Debug mode: image (11)

This is the crash when running the executable from the Ubuntu console : image (133)

MaxLammers commented 4 years ago

Oddly enough, I can see a call to the GetCalibrationValues() method in that stack, which shouldn't be called when sending Haptics; only when retrieving data (which, in the example, only happens after the vibration finishes). The Haptics functions don't deal with vectors or pointers, only with std::string. The GetCalibrationValues function is responsible for those std::vector<SGCore::Kinematics::Vect3D> operations we see in the call stack. This vector is passed by reference to optimize performance, but could be what's causing an invalid pointer. I will need to see if I can replicate the issue here.

I've also had someone with a similar issue earlier this week, where the SendHaptics function would freeze on Linux. That one was solved with a new (beta) release of SenseCom. I'll push that update to SenseCom before the end of this week, which could also fix the problem.

fahdovski003 commented 4 years ago

Hello @MaxLammers ,

I join the info of our senseglove. The crash did not happen after updating the SenseCom. However, we are still stuck if we enabled the calibration.

senseglove firmware info

bool bSenseComRunning = false;
bSenseComRunning = SGCore::DeviceList::SenseCommRunning(); //check if the Sense Comm is running. If not, warn the end user.
    if(bSenseComRunning)
    {
        SGCore::SG::SenseGlove testGlove;
        if (SGCore::SG::SenseGlove::GetSenseGlove(testGlove)) //retrieves the first Sense Glove it can find. Returns true if one can be found
        {
            std::cout << "\033[0;34m SenseGlove_Main():: Now activating " << testGlove.ToString() << " ... \033[0m" << std::endl;
            std::this_thread::sleep_for(std::chrono::seconds(2));

//#if 0  
            testGlove.SendHaptics( SGCore::Haptics::SG_BuzzCmd(80, 0, 0, 0, 0) ); //vibrate the index fingerat 80% intensity.
            std::this_thread::sleep_for(std::chrono::milliseconds(1000)); //vibrating for for 200ms.

            testGlove.SendHaptics(SGCore::Haptics::SG_BuzzCmd::off); //turn off all Buzz Motors.
            testGlove.StopHaptics();
            std::this_thread::sleep_for(std::chrono::milliseconds(10)); //wait for 10ms.
//#endif
                       **//****** CODE do not reach this point ***////////**
            SGCore::SG::SG_GloveInfo model = testGlove.GetGloveModel(); //Retrieve device information
MaxLammers commented 4 years ago

"we are still stuck if we enabled the calibration"

None of the code you have shared uses calibration functions. What exactly do you mean with; we are still stuck? Does the crash still occur?

The only odd thing I see is a call to both the SendHaptics(BuzzCmd::off) and StopHaptics() functions: These do the exact same thing in the current context (both turn off the Buzz Motors). This shouldn't cause a crash, however, since they're not writing at the exact same time. (I realize this is part of one of the examples, which work fine on our end).

fahdovski003 commented 4 years ago

Hello, the code where you see the #if 0 is the one causing the problems. As you can see my comment in the code (//**** CODE do not reach this point *////////), the program does not reach that section of the code. However, when we disabled that section of the code, we do reach the line : SGCore::SG::SG_GloveInfo model = testGlove.GetGloveModel(); //Retrieve device information and the program works fine from there...

fahdovski003 commented 4 years ago

Hello,

We tried with this code with the updated SenseCOM version v0.10 and i did get the COREDUMP again.

`//#if 0 testGlove.SendHaptics( SGCore::Haptics::SG_BuzzCmd(80, 0, 0, 0, 0) ); //vibrate the index fingerat 80% intensity. std::this_thread::sleep_for(std::chrono::milliseconds(1000)); //vibrating for for 200ms.

testGlove.SendHaptics(SGCore::Haptics::SG_BuzzCmd::off); //turn off all Buzz Motors. testGlove.StopHaptics(); std::this_thread::sleep_for(std::chrono::milliseconds(10)); //wait for 10ms. //#endif`

Senseglove coredump

@MaxLammers This is the line causing the COREDUMP : testGlove.SendHaptics( SGCore::Haptics::SG_BuzzCmd(80, 0, 0, 0, 0) ); //vibrate the index fingerat 80% intensity.

fahdovski003 commented 4 years ago

@MaxLammers , I join the full demo code we are running. sensglove_demo.zip

MaxLammers commented 3 years ago

Hi @fahdovski003, Are you still experiencing this issue? Since we haven't heard from you in a while, could it be possible that an earlier release might have solved your problem?

We're suspecting it is related to our Linux shared library being available in Release configuration only. As per version 1.3 of the SenseGlove API, we're also including the Debug configuration of said library.