SofaDefrost / Cosserat

A SOFA plugin to simulate linear structures using Cosserat theory
GNU Lesser General Public License v3.0
46 stars 22 forks source link

Plugin not found: "CosseratPlugin" #53

Open 0707yiliu opened 1 year ago

0707yiliu commented 1 year ago

I‘m trying to add this plugin into the SofaGym-CartStemContactScene. When I import it into sofa without using the test selection, it's working.

And Using the SofaGym test_env.py to make env, it would feedback the error like:

[ERROR] [RequiredPlugin(SofaPlugins)] Plugin not found: "CosseratPlugin"

Failed to load: ["CosseratPlugin"]

Init cartstem_config... Init CartStem... [ERROR] [SofaRuntime] ValueError: Object type BeamHookeLawForceField<> was not created
The object is not in the factory.

Traceback (most recent call last): File "/home/yi/peg_in_hole/SofaGym/sofagym/env/common/rpc_client.py", line 178, in root = init_simulation(config, _startCmd, mode='simu') File "/home/yi/peg_in_hole/SofaGym/sofagym/env/common/../../../sofagym/env/common/simulate.py", line 50, in init_simulation create_scene(root, config, mode = mode) File "/home/yi/peg_in_hole/SofaGym/sofagym/env/common/../../../sofagym/env/CartStemContact/CartStemContactScene.py", line 68, in createScene cartstem.onEnd(rootNode) File "/home/yi/peg_in_hole/SofaGym/sofagym/env/common/../../../sofagym/env/CartStemContact/CartStemContact.py", line 55, in onEnd self.path = cosserat(self.cartstem, path_config, name="Path", orientation=[0, 0, 0, 1], radius=0.5) File "/home/yi/peg_in_hole/SofaGym/sofagym/env/common/../../../sofagym/env/CartStemContact/../common/utils.py", line 136, in createCosserat BeamHookeLawForce = rateAngularDeformNode.addObject('BeamHookeLawForceField',

Exception in thread Thread-2:

alxbilger commented 1 year ago

Hi @0707yiliu,

you did not mention if you already have CosseratPlugin or not. It's an external plugin, so it does not come with Sofa. You need to compile it or get the binaries.

0707yiliu commented 1 year ago

Yes, I have import the plugin into sofa, and using the cmake-gui to make the whole sofa like:

Adding plugin ArticulatedSystemPlugin SofaPython3 is compiled as a subproject to the external project 'Sofa'. Adding plugin SofaPython3 Python: Version: 3.9.12 Executable: /home/yi/anaconda3/envs/peginhole/bin/python3.9 Headers: /home/yi/anaconda3/envs/peginhole/include/python3.9 Libraries: /home/yi/anaconda3/envs/peginhole/lib/libpython3.9.so User site: /root/.local/lib/python3.9/site-packages pybind11: Version: 2.9.1 Config: /usr/lib/cmake/pybind11/pybind11Config.cmake Adding binding module SofaBaseTopology Adding binding module SofaDeformable Adding binding module SofaLinearSolver Adding binding module SofaConstraintSolver Adding binding module SofaGL Adding plugin SofaMatrix Adding plugin BeamAdapter Install prefix: /home/yi/sofa/build/v22.06/applications/plugins/plugin.Cosserat/install/CosseratPlugin Adding plugin STLIB Install prefix: /home/yi/sofa/build/v22.06/applications/plugins/STLIB/install/STLIB Adding plugin SoftRobots Install prefix: /home/yi/sofa/build/v22.06/applications/plugins/STLIB/install/STLIB -- Found dependency : 'STLIB' plugin . Adding plugin CosseratPlugin Install prefix: /home/yi/sofa/build/v22.06/applications/plugins/plugin.Cosserat/install/CosseratPlugin -- Found dependency : 'STLIB' plugin . -- Found dependency: 'SoftRobots' plugin. -- Python3 packages will be installed. Adding application SceneChecking Adding application runSofa Write Plugin list at /home/yi/sofa/build/v22.06/lib/plugin_list.conf.default Configuring done CMake Warning at /usr/share/cmake-3.22/Modules/FindPython/Support.cmake:3330 (add_library): Cannot generate a safe runtime search path for target Bindings.SofaExporter because files in some directories may conflict with libraries in implicit directories:

runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /home/yi/anaconda3/envs/peginhole/lib

Some of these libraries may not be found correctly. Call Stack (most recent call first): /usr/share/cmake-3.22/Modules/FindPython.cmake:580 (__Python_add_library) applications/plugins/SofaPython3/CMake/SofaPython3Tools.cmake:125 (python_add_library) applications/plugins/SofaPython3/bindings/SofaExporter/CMakeLists.txt:18 (SP3_add_python_module)

Generating done

0707yiliu commented 1 year ago

Hi, @alxbilger , one more thing I need to said that my system is Ubuntu22 and python3.9, I'm not sure whether it would produce bug or not.

alxbilger commented 1 year ago

Do you see the binary of the plugin in your build directory? It's the folder where you have the runSofa executable

0707yiliu commented 1 year ago

Do you see the binary of the plugin in your build directory? It's the folder where you have the runSofa executable

Hi, @alxbilger . Do you means the CosseratPlugin's binary file? I installed the git-source file into sofa/src/applications/plugins/.

alxbilger commented 1 year ago

Yes, the binary file of the Cosserat plugin. It should be in bin, in your build folder.

0707yiliu commented 1 year ago

Hi, @alxbilger

I can not see any binary file about the Cosserat Plugin in this dir: build/v22.06/bin, which has runSofa and some plugins'test file such as BeamAdapter_test.

alxbilger commented 1 year ago

That is why SOFA cannot find the plugin. Check that you do compile the plugin.

0707yiliu commented 1 year ago

It's weird, I can see the plugin has been imported into sofa in cmake-gui. But I can not see it in build/lib or build/bin

0707yiliu commented 1 year ago

Updating...

the plugin has working, but the .so file (binary file) is generated in build/application/plugins dir, I copied it to build/lib dir which makes the sofa can search the plugin.

Second, the plugin's src/config and src/init file may has some problem? (I modified the project name to real name XXXplugin instead of @PROJECT_NAME@, otherwise, the sofa would get the plugin name like "@PROJECT_NAME@")

If you know what make it has the problem like above, please let me know.

Best

Yi

alxbilger commented 1 year ago

@0707yiliu thanks for reporting the issue. Indeed, there was a problem on the location of the plugin. This should be solved soon on the master branch.

I am not so sure about the project name. I was not able to reproduce the problem. At least, not on the master branch.