RobCoGen generates efficient implementation of commonly required kinematics and dynamics algorithms/quantities. It generates code for coordinate transforms (like homogeneous transforms, i.e. forward kinematics), geometric Jacobians, forward dynamics, inverse dynamics and for the computation of the Joint-Space Inertia Matrix (JSIM).
Currently, RobCoGen supports C++ and Octave (Matlab).
Kinematics
RobCoGen generates an implementation of various coordinate transformation matrices, which map coordinates between different reference frames placed on the structure of the robot. That means you get a set of matrices along with a procedure to update the elements of the matrix according to the value of a joint-status vector.
The generated code implements various representations of the same transform. In particular, RobCoGen output includes:
- homogeneous transforms (4x4 matrices)
- spatial transforms for motion (velocity) vectors (size 6x6)
- spatial transforms for force vectors (size 6x6)
In addition, code for geometric Jacobians can be generated.
The transforms/Jacobians that are generated depend on a configuration file that the user has to supply when invoking the generator at the command line (see usage). Some transforms are generated even when this file is not provided, because they are required by the dynamics algorithms.
Dynamics
RobCoGen generates an optimized, robot-specific instance of the fastest known algorithms 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. Indeed, the dynamics code use 6D spatial-vectors. All the routines support floating base robots.
So far, I focused on C++ code, because of the high performance you can achieve with such language. Therefore I have not developed all the Matlab generators for the dynamics algorithms. However one of the code generation output gives you a structure that can be used with Roy Featherstone's Matlab code for dynamics; therefore, in practice, one can still compute the dynamics in Matlab without writing custom code.
Parametric robot models
RobCoGen supports parametric robot models, that is, robot descriptions where some properties are not constrained by a numerical constant. 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 typically reflected in the generated code, with details depending on the target language. In general, the numerical solver uses some kind of mechanism to resolve the value of the parameters at runtime. This mechanism is possibly different from the one for variables, to reflect the different nature of the two classes of properties.
The parametrization is to be considered experimental. For example, at the moment there is no mechanism to specify the default, initial values of parameters.
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).
This feature was introduced in the experimental version 0.4ad.0, and it is now available in version 0.5.1, with some limitations.
In principle, any AD tool based on operator overloading could be used with RobCoGenerated C++ code, as the code uses a custom scalar type. However, in practice, a few additional definitions are in general required for each external tool. In this respect, RobCoGen supports CppAD.
For more information, please refer to the page about the generated C++ code, here.