Skip to content

robotology/blender-robotics-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Blender Robotics Utils

This repository contains utilities for exporting/controlling your robot in Blender

ezgif com-gif-maker

Maintainers

This repository is maintained by:

@Nicogene

Addons installation

Dependencies

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.

Installation

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

urdfToBlender

Panel/Python script that given the urdf of a robot as input, define the complete rig, in terms of bones, meshes and joint limits.

Usage with GUI

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:

immagine

After clicking "Select the urdf" it will be opened a file browse such as:

immagine

After selecting the urdf, the script creates the rig of the robot in term of armature and meshes.

Usage without GUI

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"

Examples

iCub 2.5 iCub 3
immagine immagine

Known limitations

  • 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.

blenderRCBPanel 🚧

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.

Joint space

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

Cartesian space

Reach target

  1. The user selects the Base Frame and the End Effector Frame according to the joint he/she wants to move.
  2. Input the tranformation to be reached by End Effector Frame respect to Base Frame, in XYZ(meters) and RPY(degrees).
  3. Press Reach target button.
  4. The waypoint in the animation is automatically set.

Video πŸŽ₯:

BlenderAnimationCartesianV2.mp4

Drag & Drop

  1. The user selects the Base Frame and the End Effector Frame according to the joint he/she wants to move.
  2. Press the button Drag & Drop to activate the feature. Once the button is pressed the user loses control of Blender.
  3. The user moves the mouse pointer in the 3D space of Blender and clicks the right mouse button to drop the position.
  4. The user clicks on the left mouse button to deactivate the drag and drop feature and to bring back the control to Blender.
  5. The waypoint in the animation is automatically set.

Video πŸŽ₯:

drag_drop-2022-05-11_07.27.20.mp4

Known limitations

  • 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.

FAQs πŸ™‹β€β™‚οΈ

Check our faq section πŸ‘ˆ