Posts Tagged ‘XML’

Robot modelling formats for simulation

Several XML-based formats have surfaced over the years that can be used to describe a robot.

Apart from URDF (and SRDF) of ROS origin, the Gazebo simulator has been promoting SDF (an evolution of URDF with emphasis on physics simulation), while MJCF apart from being available as URDF extensions, also has its own format with an XML schema for validation and more advanced simulation features (e.g. tendons).


Also related, units of measurement in ROS:

SRDF format that is mentioned at is also related (adds Semantics like kinematic chain definition etc). As explained there it is combined with URDF in describing a robot:

This does not replace URDF, and is not an extension of URDF.

This is a format for representing semantic information about the robot structure.

A URDF file must exist for this robot as well, where the joints and the links that are referenced are defined

SDF (Gazebo) (various SDF models in XML) (Converting from URDF to Gazebo) (tutorial for simple gripper in SDF)

Gazebo seems to be using ODE (Open Dynamics Engine), so these are related too: (see images for Joint types) (ERP & CFM constraint parameters)

MJCF (MuJoCo) (MuJoCo 1.50 was released on April 23, 2017. Student licenses are now free) (MJCF is an advanced format but some of its functionality is also available as URDF extensions) (MuJoCo has constraints like Connect/Weld/Joint/Tendon/Distance) (see paragraph «B. Elements of a MuJoCo model»)

URDF to MJCF conversion is possible (related sample available for MuJoCo):

There is ongoing work at Bullet Physics engine to import MJCF, as mentioned at:

Thus, they have collected various MJCF models (XML):

HowTo: format XML output of DataContractSerializer

based on the other samples posted at StackOverflow on how to format XML created by DataContractSerializer, that use XmlWriter, here’s a version (from ClipFlair source code) that works with streams (and Ionic.Zip library in specific).

It also shows how the code is when you don’t apply formatting (using conditional compilation).  Just comment out the #define (prefix it with //) to make it write unformatted XML.



using System.Xml;

namespace ClipFlair.Windows

  public partial class BaseWindow : FloatingWindow


    private static XmlWriterSettings XML_WRITER_SETTINGS = 
new XmlWriterSettings() { Indent=true, IndentChars=" "}; #endif //... public virtual void SaveOptions(ZipFile zip, string zipFolder = "")
//THIS IS THE CORE SAVING LOGIC { if (SavingOptions != null) SavingOptions(this, null); //notify any listeners View.Busy = true; try { ZipEntry optionsXML =
zip.AddEntry(zipFolder + "/" + View.GetType().FullName + ".options.xml", new WriteDelegate((entryName, stream) => { DataContractSerializer serializer =
new DataContractSerializer(View.GetType());
//assuming current View isn't null #if WRITE_FORMATTED_XML using (XmlWriter writer = XmlWriter.Create(stream, XML_WRITER_SETTINGS)) serializer.WriteObject(writer, View); #else serializer.WriteObject(stream, View); #endif })); } catch (Exception e) { MessageBox.Show("ClipFlair options save failed: " + e.Message); } finally { View.Busy = false; //in any case (error or not) clear the Busy flag } if (SavedOptions != null) SavedOptions(this, null); //notify any listeners } //... } }

Fix: The tag XXX does not exist in XML namespace ‘clr-namespace:YYY’

I just had some big trouble troubleshooting the Visual Studio / XAML compiler error message:

The tag XXX does not exist in XML namespace ‘clr-namespace:YYY’

It turned out this occurred because I had a Silverlight library with Assembly name X and default namespace X (at properties pane), but was using it from a demo project with Assembly name X (again!) and default namespace X.

If I removed the ";assembly=X" part from the XAML it worked fine, that is:


Fixing the demo project to use Assembly name X.Demo and default namespace X.Demo (at its Properties pane), instead of having the same assembly name, now allows me to also use


without problem.

Seems that when you have multiple assemblies with the same name in a project (wonder how the filesystem supports that), all of them are loaded fine and if they have classes with namespace X in them, the namespace gets classes from both assemblies (that’s why the xmlns without assembly=… works). When you specify assembly name in the XAML of a given project, it assumes you mean its own assembly, not any other referenced one with the same name.

BTW, at add references dialog I was using Projects option (to reference the output of other project in solution) and the project I was referencing was named X.Silverlight (can be named anything), I had not added reference the X assembly .dll file directly. Maybe that played its part too in the issue.

There may be other cases too that can cause this error to fire up, see:

%d bloggers like this: