Home › Forum › SOFA › Programming with SOFA › [SOLVED] Geomagic plugin: Problem with reading position in cpp
Tagged: 64_bits, Linux_ubuntu, Plugin_Geomagic, SOFA_1906
- This topic has 9 replies, 2 voices, and was last updated 4 years, 8 months ago by Hugo.
-
AuthorPosts
-
29 March 2020 at 23:27 #15576bobikoBlocked
Hi all,
I have an issue with Geomagic plugin in cpp. Geomagic driver initializes successfully, but it only updates the orientation of gimbal, whereas position always stays at
{0, -11, -3.5}
. I tried both simple API and the regular way:GeomagicDriver::SPtr driver = sofa::core::objectmodel::New<GeomagicDriver>(); driver->setName("GeomagicDevice"); driver->d_deviceName.setValue("Default Device"); driver->d_orientationBase.setValue({0, 0, 0, 1}); driver->d_positionBase.setValue({0,0,0}); driver->d_scale.setValue(1); root->addObject(driver);
but the result stays the same. At the same time if I run a sample scene in XML everything works like a charm. Could you tell if there is anything that should be initialized additionally when working with Geomagic plugin in cpp?
Thanks in advance,
Vlad31 March 2020 at 11:02 #15593HugoKeymasterHi @bobiko
I am no big expert of the Geomagic.
Strange, did the calibration phase run properly? maybe run it again.
Is there nothing enforcing these values in your script, because it looks pretty round{0, -11, -3.5}
!Best wishes,
Hugo
31 March 2020 at 14:18 #15603bobikoBlockedHi @hugo,
The calibration seems to be fine, as the wrist angles are updated. However, the joint angles are stuck at the initial values
{0 0 1.5708}
. The last one corresponds to pi/2, so I guess that the actual value that is read is 0, too.Best regards,
Vlad31 March 2020 at 14:59 #15606HugoKeymasterAre the joint angles in the calibration or only during the simulation?
Hugo
31 March 2020 at 16:19 #15607bobikoBlockedI do not explicitly call calibration in the code, should I? I don’t seem to find a function for that in GeomagicDriver. Joint angles values are like that before and during the simulation. For what it’s worth, calling
updatePosition()
in main after initialization causes the program to crash.31 March 2020 at 18:14 #15609bobikoBlockedOk, so I have added Geomagic driver sources to the code, and apparently
hdhdGetDoublev(HD_CURRENT_TRANSFORM, driver->m_omniData.transform)
andhdGetDoublev(HD_CURRENT_JOINT_ANGLES,driver->m_omniData.angle1)
always return false values. Still need to figure out why.Vlad
31 March 2020 at 19:08 #1561131 March 2020 at 19:16 #15612bobikoBlockedAppearently the problem is coming from locales, as written here. I get similar behavior when changing locales and running a sample scene with runSofa. The only question now is why does this happen to a cpp project, when it uses system env vars and should be no difference.
31 March 2020 at 23:42 #15616bobikoBlockedWhoohoo, I found the answer!The problem was in locales indeed, mine was set to de_BE.UTF-8, and somehow it worked with runSofa, but not in a custom project. When I changed it to en_US.UTF-8, it didn’t work at all. What fixed the problem though was that the device should have been setup with locales to en_US.UTF-8 and run later with this LC_NUMERIC and LANG set to en_US.UTF-8.
1 April 2020 at 13:56 #15620 -
AuthorPosts
- You must be logged in to reply to this topic.