Forum Replies Created
-
AuthorPosts
-
JonnyBlocked
Hi again,
so
scaleTex="1 -1"
did the trick for me, i.e. mirroring at the horizontal axis. I am still not quite sure as to why this is needed, but I’ll take it.On another note: The file produced by the OBJExporter seems to differ from the obj-file that is loaded initially. I haven’t looked into that exactly as I don’t need it right now – the order of the vertices and normals is definitely different though. Just fyi, might also be confusion on my side.
Best,
JonnyJonnyBlockedHi @froy,
Also thanks to your for your fast response and the suggestions.
flipNormals="true"
does not seem to change anything, setting this data field to false doesn’t change anything either though, so I am a little confused.
I will look into thescaleTex
data field, and also take another closer look at the apparent misalignment of the image to check whether this is a possible solution. I will let you know as soon as I figure it out or get stuck again 😀If you happen to have more ideas, feel free to let me know.
Jonny
JonnyBlockedHi @hugo,
thanks for you further reply!
Adding the proposed data field did lead to the same result as loading everything inside the OglModel, so it allows me to use to newer components.
Now, the seams are handled but the texture image still is aligned wrong (see the image I linked above). Would be great if you could add another engineer who might know more about using image texturing.Best,
JonnyJonnyBlockedMaybe this also helps:
Blender vs Sofa texture issue imageOn the left is my Sofa scene, on the right the same obj with the same texture image in Blender. It seems as if the uv map is the same but the image is aligned differently (maybe u and v coordinates defined differently?), simply rotating the image did not solve the issue so far, although maybe I haven’t found the right “transformation” yet (however, the reason for this issue would remain unclear). In Sofa everything is added via the OglModel, no separate MeshObjLoader.
JonnyBlockedHi @hugo,
Thanks for your reply.
I have made some small progress by realizing that
visual.addObject('OglModel', name="VisualModel", fileMesh="../data/ellipsoid/ellipsoid_dds.obj", texturename=textureFilename)
produces a different visual model thanvisual.addObject('MeshObjLoader', name="meshLoader_0", filename="../data/ellipsoid/ellipsoid_dds.obj") visual.addObject('OglModel', name="VisualModel", src="@meshLoader_0", texturename=textureFilename
.
What makes this even stranger is that when adding both, the mesh and the texture, via the OglModel, the uv mapping seems to be right although this component is deprecated. When loading the mesh first and then referencing it from the OglModel this is not the case. However, even in the first case the texture seems to be rotated/mirrored s.t. the rendered image still looks different compared to the one in Blender. Also I don’t understand why I have to reference the texture separately as this is already done in the obj/mtl file (texture is not loaded if I omit the texturename data field).Again, to clarify: what I want to achieve right now is that the Sofa scene looks the same as the pytorch3d rendered image. For me, it appears there two ways of getting there:
1. Load my Blender obj in Sofa such that it looks the same in both. Rendering it in pytorch3d is not an issue (Blender rendered image”=”pytorch3d rendered image), in Sofa this is the texture issue described above. If I were to fix this, then I wouldn’t even need the OBJExporter since I could read out the node positions separately and just pass them to pytorch3d after deformation (I only need them to evaluate the results of the mesh fitting which is purely image-based).
2. If it is not possible to get the texture to look the same in Sofa, then I could just export the Sofa obj and use that in pytorch3d (basically omit the Blender obj). However, here the problem is exporting the texture with the obj. Manually adding that in produces a different result.
Hope this clarifies my current issues and thanks again for your help!
Jonny
JonnyBlockedHi @scheikl,
thanks again for your fast response. Indeed, using Rigid3d template simplified the use of
LinearMovementConstraint
quite a bit (especially for floor rotation).Next thing I am stuck with is the connection between bellow and floor (more important in the other scene with two bellows). From what I have seen
AttachConstraint
andBilateralInteractionConstraint
would be the best options.
From my understanding I would need both the floor and bellow to have the same DOFs (Vec3d in my case). Now when I use AttachConstraint the connection looks pretty realistic and I can easily change the connected “area”. However the floor is deforming rather than moving once I inflate the bellow whereas I would want the floor to be rigid. Is there a way to fix this?
Furthermore, I want to restrict the movement to just rotation around the x axis – so no translation either.FixedRotationConstraint
seems to work for rotation, and I have triedFixedPlaneConstraint
without any success. I guess I could usePartialFixedConstraint
with Rigid3d as well and then just constraint that one node though the attachment would then not work anymore.I found another topic (https://www.sofa-framework.org/community/forum/topic/attach-a-rigid-cube-to-flexible-fem-body/) with a similar problem where @hugo suggested to create a dedicated subnode to connect the two models. How would I do that?
Thanks again for any help!
Jonny
JonnyBlockedWent back to an older commit that worked, so I will mark this topic as resolved.
JonnyBlockedI see, that makes things a little more complicated.
There are other options to define ROI – you can read more about them and find example scenes here: ROI selection
Maybe a combination of those will work for you.JonnyBlockedHi @anoushs,
you should be able to define different sections of your finger with BoxROI and then create a child of your object with a separate forcefield. Following the pneunet gripper tutorial it would look like this (step3-StiffLayer):
finger.createObject('BoxROI', name='boxROISubTopo', box='-100 22.5 -8 -19 28 8') modelSubTopo = finger.createChild('modelSubTopo') modelSubTopo.createObject('Mesh', position='@loader.position', tetrahedra="@boxROISubTopo.tetrahedraInROI", name='container') modelSubTopo.createObject('TetrahedronFEMForceField', template='Vec3d', name='FEM', method='large', poissonRatio='0.3', youngModulus='1500')
Also, it should be possible to have a separate mesh for each component (with different material properties) in Sofa and then attach them with something like
AttachConstraint
orBilateralInteractionConstraint
. I have tried something similar once without any success so if the first approach works for you, I think that’s the easier way to do it. But maybe someone knows how to properly use those components – I would be interested to hear that as well.Cheers,
JonnyJonnyBlockedHi @biu,
there is no fixed unit system in sofa, you just have to make sure that units are correct relative to each other. This is also explained at around 4:30 min in Sofa & Soft Robotics: First Steps Tutorial.Btw this tutorial is a good starting point in terms of understanding some of the main concepts of Sofa and the general structure of a scene. Hope that helps.
Best,
JonnyJonnyBlockedI don’t know for sure if this helps with .igs but I had a similar issue when using stl files in Gmsh that also only contain surface information. I opened my file with File -> Merge and used Geometry -> Elementary entities -> Add -> Volume. After selecting your mesh and following the on-screen instructions you should be able to 3D Mesh, export the resulting vtk/msh file, and use it in sofa.
Cheers,
JonnyJonnyBlockedOk, so I just figured that the entire sequence loops after 200 s and all of the moves take up the same fraction of that – adding points in the middle of movements should then enable me to influence the speed the way I want to.
What is strange about the stuff regarding orientation is that when I manually configure a camera pose that I like and then use ‘Save View’ to receive the position and orientation that pose is not the same when using RecordedCamera in navigation mode. This makes it incredibly hard to find good values for navigation at the moment. Also, for some reason the movements are not continuous at some point.
E.g. this is the movement I am testing currently with my object being located at ‘0 0 6’:
rootNode.createObject('RecordedCamera', name='recCam', cameraPositions='0 0 0 0 0 -2 -3.16585 1.921903 -1.64586 -2.84849 1.06864 -1.08607', cameraOrientations='1 0 0 0 1 0 0 0 0.988631 0.0218145 -0.13557 -0.061273 0.988631 0.0218145 -0.13557 -0.061273', listening='1', projectionType='0', navigationMode='1')
First two moves (zooming out and slight tilt with side movement) work fine but then the view jumps before the third move is executed (also the end pose is different then the one I extracted with ‘Save View’). This should just be a translation or am I missing something? I am not very familiar with quaternions so maybe someone can help me with that.
JonnyBlockedThanks @hugo and @froy for you replies.
I got the SLAM to run without giving my any error messages, that’s why I closed this topic. However, it is not working very well atm and I am not exactly sure why that is. So far I have calibrated the camera using SOFA screenshots of a floor with checkerboard texture (like you would do with real physical camera) with MATLAB Calibration Toolbox. Thus I obtained the intrinsic camera parameters and with some minor changes in the SLAM code, I was able to get it to run through. The mapping is pretty poor right now, my guess would be that the scene I am using right now (contains RecordedCamera to determine a certain camera path) is not optimally suited for my use-case. But maybe the whole calibration thing was wrong in the first place. Does somebody have any experience using simulation image data with computer vision/mapping algorithms?
In terms of the screenshot size/resolution I am going to look into the recording function, as of right now that’s not my biggest concern though. As long as I don’t change the size of the widget the resolution remains the same.
I will open this topic again and post an update as soon as I progress!
JonnyBlockedHi @scheikl,
I’m currently trying all the different options/components that could be useful in the two scenes in order to figure out which work best. I will post an update as soon as I meet another problem or get everything to work 🙂 Once again thanks for you help so far!
Cheers
JonnyBlockedHi @scheikl,
thanks for your fast response again. Indeed, using Rigid3d template simplified the use of
LinearMovementConstraint
quite a bit.Next thing I am stuck with is the connection between bellow and floor (more important in the other scene with two bellows). From what I have seen
AttachConstraint
andBilateralInteractionConstraint
would be the best options.
From my understanding I would need both the floor and bellow to have the same DOFs (Vec3d in my case). Now when I use AttachConstraint the connection looks pretty realistic and I can easily change the connected “area”/nodes. However the floor is deforming rather than moving once I inflate the bellow whereas I would want the floor to be rigid. Is there a way to fix this?
Furthermore, I want to restrict the movement to just rotation around the x axis – so no translation either.FixedRotationConstraint
seems to work for rotation, and I have triedFixedPlaneConstraint
without any success. I guess I could usePartialFixedConstraint
with Rigid3d as well and then just constraint that one node though the attachment would then not work anymore.I found another topic (topic) with a similar problem where @hugo suggested to create a dedicated subnode to connect the two models. How would I do that?
Thanks again for any help!
Jonny
JonnyBlockedHi @hugo,
I am still struggling with this. Can you help me with any of my questions or poke someone who can please?
Cheers,
JonnyJonnyBlockedHi Camille,
you have to change “View” to OpenGL via the SOFA GUI in order to see the camera moving. Hope this helps!
JonnyBlockedHi,
thank you for your replies and sorry for answering so late but I was working on something different in the meantime.
@scheikl: Thanks for the provided example. So far I haven’t been able to get it working that way but I am sure it will come in handy at a later point and has given me a good idea of how to avoid inflating/deflating manually in the future which I did not think about before.
@hugo I uploaded my files here:
example files
LinearMovementConstraint seems to work now, translating the floor with the controller does not, so maybe you could still have a look.Also I’m struggling to understand how to properly use the different models (especially collision, as my scene gets pretty slow once the bellow hits the floors). The next step would be to have larger floors and two bellows next to each other (as in ‘bellow_rotatory_floors.py’ in the provided folder). Then one of the bellows is inflated causing the floor to rotate around its x-axis and pushing down on the other bellow and so on – both of the bellows should be attached to the floors at their top/bottom center. I found Bilateral Movement Constraint and the corresponding example scene but I don’t understand how to use it properly in my scene. Also I am not sure which component to use regarding the movement of the floor which should be limited to rotation around one axis.
So altogether:
1. How do I get my scene to run smoother during collision?
2. How to best implement the different models and mappings?
3. How to properly attach bellows to floors?
4. How to allow/constraint movements of the floor in case of collision?Thank you so much for your help! If you have any question regarding my code or this long post please do not hesitate to ask 🙂
JonnyBlockedYes, I think so! Thanks again for your help.
JonnyBlockedI didn’t have the flag you recommended activated but now, after recompiling, it works! Thank you so much. Also the few scenes I checked today did not have the issue with the coordinate system – though I am not sure whether that is because I tried different scenes or if the problem was fixed somehow.
JonnyBlockedThank you so much for your help!
Here is a screenshot for the “orientation vectors”/coordinate system issue as reference
About QT: I don’t really know what the problem is. I am using QT 5.15.0 and installed QT Charts and WebEngine using the Maintenance Tool. I added the CMAKE_PREFIX_PATH and everything seemed to work. But when I try to open the Doc Browser in the Sofa GUI, the following Warning shows:
[WARNING] [RealGUI] Doc browser has been disabled because Qt5WebEngine is not available
JonnyBlockedHi,
here is a quick update on my current status: after successfully configuring and generating with CMake (apart from the warnings), I tried to compile. It took a couple of attempts but in the end seemed to work. Now I can open the GUI in bin directory and the caduceus scene shows. Also, apart from CGAL (which I was giving me troubles while compiling so I removed it) all plugins seem to be properly loaded – the only warning I get is
[WARNING] [PythonEnvironment] No python dir found in /Users/jona/sofa/build
I am also able to load other scenes (e.g. Soft Robots tutorials) though there are a couple of issues here: Firstly, the “orientation vectors”/coordinate system are like a picture in front of the scene and I haven’t figured out how to move them up into the corner/ out of sight and for some of the tutorial scenes that I tested the whole view was very strange.
Secondly, because QT5WebEngine is missing Doc browser has been disabled. There seems so be some kind of problem with my QT as described in previous posts and haven’t found a solution yet. This leaves me without the tutorial description which makes it harder for me as a beginner.Do you have any more suggestions on how to fix the QT problems or other things I could/should try?
A little extra question: How can I load a scene (ideally .py) directly from the terminal or what kind of workflow would you recommend when programming a new scene in general?Any help would be greatly appreciated!
JonnyBlockedHi,
thanks for your advice. Firstly, I realized I am actually trying to build in tree.
Status quo: I switched to Sofa v20.06, cloned STLIB (which I forgot for some reason) und also changed from QT 5.14.2 to 5.15.0. I added STLIB to plugins/CMakeLists.txt and added
set(SOFA_BUILD_METIS ON)
in CMakeLists.txt of src since the flag didn’t show up in CMake GUI.
So now when I configure there are no errors but the following warnings:CMake Deprecation Warning at SofaAdvanced/CMakeLists.txt:15 (message): SofaAdvanced is deprecated. You should now explicitely find (find_package) and link (target_link_library) each module you need within: SofaNonUniformFem
after adding module SofaExporter and
CMake Warning at /Users/jona/sofa/src/SofaKernel/SofaFramework/SofaMacros.cmake:958 (message): sofa_install_libraries: no lib found with TARGETS;Qt5::Network Call Stack (most recent call first): /Users/jona/sofa/plugins/SoftRobots/CMakeLists.txt:42 (sofa_install_libraries)
after adding plugin SoftRobots (same as before, just a warning now though).
Should I just compile from here and check if everything works or do you have any advice on how to get rid of these warnings first? Thanks for your help!
JonnyBlockedHi Hugo,
thanks for getting back at me.
I am using CMake 3.17.0 and getting the following result for thegit log
command:commit 5d9abaa63f0bd2cd620cf9da002248944f1539ce (HEAD -> master, origin/master, origin/HEAD) Merge: a2b129c e646348 Author: Damien Marchal <damien.marchal@univ-lille1.fr> Date: Tue May 5 16:29:08 2020 +0200 Merge pull request #52 from hugtalbot/fix_test_cmake_202005 Fix CMake in test commit e646348e97521e2ace4ca07904344af21837aa0e Author: htalbot <hugo.talbot@sofa-framework.org> Date: Tue May 5 16:25:30 2020 +0200 Fix CMake in test commit a2b129c4bf235a9d5ba9329caf32b0e6863dcd79 Merge: b2b3639 305ad16 Author: Damien Marchal <damien.marchal@univ-lille1.fr> Date: Mon May 4 16:19:23 2020 +0200 Merge pull request #51 from guparan/improve_packaging
Jonny
JonnyBlockedHi,
I have a similar error like the one mentioned above. I try to build Sofa (using 19.12) with the Soft Robots Plugin (from Defrost repo) on MacOS and so far I cloned both repositories and wrote a CMakeLists.txt file to build out of tree. When I try to configure with flag PLUGIN_SOFTROBOTS activated I get the following error from CMake:
CMake Error at /Users/jona/sofa/src/SofaKernel/SofaFramework/CMakeParseLibraryList.cmake:41 (message): Invalid arguments Call Stack (most recent call first): /Users/jona/sofa/src/SofaKernel/SofaFramework/SofaMacros.cmake:840 (PARSE_LIBRARY_LIST) /Users/jona/sofa/plugins/SoftRobots/CMakeLists.txt:42 (sofa_install_libraries)
I didn’t change anything in the CMakeLists.txt file (of the plugin) and don’t really know how to solve this issue, so any help would be appreciated!
Thank you
Jonny -
AuthorPosts