This repository contains utilities for exporting/controlling your robot in Blender
This repository is maintained by:
@Nicogene |
- 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.
The addons can be installed by running the following command:
conda activate blenderenv
cd blender-robotics-utils/script
blender -b --python-use-system-env -P ./addons_installer.py
Panel/Python script that given the urdf of a robot as input, define the complete rig, in terms of bones, meshes and joint limits.
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
If the installation went fine you should have this panel on the right under the Tools
section:
After clicking "Select the urdf" it will be opened a file browse such as:
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 addon that consists in a panel inside the pose mode for connecting parts of the rig to the parts of the real robot(or simulator).
If the installation 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
.
It is possible to define the animation changing the values of joints from the joints' list, every time a new value is entered a waypoint in the animation is setted.
Video 🎥:
blenderPanelWithList-2022-03-24_05.58.40.mp4
- The user selects the
Base Frame
and theEnd Effector Frame
according to the joint he/she wants to move. - Input the tranformation to be reached by
End Effector Frame
respect toBase Frame
, in XYZ(meters) and RPY(degrees). - Press
Reach target
button. - The waypoint in the animation is automatically set.
Video 🎥:
BlenderAnimationCartesianV2.mp4
- The user selects the
Base Frame
and theEnd Effector Frame
according to the joint he/she wants to move. - Press the button
Drag & Drop
to activate the feature. Once the button is pressed the user loses control of Blender. - The user moves the mouse pointer in the 3D space of Blender and clicks the
right mouse button
to drop the position. - The user clicks on the
left mouse button
to deactivate the drag and drop feature and to bring back the control to Blender. - The waypoint in the animation is automatically set.
Video 🎥:
drag_drop-2022-05-11_07.27.20.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.
Check our faq section 👈