Open-Source, Robotics, ...

31C3 talk: How I Learned to Stop Reinventing and Love the Wheels or having FUN with (home/hackerspace) robotics

30 December 2014

I gave a talk on the first day of the 31st Chaos Communication Congress (31C3): "An introduction to the Robot Operating System (ROS) for the home/hackerspace roboticist (if it physically interacts with the world through code, call it robot)."

The goal was to give a hands-on ROS introduction for everyone, who doesn't have access to expensive equipment, i.e. in a home or hackerspace setting. In my own experience the hard part of working with ROS is to understand how everything comes together and different elements fall into place when they are used in the manner intended by the community. Therefore, rather than to present the components in a rigorous way and systematically going into the details, the idea was to show the big picture through specific subsystems, which can be easily reproduced by everyone. The full description provides some more details about covered topics.

If you are interested you can watch the offical recording of the talk and download the slides.

As is written on the last slide: I'm very interested to hear about (non-academic) projects utilizing ROS for their robotic application. If you did one of these or know about one, please let me know so I can link them here.



A new kind of documentation for ROS beginners

30 October 2014

The amount of functionality available in ROS and the number of ROS packages continues to increase. This is a good thing, of course. However, for someone new to ROS it is hard to figure out, what functionality relevant to their robot is available and where to get further information about it.

One idea to get around this obstacle for beginners is demonstrated below. What is more natural in case of physical entities, such as robots, then to point at one of their parts and ask what it is and how to use it. Technically, this is realized with HTML image-maps and the jQuery ImageMapster plugin. The HTML and javascript is embedded from here.

Update: I created a (hopefully XSS-safe) Plugin for MoinMoin-based Wikis (such as you can find on github.


Foldable Coordinate System: Print, Cut, Fold, Glue and Profit

13 May 2014

Sometimes it is much easier to augment reality with real items instead of virtual augmentation. In this spirit, I tried to find a template for printable - not 3D - coordinate systems, e.g. the classical 3D cartesian coordinate system with RGB axis, but failed to find one.

The result of creating my own can be downloaded as PDF.

Print Foldable 3D cartesian coordinate system

Cut Cut out coordinate system

Fold, Glue Folded and glued coordinate system

Profit Folded and glued coordinate system



19 February 2014

Gazebo and rviz are different programs used for different purposes - simulation and visualization. Yet, if one desires to have a simulation environment that behaves as close to the real system as required and offers the same functionality, gazebo and rviz are often used together. Instead of visualizing the real sensor data in rviz, the data is provided by sensors simulated within gazebo.
Getting to the point of this post: I wanted to have all simulated entities automatically imported into rviz through the TF and Marker plugin.

gazebo2rviz contains the ROS nodes I came up with to achieve the above set goal. The package contains two (Python) nodes:

With this solution no plugin for either gazebo or rviz is required, only already available interfaces are used.

Here is a small usage example:
Start gazebo and add some objects (be aware that at the moment not all gazebo models will work, see below) Gazebo with some mesh-based models

Start rviz, add TF and Marker plugin Rviz with TF and Marker plugin

Launch gazebo2rviz nodes: roslaunch gazebo2rviz gazebo2rviz.launch

From now everything that happens in gazebo, e.g. moving, adding or deleting a model will also be visualized in rviz Rviz showing the current gazebo world

The package is work in progress, i.e. not free of bugs, and there some desired features are still missing, e.g. support for non-mesh <visual> SDF elements. If you find gazebo2rviz usefull and fix bugs or add features that you require, please send be a pull request.

Update: gazebo2rviz now also contains the sdf2marker node that publishes a SDF model to rviz, independently of gazebo.


Open-Source Workflow to Create Geometrically and Visually Accurate Gazebo Models

11 February 2014

A robot simulation can only be as useful and accurate as the utilized models. This post is only concerned with geometric models, future ones will also concern kinematics. There are many options available for each part of a worflow: CAD modeling, mesh export, mesh format conversion and mesh simplification. In what follows I'll describe one workflow completly based on open-source components that works for me, i.e. is fast, extensive and reliable.

The targeted simulator is Gazebo (and the models also work as Markers in rviz). One important aspect of mesh models that is often neglected are per-vertex normals (compared to mere per-face normals). This is very unfortunate if the simulated models should be visually accurate / realistically looking - which is important if you also want to test vision algorithms with simulated sensors. Especially for rounded objects, Phong shading based on vertex normals of the real (CSG) CAD surfaces, will look much more realistic than without.

CAD modeling

We use FreeCAD as CAD program. It is open-source, based on a parametric CAD kernel (OpenCASCADE), supports many import/export formats and has a good Python API. I'm not going into the process of modelling with FreeCAD here. There are many tutorials out there. Yet, in case you do not like the existing ones and you suppose to benefit from another one here, just drop me a note or add a comment below.

To continue, let's assume the object is modelled. We'll use the union of a box and a cylinder (just click "Create box" and "Create cylinder" in the "Part" workbench, select both and click "Make a union" to get the example shape). Cylinder fused with box This means there is a geometrically exact representation of the object we want to use in Gazebo. Unfortunately, most real-time graphics engines do not work with CSG, therefore we have to approximate the actual geometry by a triangle mesh.

Mesh export

We can achieve this using the "Mesh design" workbench's "Create mesh from shape" function (Tessellation settings: "Standard", Surface deviation=1.0): Mesh from shape This works well, but once we load the object into Gazebo, we recognize that the cylinder part does not look very round. Gazebo mesh from shape One solution would be to increase the number of triangles, i.e. decrease the "surface deviation" parameter. Unfortunately, this goes along with a (big) rendering performance degradation. If we only care that the objects looks to be round (in contrast to its geometry actually being rounder), we can use Gazebo's support for vertex normals and Phong shading.

This FreeCAD macro (copy to ~/.FreeCAD/) exports FreeCAD parts together with their vertex normals as Wavefront .obj file. It works by querying the parametric part representation for the actual normal at each vertex position. This is completely different and superior to using a "smooth" feature (e.g. in Blender "Transform" -> "Shading: Smooth") on the mesh after export. Note: The script is not implemented very efficiently at the moment, thus the export may take a while depending on the final mesh size. Macro to export mesh with normals

Mesh format conversion

Gazebo supports .stl and Collada. dae files, whereas the former does not at all support vertex normals. Our exported .obj mesh can be converted to a .dae file preserving the vertex normals using this Python script:
./ -u cm cylinderbox.obj cylinderbox.dae

The resulting mesh is rendered much smoother in Gazebo: Gazebo mesh with normals

Mesh materials

This post is about creating geometrically and visually accurate Gazebo models. We have achieved geometrical accuracy through using a parametric CAD program. Visual accuracy in relation to geometry is also given by exporting the actual vertex normals. What is missing are proper material definitions and textures for each part of the mesh - this will be covered in a future post.

Mesh simplification

Although we avoided excessively detailed mesh geometries by substituting vertex normals for more triangles, the meshes are most likely too detailed as collision bodies. I want to point two paths towards simplified meshes, i.e. having less triangles, to be used as SDF <collision> property. The first is to allow higher deviations through FreeCAD's tessellation settings.

The second path is to simplify our visual mesh. Blender has a "Decimate" modifier. And MeshLab offers several mesh simplification techniques. Below is an example using the "Quadric Edge Collapse Decimation", reducing the mesh faces to 1/2 of the original: MeshLab simplify

Now that we have our models, enjoy simulating.


Welcome post

02 February 2014

On this blog, I intend to write about topics related to robotics research, with special regards to open-source solutions. The goal is to share the solutions that are either already out there, are extensions to existing ones or had to be purpose-built. For the foreseeable future most posts will be related to Linux, ROS, Gazebo, OpenCV, SciPy, FreeCAD and KiCad. Furthermore, if I finally get around to actually add substantial content to, there will be posts about open-source algorithm libraries, too.

The first real post will be about "Open-Source Workflow to Create Geometrically and Visually Accurate Gazebo Models".

Older Posts