-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Extern library to the latest XDA (2022.0.0) #38
Update Extern library to the latest XDA (2022.0.0) #38
Conversation
The API changed a lot from 4.8.2 to 2020.0.2 . The recommended API switched to callback based one, but for the time being we kept most of the original logic and just got the device to compile. The device has not been tested.
extern/CMakeLists.txt
Outdated
# Authors: Silvio Traversaro <silvio.traversaro@iit.it> | ||
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LICENSE | ||
|
||
# The code contained in this directory is imported directly from the src_cpp example | ||
# in the MT Software Suite, version 4.8.2, available from https://www.xsens.com/mt-software-suite/ | ||
# in the MT Software Suite, version 2022.0.0, available from https://www.xsens.com/mt-software-suite/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old URL is now broken, can you update it with the new URL from which you got the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated is 0a495b0
xsensmt/XsensMT.h
Outdated
@@ -288,7 +339,8 @@ class yarp::dev::XsensMT : public yarp::dev::IGenericSensor, | |||
bool m_isSensorMeasurementAvailable{false}; | |||
|
|||
// Interface exposed by the Xsens MT Software suite | |||
DeviceClass m_xsensDevice; | |||
XsControl* m_xsensControl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XsControl* m_xsensControl; | |
XsControl* m_xsensControl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 0a495b0
It would be great to actually test on an XSens MTi-300 sensor mounted on an iCub 2.7, do you know the state of iCubGenova04 to see if we can try there? Otherwise we can ask to @Nicogene if he has any idea of how to get one of those devices to test. |
Yes, |
I wanted to suggest removing the With this version of XDA, it seems the thread in the YARP device is redundant. See the relevant information from the SDK documentation: I wanted to have a separate PR for this, but if you think it's ok to propose it in this PR, no probs! |
Also, how to handle the position data, in case the device has this capability, and if it's available. The update seems straightforward when using |
I would go for a separate PR! |
In general, I would develop a custom Network Wrapper Server YARP devices that exposes the required information in the desired form in a YARP port that publishes |
As a starting point, you can copy the code of the |
I moved the discussion to #39 |
I tested this branch with the Xsens MTi-300 mounted on iCubGenova04, the PC runs Ubuntu Compiling and running the device goes with no issues. Also checked the YARP port. Terminal contents for reference
It's worth noting that the sensor
While the
|
When terminating the YARP dvice (ctrl-c) I get a segmentation fault though |
xsensmt/XsensMT.cpp
Outdated
// yDebug("xsensmt: Closing Xsens port %s.", m_portInfo.portName().toStdString().c_str()); | ||
// m_xsensControl->closePort(m_portInfo.portName().toStdString()); | ||
// | ||
// yDebug("xsensmt: Freeing Xsens control object."); | ||
// m_xsensControl->destruct(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are cleanup lines after closing the device, but I noticed they are being executed at a very early stage. And I couldn't understand why!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled in dbd12e7 with @traversaro
Basically XsensMT::close()
is called twice, once because it's called in the deconstructor of XsensMT
and the second after sending a close signal to the YARP device.
The deconstructor is called as soon as XsensMT
is constructed, probably even before open()
is called.
We initialized XsControl* m_xsensControl{nullptr}
to a nullptr
, and called m_xsensControl.destruct()
only if the m_xsensControl
doesn't return nullptr
. After destruct
ing it, the pointer value is set to nullptr
again.
xsensmt/XsensMT.cpp
Outdated
@@ -125,99 +123,130 @@ bool XsensMT::open(yarp::os::Searchable &config) | |||
|
|||
m_portInfo = XsPortInfo(comPortString, XsBaud::numericToRate(baudRate)); | |||
|
|||
m_xsensControl = XsControl::construct(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pay attention to use 4-spaces and not tabs, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for jumping in 😅 Can we fetch directly the code online?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @GiulioRomualdi!
Yes by following https://www.movella.com/support/software-documentation and downloading MT software suite.
You can extract it and follow the readme files to further extract and compile the SDK.
Let me know if you need more info!
See #26 (comment) for more details!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I was mentioned using the CMake. Instead of copy paste the library here is it possible to write a cmake machinery that fetches the code? (not related to the scope of this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there is no (official) public URL from which the code can be downloaded, if you go in their website you need to fill a form.
@traversaro Ready for review! Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor change.
Co-authored-by: Silvio Traversaro <silvio@traversaro.it>
Thanks! |
Thank you @HosameldinMohamed for the effort this will also help us with the new imu on ergocub |
Refer to #26 for more details.
The code is tested with
MTi-680G
, and the overall behavior seems to be the same as in v0.2.2.The PR adds also a copy of the example code provided by Xsens. Renamed to
exampleScanDevicesAndReceiveData.cpp
. It installs an executable calledxsensExample
.