Last week I manage to get a 3d model of InMoov taking the position in synch of my InMoov. So let me explain how I did it
I start with the VinMoov model that Gareth post some time ago. Unfortunatly, I did not manage to be able to move it's armature (or did not found how to do). So I try something else
in Blender, I disasemble the VinMoov and saved each robot part that represent my DHLink in IK individually. I modify the part slightly so the origin of the part (rotation point) is at 0,0,0. I then export the part using OGRExml exporter.
Then, in the jMonkeyEngine SDK, I import the files exported from blender. By default, the SDK create the Assets folder inside it's own working folder. But I need to have the asset inside MRL environment. I follow those instruction to set the asset folder in the root directory of myrobotlab
https://jmonkeyengine.github.io/wiki/jme3/advanced/asset_manager.html#a…
Now I can modify the 3d models that will be use in MRL.
So I import the blender model to the MRL Assets folder. Unfortunatly, the material in the blender file did not import well, so I need to fix it
- I convert the .scene file to jme binary (.j3o) by right clicking on the .scene file
- I right click on the .j3o file and select edit in SceneComposer
- in the SceneExplorer Window, I expand the items until I see the Material set on the 3d object and select it
- In the Properties window, I change Material to an existing Material or create a new default one. The defautl material is white so I was fine with it
- I then it SaveAll to save the j3o object
- I repeat those step for all the 3d model I use end then I was done with jmeSDK
Back in Eclipse, I create a class that extends JME SimpleApp (https://github.com/MyRobotLab/myrobotlab/blob/develop/src/org/myrobotla…) just like we will do in jmeSDK. That class will render 3d model and updates their position. Some thing noteworthy to said to have it work in MRL
- We need to tell him where to look for the 3d files since the assets folder are not at the default location. this is done with assetManager.registerLocator("inmoov/jm3/assets", FileLocator.class) command
- SimpleApp need that we don't modify items from another thread. So item setting and updating must be done inside the simpleInitApp() and simpleUpdate(float) methods. Otherwise jmonkey will crash
the class also have
addPart() -> use to set the 3d model in position. each part create a Node, place the 3d model in it, add that node to a parent node with a position relative to the parent node and set an initial rotation.
updatePosition(IKData) will update the rotation of the 3d model. IKData is a class that output by the servo (ServoEvent) that contain the name and position of the servo and is output every time a servo position change.
and now with feet and legs...