RobCoGen generates an efficient implementation of common kinematics and dynamics solvers.
Currently, RobCoGen generates C++ and Octave (Matlab) code. The C++ code is very efficient and conforming to real-time execution constraints.
Kinematics
RobCoGen generates an implementation of the transformation matrices which map coordinates between the reference frames placed on neighbour links of the robot. The code computes efficiently the coefficients of the matrix, according to the value of a joint-status vector.
Depending on the target language, the generated code implements various representations of the same transforms:
- homogeneous transforms (4x4 matrices)
- spatial transforms for motion (velocity) vectors (size 6x6)
- spatial transforms for force vectors (size 6x6)
Differences with the original RobCoGen
RobCoGen2 does not support anymore generation of arbitrary matrices and geometric Jacobians. For that, I raccomend looking into a companion tool.Dynamics
RobCoGen generates an optimized, robot-specific instance of the fastest known solvers for the purpose. Specifically:
- the recursive Newton-Euler algorithm for inverse dynamics
- the Articulated-Body algorithm for forward dynamics
- the Composite-Rigid-Body algorithm for the JSIM
All the code for dynamics is based on the work of Roy Featherstone, mainly his book "Rigid Body Dynamics Algorithms" of 2008. The dynamics code use 6D spatial-vectors. All the routines support floating base robots.
The key feature of RobCoGen is to tailor the code for the specific robot model, which allows for some optimizations: removing conditionals, unrolling loops, emitting different code for special cases (e.g. the first children of the robot base).
Parametric robot models
RobCoGen supports parametric robot models, i.e. descriptions where some numerical properties are not fixed. See here.
The parametrization is a powerful feature that enables, for example, the creation of simulations where some robot characteristics can be changed at run time. Optimization strategies can be then applied to support the robot design process.
The parametrization of the model is reflected in the generated code, with details depending on the target language. In general, a simple mechanism is provided to change the value of the parameters at runtime. This mechanism is typically different from the one for variables, to reflect the different nature of the two classes of properties.
Automatic Differentiation (C++)
The C++ code generated by RobCoGen can be used with automatic differentiation tools, to effectively calculate the derivatives of any quantity computed by the generated code, with respect to any variable (e.g. the joint status vector, or design properties such as the mass of a link).
For more information, please refer to the page about the generated C++ code, here.
Configurability
Testing
Testing is available in the form of numerical comparisons between the generated code and another reference implementation, spatial v2.
GNU Octave and spatial v2 are required for testing.
The static Octave functions that perform the comparison for each dynamics solver are available here. The dedicated readme details the testing approach and the general inputs/outputs of the functions.
In addition, RobCoGen generates some helper scripts that attempt to run all tests on the other generated code — see here for example.
See usage for practical examples.