Giter VIP home page Giter VIP logo

phobos's Introduction

latest-release DOI license made-with-sphinx-doc API-Docs

Phobos

Phobos is both a CLI tool and add-on for the open-source 3D modeling software Blender v3.3LTS to support your robot model creation and editing.

The Blender add-on enables the creation of WYSIWYG robot models for use in robot frameworks like ROS and ROCK or in real-time simulations such as MARS or Gazebo. Phobos exports formats such as URDF, SDF or SMURF and common mesh formats (Stereolithography (.stl), Wavefront (.obj) or Collada (.dae)).

Phobos was initiated and is currently developed at the Robotics Innovation Center of the German Research Center for Artificial Intelligence (DFKI) in Bremen, together with the Robotics Group of the University of Bremen.

Please contact Henning Wiedemann for any inquiries, or any questions and feedback not suited for the issues page.

Version 2.0.0

With version 2.0.0 we did a refactoring of Phobos and its now possible to use phobos as a normal python package and command line tool (see below).

When running the new Phobos on a model created with an older version of Phobos, make sure to have a backup. For most cases you should be able to update your model by simply exporting it to smurf and then importing it again from that smurf file. Due to the changes between Blender 2 to 3 it might be necessary to check whether your materials already use the Specular BSDF or Principled BSDF shaders, if not you'd have to update this manually.

If you encounter any problems with this new version please do not hesitate to open an issue here.

Questions or Ideas you want to discuss?

Please have a look at our GitHub discussions.

Found a bug or want to request a feature?

Please let us know by opening an issue here.

Documentation

Citing

Phobos has been published in the Journal of Open Source Software. We ask users to cite the use of Phobos, as it allows us to keep the project alive.

When citing, please provide this information:

  • Phobos version you were using (see the wiki for information about versions)
  • If you were using additional Phobos plugins or configurations.
  • The general Phobos paper.

If you are on the hunt for a BiBTeX entry, check out the FAQ section.

Installation

Blender

UPDATING: If you already have phobos installed and want to update. You have to remove the old version of Phobos first and close Blender. Then proceed with the installation steps explained below.

NOTE (WINDOWS): If you are using blender under Windows, make sure you have the latest version of Microsoft Visual C++ Redistributable installed. Otherwise Blender's python won't work properly.

To install Phobos in blender download the phobos.zip of the release or zip the phobos subdirectory (e.g. zip -r phobos.zip phobos) Phobos has several python dependencies, those have to be installed in blender before you can use phobos. There are two ways of installing Phobos:

  • Recommended:
    1. Directly install the phobos.zip in blender: Blender->Edit->Preferences->Addons->Install and activate it.
    2. Restart Blender.
    3. Activate Phobos Add-on again.
  • (Offers inspection of the requirements before installing them) Before installing the phobos.zip you can run the script install_requirements.py with blender's python.
    1. ${BLENDER_EXECUTABLE} -b --python install_requirements.py
    2. Install the phobos.zip in blender: Blender->Edit->Preferences->Addons->Install and activate it.

After installation the phobos main menu can be found on the right hand side of the 3D Viewport. If not already visible, one can find a very small arrow to open the Blender toolbar (purple circle showing it in the image).

Small arrow to open the phobos toolbar widget.

Phobos is currently tested and running with Blender v3.3 LTS.

CLI

Install the requirements by executing install_requirements.py with the python you want to install phobos to:

cd phobos
python3 install_requirements.py

Then just install it using pip:

cd phobos
pip install .

or with autoproj:

  1. Add the package to your buildconf/package_set
  2. Install via amake

Overview

Blender

Model of the SpaceClimber robot in Blender, next to the Phobos toolbar displayed on the left.

Model of the SpaceClimber robot in Blender, next to the Phobos toolbar displayed on the left.

Phobos makes use of Blender's hierarchical object graph and its bone objects. These objects, normally used for animating 3D characters, allow to store 3D coordinate systems and apply constraints to their movements, for instance to restrict the movement of an object to a certain range on a specific axis. This allows to replicate the links and joints defined in a URDF model and together with the hierarchical tree of parent and child objects, the complete, branching kinematic chain of a robot can be represented. By attaching meshes or primitives to the bones, Phobos allows to add visual and collision objects to a model. Additional objects allow storing further information, e.g. centers of mass of each part of a robot, thus refining the physical representation. Sensor objects can be added to correctly place and orient devices such as laser scanners, cameras or contact sensors. Making use of Blender's custom object properties, any necessary information can be added to the model, from inertia tensors to opening angles of cameras.

Decomposition of the different elements from which Phobos models are composed in Blender.

Decomposition of the different elements from which Phobos models are composed in Blender. These elements can be arranged in Blender on different layers, thus avoiding confusion or obstruction of view when editing very complex models.

CLI

You can either use CLI-phobos as a normal python package or use the scripts provided with it.

For the latter do phobos --help to get a list of the currently available scripts. It will also tell you which dependencies are missing for some scripts.

Features

  • WYSIWYG editor for robot models using Blender
  • CLI tools for fast and easy model handling and inspection
  • CI tool to run phobos headless in your CI-pipeline for atomated model processing and maintenance
  • Import and export of URDF, SDF SMURF and other formats
  • Easy definition of robot kinematics (links and joints)
  • Visualisation of different model components, even joint constraints
  • Numerous tools for fast editing:
    • Batch editing of object properties
    • Auto-generation of collision objects
    • Auto-generation of inertia tensors from mass and shape
    • Calculation of merged inertia for complex links
    • Verbose logging
  • Saving and loading of model poses
  • Annotation of objects from motors/sensors to joints/links
  • Save/load different export configurations for the same model
  • Export with defined floating point precision
  • Model integrity checks
  • Tools for maintaining your own model database
  • Library containing Python examples for automatic model adaption
  • All the cool features Blender already provides (rendering, animation, etc.)

License

Phobos is distributed under the 3-Clause BSD License.

phobos's People

Contributors

23pointsnorth avatar alcap23 avatar alexanderfabisch avatar alpenaalalex avatar amudtogal avatar arfon avatar camerondevine avatar fenkraih avatar gavanderhoorn avatar hwiedpro avatar jakobs avatar kartben avatar kavonszadkowski avatar kevinfoley avatar m0rsch1 avatar malter avatar mynameiscosmo avatar planthaber avatar srahms avatar willcbaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phobos's Issues

Namespaces and consistent object naming

Phobos allows to define "type/name" custom properties, thus enabling the export of custom names for objects (instead of using the default names derived from the Blender object names).
It seems this functionality collides with the lists of objects created and exported for node/joint sensors as well as motors and in some cases one ends up with different names referring to objects in different contexts.
The solution is to always use the custom-defined name property when it exists.

export meshes to subfolder

Default behaviour of Phobos should be to export mesh data of a model to a subfolder of that model called meshes. It should be possible for the user to change that folder, for which the GUI should provide a text field (that be default contains 'meshes/'.

Turning velocities for joints and motors

We should unify the units between both operators and we should read the joint values for when adding new motors functionality in case they are present (in case a motor is present, the existing values should be used, of course).

import complex MARS scenes

MARS scenes do not necessarily only contain one entity, can consist of many independent objects (like heightmaps, robots, lights...). These should all be correctly imported and arranged in such a way that an export of a SMURF scene is possible with minimum effort.

Texture export: names and folders

Texture export uses the name set in Object->Texture->Image->First Line ("Image Datablock...") instead of the filename set in "Source" below. When the source image name changes (by selecting a new image with a different name), the "Image Datablock" name above stays the same and references a wrong or deleted image.

Inertial objects and masses

There are a few points about inertial objects and masses that I noticed might not always work how we intended them to work or that we at least have to rethink for consistency reasons:

  • synchronization of visual/collision masses does not seem to work in some cases
  • inertias get exported even though they are not selected - how do we want the default?
  • when masses of objects are updated, should we re-create any inertial objects present?
  • export of masses to SMURF if there is no inertia (and thus no inertial export to URDF) ?

Update example model

There have been quite a few changes in how data is handled since the last release, as well as additional features such as sensors. Thus for 0.6, we need to update our example robot model in order for it to serve as a helpful "cheat sheet" for people.

GUI overhaul

The Phobos GUI elements have become quite numerous and we should seriously consider a new layout that will make Phobos easier to use while keeping in mind which functionality is still planned to be added in future releases, avoiding another layout reset further down the road.

If we manage this in time, an include in the upcoming release 0.6 would be nice, but 0.7 would be fine in my book.

Checks in YAML files

The robot dictionary should be checked with predefined YAML files to verify the robot model before exporting it.

export collada (.dae) meshes

Many tools out there are not compatible with .obj or .stl, but with collada (.dae). Blender allows to export collada files, and we should implement this to be compatible.

Unable to import .scn file directly

Hi @kavonszadkowski,

when trying to load an old .scn file phobos crashes saying:

Unknown model format, aborting import...
Traceback (most recent call last):
  File "/Users/bergatt/Library/Application Support/Blender/2.73/scripts/addons/phobos/importer.py", line 2070, in execute
    importer.parseModel()
UnboundLocalError: local variable 'importer' referenced before assignment

I had to extract the .scn into a folder and was then able to load the .scene
but it shouldn't be too hard to also support the unpacking the .scn before
importing the .scene files.

Best regards,
Constantin

Link origins: use Armature or Bone origin?

Links that are NOT centered in the pivot of the child object (e.g. a door hinge) are still exported to SMURF at the pivot, so that e.g. a door swings around its middle instead of one of its edges.

empty smurf category files

Some categorical data files such as _collision.yml always get exported, even if they are empty. This causes problems with the MARS import and is not very sensible to begin with.

Where should shared textures between single smurfs of a smurfs-scene go?

As smurfs for a scene get exported into subdirectories, the probably shared textures have to be copied into each subfolder. A nice feature would be the possibility to choose a relative path for the textures which should be immune to changing between exporting single robots from a scene and the whole scene. This means that the textures should be found by MARS no matter if the single smurfs are loaded from their subdirectories or from a SMURFS-file from their parent directory.

Operators should use existing custom properties (read and set in invoke function)

This kind of problem probably also happens with other phobos operators:
When selecting a bone that already has joint constraints set and then acivating the "Define joint constraints" operator, the current values of the joint immediately get overwritten by the last values set in the operator. Maybe this is how operators work, however, I think it would be nicer if the current values get read first and can then be adapted only where necessary.

Meshes in "meshes" subfolder.

Phobos exports meshes into a "meshes" subfolder, but does not add that directory as a prefix to <mesh filename="XYZ.abc".

Thus the meshes are only found when they have previously been exported by an older phobos version that did not put the meshes into this subfolder, so in many such cases this error will not be detected.

URDF export: fixed order of elements

Phobos does not adhere to a consistent (e.g. alphabetical) order of URDF elements on export which makes it hard to compare different versions with one another using diff tools such as Meld or Diffuse and which makes committing to git repositories etc. that much harder. We should fix this.

Relative positions of individual robots in scene wrong.

In a scene I have multiple robots which are positioned differently to one another in the MARS simulation compared to the original scene in Blender. Only the position of root links is wrong, the position of child links within a robot is OK.

I am currently looking into the issue. Might be something relating to the root links being a special case as their positions are not stored in joints but in the scene's smurfs-file. (Although everything seems to be correct so far.)

Trouble constructing links, simple video

I am excited by your tool, have been looking for something like this for some time to model robots. While I do have it installed successfully, I have to confess I am having some trouble following the tutorials as it applies to creating simple links. I get URDF exports that are garbage where my links do not reflect a hierarchy. It may be my lack of familiarity with blender or I am not understanding how to use "create links" correctly...

Can I request a very very simple video on youtube demonstrating the creation and treatment of a super-simple URDF structure? Just take two cubes, make them links, and put a joint between them. And export. It would be enormously helpful to see the steps and sequence. A 2 minute video can take the place of many documentation pages.

Sincere thanks...

Export to subfolders

Exporting of meshes etc. to subfolders does not seem to work correctly, yet, especially if multiple models are exported.

orientation of cameras

Camera sensors are attached to a link to determine their position and orientation in the model. Importing a model in MARS, the camera points in X direction, with Z up. We must ensure in Phobos that a camera is always oriented accordingly to its parent link, so that the camera perspective shown in Phobos is the one used in MARS.

Add / edit Sensor(s)

There seems to be a problem with the new implementation of the phobos defs using YAML files. When you run the operator and want to choose the sensor type, a really long repetitive list gets displayed.

revise mesh import/export

The export and import of meshes is still hacky and should be cleaned up (and verified against MARS).

Export of meshes using modifiers.

Exporting meshes with modifiers tends to crash Blender and MARS when using .obj and only MARS when using .bobj. Applying the modifiers before solves the problem, so when exporting (which to my knowledge includes making a copy of the object), applying all the modifiers to the copy should solve the problem.

Another problem is probably active here: The copy is moved to [0,0,0], right? If it uses a boolean operation with another object "A" or is for example deformed by a lattice "A", then the object will get corrupted by moving it away from its current position (as the other object "A" will stay in place). So the object should be

  1. copied in place
  2. get all modifierts applied
  3. be set to [0,0,0] or wherever necessary
  4. then get exported

consistent (SI) units for joints/motors

Joint and Motor maximum speeds currently have no consistent units. We should provide two units for angular speed in Phobos (rad/s and Hz) and one for linear (m/s). As for the output written in URDF, we should use the standard unit defined there for angular speed and use the same in SMURF for the motors. We should double-check which unit is expected by MARS (Should be the one currently written to SMURF).

URDF joint data export allows invalid joints

It's possible to export an invalid joint, namely Phobos is happy to export a joint with out maximum effort, thus creating an invalid URDF. We should check again for all joint parameters and notify the user if there is information missing and therefore the URDF created is not valid.

We should not prevent export though, as it might be the case that some people want to edit effort and other parameters manually or via some scripts later on.

Joint limits translate to strange values in blender bone constraints.

Joint limits translate to strange values in blender bone constraints. A joint limit like for example max 90° is stored in the blender bone constraints as 5156.62d, which makes no sense to me, even when goint from rad to degrees or back.

However, it is correctly exported as max 90° into URDF and motors.yml, however, I can still move a door with min 0° and max 90° by more than 90° (which is probably more a problem on the mars side).

Test and document functionality to reuse meshes

The functionality to share meshes between Blender objects needs final testing and documentation before the next release. We also need to double-check whether it works nicely together with the pre-existing functionality to avoid mesh re-export when importing and exporting URDF.

Masses are always exported as 0.

Masses are seemingly ignored, when setting them (in visual, collision and inertial object) to e.g. 2, the mass of the node stays 0, the density stays always 1.

Sensor data format in Phobos

Silvio raised a very valid point in #5 about the way sensor information is encoded in Phobos. I quote:

Hi, congratulations for the great software.
I read here that you plan to add sensors information to your model editor. Which kind of format you
plan to use for encoding sensors information in the URDF ?

In the urdfdom repository there is an open discussion [1] for new URDF specifications regarding
sensors. Do you think it could be worth to share your proposal for simplify integration and
interoperability of different software using sensor information from URDF?

[1] : ros/urdfdom#28

My short take on this issue is that we are aware of this problem, but have so far have been working with our historic restrictions and the need to get things done without waiting for URDF to be extended.

The long version would be that we mainly use Phobos with the MARS simulation and have thus adapted the description of our sensors to the one previously used in MARS for quick integration of our new description format SMURF. It would absolutely be worthwhile to integrate URDF sensor definitions as soon as they are decided upon, the main problem being that URDF thus far is not meant to be particularly extensible, which is something we definitely strive for and somewhat rely upon. What I do not fancy is a scenario where some sensors are encoded in URDF and other still have to be added in our SMURF extensions if URDF does not provide definitions for them similar to the problem that now already exists with URDF and SRDF both defining collision data.

Either way, we should obviously be keeping tabs on URDF's solution to sensors.

Share meshes does not work.

I had a situation where mesh "doorKnobStart.000" was shared for objects named like "doorKnobEnd.000" and only "doorKnobStart.008.bobj" was exported.
Also this is not easy to undo.
It should be choosable what the shared mesh name will be.

collision groups

Being able to edit collision groups within phobos would be a nice addition.

Logo

At least for version 1.0 it would be nice to have a logo for Phobos, but preferably earlier.
Anyone's got any ingenious ideas?

Instances of same robot get same position in smurfs.

When having multiple copies of a robot in a scene sharing the same robot name, they all get exported but are set to the same position in the ".smurfs"-scene-file although they have different positions in Blender.

Update modeling tutorial

Related to #5, we need to update the modeling tutorial to include all changes since the last release.

We should also seriously get round to getting our hands dirty on videos (#3), though this is something we could add after the release.

"Name Robot" should work on multiple selected robots.

"Name Robot" should work on multiple selected robots. Then it would be possible to for example export a large number of similar objects that are expected to move independently (e.g. spheres roughly representing water particles).

Update URDF data

It often be the case that a URDF is derived from the CAD files of a robot and imported by Phobos to serve as a starting point to create the SMURF. It will also often be the case that this happens early during design of a robot and as the ongoing construction changes, the URDF exported from CAD changes.

At the moment, this means that someone working with Phobos has to import the updated URDF and manually add all the information such as motors and sensors that was previously added. To avoid such hassle, we should implement an "update URDF" operator that updates the Blender model by moving and reorienting links, updating meshes (optional) etc.

One important issue concerning this functionality is that the names of links imported from URDF will most likely be changed when editing the SMURF. Thus we need a name-mapping functionality to still be able to later update existing, renamed links and joints. This could be done for instance by storing the imported URDF names for links and joints in the respective bones as custom properties that don't get exported or by saving them in a YAML dictionary in a text file (the former is probably easier, but also clutters the model). We might need a rename operator for that, as I we probably cannot catch renaming events in the Blender GUI.

This issue is something that will take time and should be thoroughly debugged, thus I'd propose that we push this to the end of Milestone 0.6.5. If we don't get it done in time, it will be included in 0.7 instead.

Exporting of Boolean values

We have to decide how to treat Boolean custom values. The problem is that Blender interprets Booleans in dictionaries as 1 and 0, not as True and False. We could maybe use strings instead (lowercase true and false in YAML I think) if we want to make the exported files more readable. Otherwise we have to double-check whether the import in MARS always works correctly (C++ is of course happy with 1s and 0s, but there may be type issues with our ConfigMaps).

support for parallel kinematics

For beeing able to construct closed loops of joints and bodys (parallel kinematics), objects have to be adjustable to have more than one parent, otherwise a wrong physical representation for this purpose is generated in Phobos

Installation per zip-Folder

If you download the phobos repository via zip file it is named phobos-master. Even after renaming it to phobos, the blender installation routine via zip file extracts the archive to phobos-master.
This causes errors by loading the yaml module, because the script expects the folder to be named phobos. That means installation via zip file is not working in the moment unless you do some stuff manually (renaming the extracted archive after installation).

Is there any known way to alter the name of the donwloaded folder on github or should we rename the path in the script (not recommended)? Or should we dismiss zip installation at all and create a windows installation script too?

Type-specific name spaces for import

URDF allows identical names for objects as long as they are of different types, i.e. you could have a visual object called head and a collision object called head. Phobos does not currently support this, as all object in Blender need to have unique names.

We already have a mechanism allowing objects of different types to be exported using type-specific prefixes that are sliced upon export. We could automatically assign those when importing, either always or only when necessary. Not sure which of the two makes more sense.

consistency between joint and motor constraints

By default, joint constraints and motor constraints should be the same, i.e. when a motor gets attached to a joint with defined constraints, the invoke function of the operator should set the parameters accordingly.

The check robot model function should test for inconsistencies between joint and motor constraints.

Missing features for export of obj and bobj meshes

When using the bobj-export option, all modifiers are applied before exporting. However, then the UV-coordinates get messed up. Even if the modifier is manually applied before. The texture is repeated over e.g. new faces added by a subdivision modifier.

When exporting with the obj-option however, the UVs stay correct, even if e.g. new faces where generated with a subdivision modifier. However, the modifiers are not automatically applied, so that the results of the modifiers are only present in the obj if they have been manually applied before.

The best of both worlds would be that both formats keep the UVs intact and apply all modifiers before export.

Motor export

It seems that (at least in some cases) motors get exported to _motors.yml for joints irrespective of there being an actual motor definition for the joint.

Sensor creation

Adding sensors is not yet as nice as we would like it. For instance, Joint6DOF sensors need to be added to fixed joints connected to the joints where forces and torques should be measured and sensors attached to that fixed link, cameras are simply anchored to a link while NodeVelocity/NodePosition Sensors can have long lists of nodes they are measuring and don't need to be attached to any link in particular. We need think of a way to make that distinction clearer in the GUI and also document everything properly (though this also relates to MARS documentation itself).

Capsules

URDF does not really support capsules. To still be able to create them and use them in MARS, we can emulate a capsule using a cylinder and two spheres in URDF and annotate that it really should be a capsule in SMURF.
Currently, capsules are treated as meshes in Phobos.

This should be implemented properly at the same time as it is implemented in the MARS import.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.