Forum Replies Created
-
AuthorPosts
-
10 February 2017 at 15:10 in reply to: [SOLVED] Using a Novint Falcon with SOFA on a 64 bits architecture #8559ErdemirBlocked
Thanks Hugo for the insight. I was also able to solve the problem in another way, based on the code in SensableEmulation/OmniDriverEmu.cpp. I needed to replace the following lines
sofa::helper::WriteAccessor<Data<sofa::helper::vector<sofa::defaulttype::RigidCoord<3,dobble> > > > x = *this->mState->write(sofa::core::VecCoordId::position()); sofa::helper::WriteAccessor<Data<sofa::helper::vector<sofa::defaulttype::RigidCoord<3,double> > > > xfree = *this->mState->write(sofa::core::VecCoordId::freePosition());
with
sofa::helper::WriteAccessor<Data<sofa::helper::vector<sofa::defaulttype::RigidCoord<3,dobble> > > > x = *this->mState->write(sofa::core::VecCoordId::position()); this->getContext()->getMechanicalState()->vRealloc( sofa::core::MechanicalParams::defaultInstance(), core::VecCoordId::freePosition() ); // freePosition is not allocated by default sofa::helper::WriteAccessor<Data<sofa::helper::vector<sofa::defaulttype::RigidCoord<3,double> > > > xfree = *this->mState->write(sofa::core::VecCoordId::freePosition()); /// FIX : check if the mechanical state is empty, if true, resize it /// otherwise: crash when accessing xfree[] and x[] if(xfree.size() == 0) xfree.resize(1); if(x.size() == 0) x.resize(1);
At this moment, I can load the example SofaHAPI problem SofaHAPI1.scn and run a simulation with haptics where I can control the object with Novint Falcon and it seems like I get some force feedback as well. Of course, I need to test further if I am getting desirable control and feedback. This is a great start. I appreciate your help.
About closing the forum, as far as I am concerned, the problem is solved. My experience may also help Benoit to solve his problem as well. I got everything running on Ubuntu 64bit using libnifalcon. I. should note that I had to edit the cmake file for SofaHAPI as it had some rogue lines.
Cheers,
Ahmet
9 February 2017 at 23:29 in reply to: [SOLVED] Using a Novint Falcon with SOFA on a 64 bits architecture #8547ErdemirBlockedDear Hugo,
I think I found the problem. I commented the following lines related to xfree:
sofa::helper::WriteAccessor<Data<sofa::helper::vector<sofa::defaulttype::RigidCoord<3,double> > > > xfree = *this->mState->write(sofa::core::VecCoordId::freePosition());
xfree[currentToolIndex].getCenter() = world_H_virtualTool.getOrigin();
xfree[currentToolIndex].getOrientation() = world_H_virtualTool.getOrientation();
The simulations stopped crashin and I get haptic feedback when I run an example scene. I am not sure if removing the lines related to xfree will break anything else.
Any insights? Thank you again for your help.
Ahmet
9 February 2017 at 18:21 in reply to: [SOLVED] Using a Novint Falcon with SOFA on a 64 bits architecture #8545ErdemirBlockedThanks Hugo,
You are right, I did not copy the correct line it causes the issue at the line
xfree[currentToolIndex].getCenter() = world_H_virtualTool.getOrigin();
I suspect this is related to the casting not working as a few lines above there is the assignment for xfree as
sofa::helper::WriteAccessor<Data<sofa::helper::vector<sofa::defaulttype::RigidCoord<3,double> > > > xfree = *this->mState->write(sofa::core::VecCoordId::freePosition());
Ahmet
9 February 2017 at 17:16 in reply to: [SOLVED] Using a Novint Falcon with SOFA on a 64 bits architecture #8542ErdemirBlockedThanks Hugo,
I tried to dig in a bit deeper. The problem does not seem to be at the lines that you noted as the running of the code does not enter to that if block. The code enters the block for if (isToolControlled) and subsequently the block for if (mstate). It causes the segfault at the line
sofa::helper::AdvancedTimer::stepBegin("SetState");
I appreciate your insight.
9 February 2017 at 15:30 in reply to: [SOLVED] Using a Novint Falcon with SOFA on a 64 bits architecture #8538ErdemirBlockedDear Hugo,
Thanks for the feedback. I tried to put the whole trail of segmentation fault in this message but the forum did not allow me to submit as it suspected that the message was spam. It seems like the fault starts at (the first four lines of segfault)
../lib/libSofaHelper.so.16.12.0(sofa::helper::BackTrace::dump()+0x23) [0x7f9505edf1d3] ../lib/libSofaHelper.so.16.12.0(sofa::helper::BackTrace::sig(int)+0x19c) [0x7f9505edf51c] /lib/x86_64-linux-gnu/libc.so.6(+0x354a0) [0x7f95052fb4a0] /home/aerdemir/Apps/sofa/v16.12/build/install/lib/libSofaHAPI.so(sofa::component::SofaHAPIHapticsDevice::onBeginAnimationStep(double)+0x84e) [0x7f94c84b3b0e]
Ahmet
2 February 2017 at 20:26 in reply to: [SOLVED] Using a Novint Falcon with SOFA on a 64 bits architecture #8503ErdemirBlockedRecently, I was able to get Novit Falcon working using the SofaHAPI plugin on Ubuntu. Except, there was a catch. When I use the following scene, simulation immediately crashed causing a segmentation fault.
<?xml version="1.0"?> <Node name="Root" gravity="0 0 0" time="0" animate="0" > <RequiredPlugin pluginName="SofaHAPI" /> <Node name="Haptics"> <MechanicalObject name="State" template="Rigid" position="0 0 0 0 0 0 1" /> <HAPIHapticsDevice name="NovintFalcon1" printLog="1" drawDevice="1" scale="100"/> </Node> <OglModel filename="mesh/floorFlat.obj" /> </Node>
If I comment the line related to the MechanicalObject, as seen below, the simulation works and I can control the object with Novint Falcon.
<?xml version="1.0"?> <Node name="Root" gravity="0 0 0" time="0" animate="0" > <RequiredPlugin pluginName="SofaHAPI" /> <Node name="Haptics"> <!-- <MechanicalObject name="State" template="Rigid" position="0 0 0 0 0 0 1" /> --> <HAPIHapticsDevice name="NovintFalcon1" printLog="1" drawDevice="1" scale="100"/> </Node> <OglModel filename="mesh/floorFlat.obj" /> </Node>
Any insight on resolving this issue is much appreciated.
Best,
Ahmet
11 October 2016 at 18:54 in reply to: [SOLVED] Using a Novint Falcon with SOFA on a 64 bits architecture #7568ErdemirBlockedUnfortunately, I will not be answering this question. I am simply responding to show my interest in a solution and may be start a community around this topic.
I am interested in hearing about experiences of SOFA users trying to compile and run SofaHAPI and Novint Falcon together. I must admit we have not even successfully compiled SOFA with SofaHAPI yet. I have been working on Ubuntu Linux and had issues with broken CMAKE files among others. Is there anyone who were able compile SOFA and SofaHAPI on linux systems following the instructions provided in the documentation.
Best,
Ahmet
-
AuthorPosts