https://github.com/ami-iit/blend-my-bot
Import your robot in blender and animate it!
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.8%) to scientific vocabulary
Keywords
Repository
Import your robot in blender and animate it!
Basic Info
Statistics
- Stars: 31
- Watchers: 8
- Forks: 4
- Open Issues: 2
- Releases: 4
Topics
Metadata Files
README.md
Blend My Bot
🐍 Requirements
[!NOTE] You should use a Python version that matches the one supported by the Blender version. For example, Blender 4 supports Python 3.10
[!NOTE] This library does not define the rig of the robot. For this, you can use a library such as
blender-robotics-utils.
💾 Installation
Create a conda environment and install the dependencies:
Use the setup_conda_blender.sh script
You can use the setup_conda_blender.sh script to create a conda environment having the same python version as the one used by the Blender version you are using. This script will also create a symbolic link to the conda environment in the Blender python folder. Run the script from the root of the repository:
```bash bash setupcondablender.sh folder/to/blender/executable conda activate blenderenvversion pip install blend-my-bot
or pip install -e .
```
Manually
If you prefer to do it manually, you can follow these steps:
bash
conda create -n blender_env python=3.10
conda activate blender_env
Create a backup of the python folder in the blender folder:
bash
mv blender_folder/version/python blender_folder/version/python_backup
Run the command below in the blender python folder to create a symbolic link to the conda environment in the blender python folder:
bash
sudo ln -s ~/mambaforge/envs/blender_env blender_folder/version/python
From the root of the repository install the package:
bash
pip install blend-my-bot
If you want to run the scripts from Visual Studio Code, you need to install the vscode python extension and set the python interpreter to the already created conda environment.
You need an additional vscode extension: Blender Development which can be found here.
Once installed, you can run Blender by typing Ctrl+Shift+P and then Blender: Start. It will ask you to select the blender executable: select the one in the folder where you extracted the blender archive (or the installed version if you installed it). Once Blender is running, you can run the script by typing Ctrl+Shift+P and then Blender: Run Script.
You can add objects, lights, and cameras as well as play with render parameters directly in Blender. If you prefer, you can save the Blender project. Everything will be there, including the robot and its motion, so that it does not need to run your script again.
Note that you could also write a script directly in the Scripting tab of Blender and run it from there.
For possible issues when running the script see the Troubleshooting section.
🚀 Usage
```python
import the library
from blendmybot import ModelImporter
import the blender python API
import bpy
ModelImporter needs 3 arguments:
- the name you want to give to your robot
- the path to the urdf file
- the list of the joints you want to move in the animation
urdfpath = "path/to/urdf" robotname = "myrobot" jointslist = ["joint1", "joint2", "joint3", "etc"]
build the blender robot model
model = ModelImporter.buildmodel(robotname, urdfpath, jointslist)
you need to set the frame rate and the number of frames of the animation
length of the animation in seconds
bpy.context.scene.render.fpsbase = timelength
number of frames
bpy.context.scene.render.fps = numberofframes
when the animation starts
bpy.context.scene.frame_start = 0
when the animation ends
bpy.context.scene.frameend = numberof_frames
in Blender the effective frame rate is fps / fps_base
you can now move the base and the joints of the robot
for k in range(numberofframes): # jet the joint trajectory at time k s = jointtrajectory[k] # get the base pose described by a 4x4 homogeneous matrix at time k wHb = basetrajectory[k] # update the robot model model.update(wHb, s) # set the frame bpy.context.scene.frame_set(k) ```
Have a look at the examples folder for more examples.
In the examples/jumping folder you can find a script that generates a jumping animation of the iCub robot. Here the meshes are in a gray, stl format.
Having the meshes in an obj format, instead, will give a nicer and more colorful render! See the Readme of the following repository, for example!
Whole-Body Trajectory Optimization for Robot Multimodal Locomotion
🦿 Troubleshooting
FileNotFoundError when running the script
If you install a new package in the conda environment but it is not working as you expect when you run the script, try to activate it in a terminal before and then open Visual Studio Code from the terminal:
bash
conda activate blender_env
code .
For example, when using resolve_robotics_uri_py an error like the following one appears:
FileNotFoundError: resolve-robotics-uri-py: No file corresponding to uri "package://iCub/robots/iCubGazeboV2_7/model.urdf" found
This is due to the fact that environmental variables are not sourced. Activating the conda environment before opening vscode solves this issue!
Crush when running the script
If Blender crashes when running the script from Visual Studio Code, try to run the script from the Scripting tab of Blender.
🦸♂️ Contributing
blend-my-bot is an open-source project. Contributions are very welcome!
Open an issue with your feature request or if you spot a bug. Then, you can also proceed with a Pull-requests! 🚀
📝 Tips
Some tips to speed up your Cycle render: https://www.youtube.com/watch?v=FNiobzflmpA
Feel free to add your own tips here!
Owner
- Name: Artificial and Mechanical Intelligence
- Login: ami-iit
- Kind: organization
- Location: Italy
- Website: https://ami.iit.it/
- Repositories: 111
- Profile: https://github.com/ami-iit
GitHub Events
Total
- Watch event: 5
- Issue comment event: 2
- Push event: 4
- Pull request review event: 4
Last Year
- Watch event: 5
- Issue comment event: 2
- Push event: 4
- Pull request review event: 4
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 3
- Total pull requests: 6
- Average time to close issues: 10 days
- Average time to close pull requests: 4 days
- Total issue authors: 2
- Total pull request authors: 1
- Average comments per issue: 0.67
- Average comments per pull request: 1.17
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 16 days
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 3.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- GiulioRomualdi (2)
- jcarpent (1)
Pull Request Authors
- Giulero (6)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 50 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
pypi.org: blend-my-bot
A package to import URDF files into Blender
- Documentation: https://blend-my-bot.readthedocs.io/
- License: bsd-3-clause
-
Latest release: 1.1.0
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout master composite
- actions/download-artifact v2 composite
- actions/setup-python v2 composite
- actions/upload-artifact v2 composite
- pypa/gh-action-pypi-publish master composite