Forum Replies Created
-
AuthorPosts
-
agnivBlocked
Hi Hugo,
I’m in Rainbow team, not Hybrid.
Thanks for the information, I’ll stick to explicit solvers for the purpose.
Regards,
AgnivagnivBlockedSo, can I assume that the VecDeriv object ‘f’ in the
addForce()
method of FastTetrahedralCorotationalForceField would provide the force on each indices?So the inverse of the resultant of all the forces is the external force needed to cause the same displacement?
If that is correct, it will neatly solve my problem. I will try this out soon.
Thanks a lot.
agnivBlockedHey @Hugo,
Sorry for responding so late, but I indeed managed to reset the scene by re-initializing the state vectors of the MechnicalObject.
Thanks a lot for the help.
Best Regards,
Agniv.agnivBlockedDear @hugo,
One more update, I tried to reset the mechanical object using:
self.myMechanicalObjectPointer.reset()
However, it still seems like the model is slowly converging back to the neutral configuration. The surface of the object slowly oscillates back to rest.
Regards,
Agniv.agnivBlockedDear @Hugo
I am trying to apply a small force to a specific node along X, Y and Z axis…. and study the result of the application of this force on the object.
Given the object in its rest configuration, I apply \Delta F_x, \Delta F_y and \Delta F_z on the node. This produces three different output, which I capture using the OBJExporter script. I intend to use these three responses (the .obj files that are exported), to evaluate a certain error function so that I can numerically compute the gradient along these three axes.
So, between the application of the forces \Delta F_x, \Delta F_y and \Delta F_z, I do not want the effect of one of the force to be carried over to the next force’s effect. Since I am trying to run this as a batch application in a loop for a large number of iterations (and intend to have some kind of a real-time system in the future), I am concerned about the run time. Therefore, I would prefer to not wait for many time-steps before the system stabilizes in between the application of the forces.
Obviously, the same system dynamics causes problem when I apply the force. It takes time to stabilize in its deformed configuration. But I kind of worked around the problem by setting the time-step ‘dt’ to a very large value. The deformation stabilizes in one time step (of 25-30 iterations of the CG Linear Solver). However, while removing the force, the same trick does not work. The system oscillates quite a bit, over many time-steps, before returning to the rest configuration.
To answer your other questions:
Do you know how many times you have to do it? Many times over. Nearly 12 – 18 times per frame.
Do you need to save information from one simulation to another? Not really. Once the force has been applied and the output logged, it is preferable that the system ‘forgets’ about all the previous forces applied.
Best,
Agniv.agnivBlockedHi Hugo,
Stripping down the code to the basics, and using the CMakeLists.txt you suggested results in the following compilation error:
/usr/bin/ld: cannot find -lSofaComponentCommon collect2: error: ld returned 1 exit status CMakeFiles/Sofa.dir/build.make:130: recipe for target 'Sofa' failed make[2]: *** [Sofa] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Sofa.dir/all' failed make[1]: *** [CMakeFiles/Sofa.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
I played around a bit and changed the CMakeLists.txt to:
cmake_minimum_required(VERSION 3.1) project(Sofa) set(SofaFramework_DIR "path/to/sofa/build/install/lib/cmake") set(SofaCommon_DIR "path/to/sofa/build/install/lib/cmake") set(CMAKE_PREFIX_PATH "path/to/Code/sofa/build/install/lib/cmake") link_directories("path/to/sofa/build/install/lib") #find_package(SofaFramework REQUIRED) find_package(SofaCommon) find_package(SofaFramework) find_package(SofaSimulation) find_package(SofaGui) find_package(SofaBase REQUIRED SofaComponentBase) add_executable(${PROJECT_NAME} Main.cpp) target_link_libraries(${PROJECT_NAME} SofaComponentCommon SofaComponentBase SofaHelper SofaDefaultType SofaCore SofaSimulationTree SofaSimulationGraph SofaGuiMain)
This allows the code to compile. But It results in the following runtime error while running the generated executable:
./Sofa: error while loading shared libraries: libSofaSimulationCommon.so.18.06.dev: cannot open shared object file: No such file or directory
I tweaked this a bit, but keep running into similar runtime errors, including errors from libSofaComponentBase etc.
FYI… the new cpp code looks like this:
#include <sstream> using std::ostringstream ; #include <fstream> #include <sofa/helper/ArgumentParser.h> #include <SofaSimulationCommon/common.h> #include <sofa/simulation/Node.h> #include <sofa/helper/system/PluginManager.h> #include <sofa/simulation/config.h> #include <SofaSimulationTree/init.h> #include <SofaSimulationTree/TreeSimulation.h> #include <sofa/helper/BackTrace.h> int main(int argc, char** argv) { sofa::helper::BackTrace::autodump(); sofa::simulation::setSimulation(new sofa::simulation::tree::TreeSimulation()); std::ostringstream no_error_message; std::cout<<"All OK!"<<std::endl; return 0; }
never managed to get till printing “All OK!”.
What can be done next?
Cheers,
Agniv.agnivBlocked@egarcm Ah! Yes, those fields are empty, indeed!
Did you figure out a workaround? Is that actually the root cause?
(What OS are you using, btw? I have a suspicion, the interaction between TinyXML and Ubuntu 17 might be going wrong in my case!)
agnivBlockedHi @egarcm,
Do you mean
sofa_scene/build/CMakeCache.txt
?I do not have those strings in that file! In a fresh build, I do not have nearly as many lines as that.
agnivBlockedHi,
My CMakeLists.txt, in the SOFA scene project, now reads:
cmake_minimum_required(VERSION 3.1) project(Sofa) set(CMAKE_PREFIX_PATH "/path/to/sofa/build/install/lib/cmake") find_package(SofaComponentCommon) add_executable(${PROJECT_NAME} Main.cpp) target_link_libraries(${PROJECT_NAME} SofaComponentCommon)
I ran
make
andsudo make install
in the SOFA build directory already.The folder in /path/to/sofa/build/install/lib/cmake contains the following sub-directories:
-
CImg
CImgPlugin
CSparse
GTest
Newmat
QGLViewer
SceneCreator
SofaAdvanced
SofaBase
SofaCommon
SofaFramework
SofaGeneral
SofaGTestMain
SofaGui
SofaMisc
SofaMiscCollision
SofaPython
SofaSimulation
SofaTest
TinyXMLHowever, when I run
cmake ..
in the build directory of the SOFA scene demo project, I see the following output:-- The C compiler identification is GNU 7.2.0 -- The CXX compiler identification is GNU 7.2.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Warning at CMakeLists.txt:9 (find_package): By not providing "FindSofaComponentCommon.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "SofaComponentCommon", but CMake did not find one. Could not find a package configuration file provided by "SofaComponentCommon" with any of the following names: SofaComponentCommonConfig.cmake sofacomponentcommon-config.cmake Add the installation prefix of "SofaComponentCommon" to CMAKE_PREFIX_PATH or set "SofaComponentCommon_DIR" to a directory containing one of the above files. If "SofaComponentCommon" provides a separate development package or SDK, be sure it has been installed. -- Configuring done -- Generating done -- Build files have been written to: /path/to/sofa_scene/build
If I ignore the warning and run the
make
command, I get the following:[ 50%] Building CXX object CMakeFiles/Sofa.dir/Main.cpp.o /path/to/sofa_scene/Main.cpp:5:10: fatal error: sofa/helper/ArgumentParser.h: No such file or directory #include <sofa/helper/ArgumentParser.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. CMakeFiles/Sofa.dir/build.make:62: recipe for target 'CMakeFiles/Sofa.dir/Main.cpp.o' failed make[2]: *** [CMakeFiles/Sofa.dir/Main.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Sofa.dir/all' failed make[1]: *** [CMakeFiles/Sofa.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
agnivBlockedThe same code as given in: the demo.
I do not want Main.cpp to do much, as of now. I just want it to compile with full functionality, so that I can play around with it, and eventually do a FEM simulation of sorts.
agnivBlockedIf I link it with just SofaComponentCommon, I get a different output:
CMake Warning at CMakeLists.txt:7 (find_package): By not providing "FindSofaComponentCommon.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "SofaComponentCommon", but CMake did not find one. Could not find a package configuration file provided by "SofaComponentCommon" with any of the following names: SofaComponentCommonConfig.cmake sofacomponentcommon-config.cmake Add the installation prefix of "SofaComponentCommon" to CMAKE_PREFIX_PATH or set "SofaComponentCommon_DIR" to a directory containing one of the above files. If "SofaComponentCommon" provides a separate development package or SDK, be sure it has been installed. -- Configuring done -- Generating done -- Build files have been written to: /path/to/sofa_scene/build
I tried doing
make
with this output. It does not compile, I get the error message:[ 50%] Building CXX object CMakeFiles/Sofa.dir/Main.cpp.o /path/to/sofa_scene/Main.cpp:5:10: fatal error: sofa/helper/ArgumentParser.h: No such file or directory #include <sofa/helper/ArgumentParser.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. CMakeFiles/Sofa.dir/build.make:62: recipe for target 'CMakeFiles/Sofa.dir/Main.cpp.o' failed make[2]: *** [CMakeFiles/Sofa.dir/Main.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Sofa.dir/all' failed make[1]: *** [CMakeFiles/Sofa.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
agnivBlockedI changed the cmake file to:
cmake_minimum_required(VERSION 3.1) project(Sofa) set(SofaFramework_DIR "/path/to/sofa/build/cmake/") find_package(SofaFramework REQUIRED) find_package(SofaComponentCommon) add_executable(${PROJECT_NAME} Main.cpp) target_link_libraries(${PROJECT_NAME} SofaFramework SofaComponentCommon)
Looks like that worked! But now I get a different error:
CMake Error at /home/agniv/Code/sofa/build/cmake/SofaFrameworkConfig.cmake:36 (find_package): By not providing "FindTinyXML.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "TinyXML", but CMake did not find one. Could not find a package configuration file provided by "TinyXML" with any of the following names: TinyXMLConfig.cmake tinyxml-config.cmake Add the installation prefix of "TinyXML" to CMAKE_PREFIX_PATH or set "TinyXML_DIR" to a directory containing one of the above files. If "TinyXML" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): CMakeLists.txt:6 (find_package) -- Configuring incomplete, errors occurred! See also "/home/agniv/Code/sofa_scene/build/CMakeFiles/CMakeOutput.log". Makefile:176: recipe for target 'cmake_check_build_system' failed make: *** [cmake_check_build_system] Error 1
But I had installed SOFA using TinyXML.
agnivBlockedSo I change the Cmake file to:
cmake_minimum_required(VERSION 3.1) project(Sofa) set(SofaFramework_DIR "/path/to/sofa/build/") find_package(SofaFramework REQUIRED) find_package(SofaComponentCommon) add_executable(${PROJECT_NAME} Main.cpp) target_link_libraries(${PROJECT_NAME} SofaFramework SofaComponentCommon)
This still does not work!
agnivBlockedHow do I do that? I tried setting SofaFramework_DIR to the build path, but that did not work.
agnivBlockedHi,
I have tried to build the demo scene. Here’s what I do:
I have the following directory structure:
sofa_scene
|
+—>build/
|
+—>CMakeLists.txt
|
+—>Main.cppThe Main.cpp is an exact copy from the tutorial.
The CMakeLists.txt contains:
cmake_minimum_required(VERSION 3.1) project(sofa_scene) find_package(SofaFramework REQUIRED) find_package(SofaComponentCommon) add_executable(${PROJECT_NAME} Main.cpp) target_link_libraries(${PROJECT_NAME} SofaFramework SofaComponentCommon)
When I run
cmake ..
from the build directory, I get:CMake Error at CMakeLists.txt:4 (find_package): By not providing "FindSofaFramework.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "SofaFramework", but CMake did not find one. Could not find a package configuration file provided by "SofaFramework" with any of the following names: SofaFrameworkConfig.cmake sofaframework-config.cmake Add the installation prefix of "SofaFramework" to CMAKE_PREFIX_PATH or set "SofaFramework_DIR" to a directory containing one of the above files. If "SofaFramework" provides a separate development package or SDK, be sure it has been installed. -- Configuring incomplete, errors occurred! See also "sofa_scene/build/CMakeFiles/CMakeOutput.log".
Again, not sure what is happening here. Please help.
Best Regards,
Agniv.agnivBlockedI have the following folders in examples/Tutorials/ folder:
Basic Collision ForceFields Mappings OldTutorials sandbox Solvers StepByStep Topologies
But none of them seem to contain any cpp files.
I do understand how to create a simple scene using XML and to solve it. But how do I do the same using cpp?
Best,
Agniv. -
AuthorPosts