Closed fahdovski003 closed 3 years ago
@MaxLammers : We tried with the program provided called : NoSensecom.cpp provided example (the SenseCOM UI is not used in that example ), we STILL do get the same heavy cpu load...
It expected that there is little performance difference: SenseCom is merely a UI to show you what's going on within the SGConnect library, with some minor extras. The SGConnect library starts up a background process to scan for and exchange data with SenseGloves connected to your system.
SenseCom v0.10 contains a newer version of the SGConnect library, which could explain a difference in performance between this version and the previous one. It also generated a sessionLog.txt which will help me check what might be going on. Could you post that here, perhaps?
Did you experience this CPU load in the previous version of SenseCom, v0.8?
Hi, Same issue with the SenseCOM v0.8 too. Thanks
Session: 2020-09-23 20-20-19 Running SenseCom v0.10 OS: Linux - Linux 5.6 Ubuntu 20.04 64bit
Pre-Initialization; connected Devices:
Initialized communications with code: 1 Successfully initialized Connection library
Quitting next frame
Shutdown initiated from SenseCom_Base. Final Device information: Ports:
Devices: 0: SenseGlove DK1.3-L0023 (DK1.3) running firmware v4.4. Connected via Serial (/dev/ttyACM0) 1: SenseGlove DK1.3-R0022 (DK1.3) running firmware v4.4. Connected via Serial (/dev/ttyACM1) This is the SessionLog.txt :
Attempting to close connections and dispose of resources... Disposed of communications with code: 1 Successfully disposed of Connections library
As i said before, even without the SenseGlove UI and using the NoSensecom.cpp provided example , we still got that CPU load problem.
` // NoSenseCom.cpp : This file contains the 'main' function. Program execution begins and ends there. //
int main() { std::cout << "SGConnect allows us to initialize and detect SenseGloves and other SenseGlove Devices" << std::endl << std::endl;
// SGConnect Initialization
bool alreadyRunning = SGConnect::ScanningActive(); //this function tells us if there is already a scanner active.
if (alreadyRunning)
{
std::cout << "Another program is already scanning, so we will skip the init method right now." << std::endl;
}
else
{
std::cout << "Initializing SenseGlove Communications." << std::endl;
SGConnect::Init();
std::cout << "Done!" << std::endl;
}
std::cout << "Now that we have scanning up and running, we should wait for the Sense Glove to connect." << std::endl;
system("pause");
std::cout << std::endl;
int attempts = 0;
SGCore::SG::SenseGlove testGlove;
bool gloveFound = false;
do
{
gloveFound = SGCore::SG::SenseGlove::GetSenseGlove(testGlove);
attempts++;
if (!gloveFound)
{
std::cout << "Checking for SenseGloves..." << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
} while (!gloveFound && attempts < 10);
if (gloveFound)
{
std::cout << "Found a Device! Lets begin" << std::endl;
//Begin Section of SGCPP
std::cout << "Activating " << testGlove.ToString() << std::endl;
testGlove.SendHaptics(SGCore::Haptics::SG_BuzzCmd(0, 80, 0, 0, 0)); //vibrate the index fingerat 80% intensity.
std::this_thread::sleep_for(std::chrono::milliseconds(200)); //vibrating for for 200ms.
testGlove.SendHaptics(SGCore::Haptics::SG_BuzzCmd::off); //turn off all Buzz Motors.
std::this_thread::sleep_for(std::chrono::milliseconds(10)); //wait for 10ms.
SGCore::SG::SG_GloveInfo model = testGlove.GetGloveModel(); //Retrieve device information
std::cout << std::endl;
std::cout << model.ToString(true) << std::endl; //Log some basic information to the user. (true indicates a short notation is desired)
SGCore::SG::SG_SensorData sensorData;
SGCore::SG::SG_GlovePose glovePose;
while(1)
{
//Retrieving Sensor Data (raw). The lowest level data available
if (testGlove.GetSensorData(sensorData)) //if GetSensorData is true, we have sucesfully recieved data
{
std::cout << std::endl;
std::cout << sensorData.ToString() << std::endl;
}
//Retrieving Glove Pose: The position / rotation of the glove, as well as its sensor angles placed in the right direction.
if (testGlove.GetGlovePose(glovePose))
{
//As an example, lets calculate fingertip positions.
//If we wish to calculate hand variables, we need a "hand profile" to tell the Sense Glove our hand lengths.
SGCore::SG::SG_HandProfile handProfile = SGCore::SG::SG_HandProfile::Default(testGlove.IsRight()); //create a default profile, either left or right.
std::vector<SGCore::Kinematics::Vect3D> tipPositions = glovePose.CalculateFingerTips(handProfile); //calculates fingertip position
std::cout << std::endl;
for (int f = 0; f < tipPositions.size(); f++)
{
std::cout << std::to_string(((SGCore::Finger)f)) << ": " << tipPositions[f].ToString() << std::endl; //writes "thumb: ", "index: " etc.
}
float dThumbIndex = tipPositions[0].DistTo(tipPositions[1]); //calculates the distance between thumb (0) and index finger (1), in mm.
std::cout << "The distance between thumb and index finger is " << std::to_string(dThumbIndex) << "mm." << std::endl;
}
std::this_thread::sleep_for(std::chrono::milliseconds(100));
} //end while loop.
//End Section of SGCPP
}
else
{
std::cout << "Still no SenseGloves found. Please try again" << std::endl;
}
std::cout << std::endl << "Press any key to end. While SGConnect's resources are disposed of during GC, "
<< "it is good practice to dispose of them ouselves if we started them up." << std::endl;
system("pause");
// SGConnect Dispose
if (!alreadyRunning)
{
std::cout << std::endl << "This program initialized the SenseGlove Communications, so we should properly end them." << std::endl;
std::cout << "Disposing..." << std::endl;
SGConnect::Dispose();
std::cout << "Done!" << std::endl;
}
} `
Just run the SenseCOM UI 0.10 on Windows 10. It is eating 20% CPU. So it is a problem with the linux version ...
Strange, we are using the same Boost libraries for communications in both Windows and Linux. We will look into the performance of the Linux version to try and reduce the CPU load.
@fahdovski003 I've added some decent performance optimizations to the SGConnect library (and by extension, SenseCom) in today's commit. Could you try to see if this works for your project as well?
Ok. I will check it. @MaxLammers Are the improvement both on Windows and Linux platforms ?
Yes, these improvements are applied to both Linux and Windows versions
@MaxLammers you updated SGconnect. I am not using it. I am only using SGCore.
The commit you are referring to updates the .dll and .so version of SGConnect used by SenseCom and the examples.
The SGConnect library is used to scan for and communicate with SenseGlove devices in the background. Any program using the SGCore library can then access the data generated by SGConnect. SenseCom initializes the SGConnect library, and provides us with a UI to see what's going on in the background.
If you're connecting to your SenseGlove(s); you are in fact using SGConnect.
ok
Considering this issue fixed as of Performance Optimization commit on Oct 19th. Closing it as there have been no updates for over a month.
Hi,
@MaxLammers : We launched the SenseCOM UI v0.10 on Ubuntu 20.04LTS and it is eating a very big amount of CPU. No demo code is running, just the SenseCOM UI alone.
Any help on this issue, do you suggest we upgrade the firmware of the SenseGlove may be ?