This repository contains utilities for exporting/controlling your robot in Blender
This repository is maintained by:
@Nicogene |
Python script that given the urdf of a robot as input, define the complete rig, in terms of bones, meshes and joint limits.
- Blender > 2.79
- iDynTree python bindings
GAZEBO_MODEL_PATH
properly set.
An easy way to install the dependencies is to use the conda binaries packages. Just install conda and then:
conda create -n blenderenv
conda activate blenderenv
conda install -c conda-forge -c robotology python=<blender_py_ver> yarp idyntree
conda env config vars set PYTHONPATH=/where/the/bindings/are/installed
where <blender_py_ver>
is the python version used inside Blender.
Once installed correctly the dependencies run:
(Windows Powershell)
& "C:\Program Files\Blender Foundation\Blender <blender_version>\blender.exe" --python-use-system-env
(Linux & macOs)
$ blender --python-use-system-env
Go to "Scripting" section, open urdfToBlender
, then run.
It will open a dialog for selecting the urdf to be converted to rig.
After selecting the urdf, the script creates the rig of the robot in term of armature and meshes.
It is also possible to run this script from the command line interface, in this case you have to specify the urdf_fiename
to be converted and optionally the blend_filename
to be saved(by default it saves robot.blend
in the current directory).
(Windows Powershell)
"C:\Program Files\Blender Foundation\Blender <blender_version>\blender.exe" --python-use-system-env -b -P "C:\where\you\have\blender-robotics-utils\script\urdfToBlender.py" -- --urdf_filename "C:\where\you\have\model.urdf" --blend_filename "C:\where\you\want\to\save\myrobot.blend"
(Linux & macOs)
$ blender --python-use-system-env -b -P "/where/you/have/blender-robotics-utils/script/urdfToBlender.py" -- --urdf_filename "/where/you/have/model.urdf" --blend_filename "/where/you/want/to/save/myrobot.blend"
iCub 2.5 | iCub 3 |
---|---|
- Only fixed or revolute joints are handled(see robotology/idyntree#881, it requires iDynTree >= 3.3.0).
- Only
.stl
,.ply
and.dae
format are supported for meshes.
Python script that creates a panel inside the pose mode for connecting parts of the rig to the parts of the real robot(or simulator). For using it follow these instructions:
Create a symbolic link to the folder "blenderRCBPanel" in the local blender config folder.
$ cd ~/.config/blender/<blender_version>/scripts/addons/
$ ln -s /where/you/cloned/blender-robotics-utils/script/blenderRCBPanel blenderRCBPanel
Going to Edit > Preferences > Add-ons > Community you should find the add-on. Select it to be able to use it
If every went fine you should have this panel on the right under the Tools
section.
First of all you have to configure it loading a .json
file representing the structure of your robot like this one:
{
"parts": [
["torso", "Torso"],
["head", "Head"],
["left_arm", "Left arm"],
["right_arm", "Right arm"],
["left_leg", "Left leg"],
["right_leg", "Right leg"]
]
}
It should contain a list of pair where the first value will be the "YARP name" of the part, and the second one will be the name displayed in the list.
Once configured, select the parts you want to control, press connect and then have fun!
This has been tested with iCub 2.5
.
BlenderPanelV2.3-2021-07-28_15.44.46-2021-12-09_15.45.17.mp4
- We are controlling sequentially all the parts connected, this may lead to some discrepancies between the animation and the movements. This can be improved using multithreading and/or using a remapper.