CodeGenerator
Class for code generation
Objects of the CodeGenerator class automatcally generate robot specific
code, as either M-functions, C-functions, C-MEX functions, or real-time
capable Simulink blocks.
The various methods return symbolic expressions for robot kinematic and
dynamic functions, and optionally support side effects such as:
- M-functions with symbolic robot specific model code
- real-time capable robot specific Simulink blocks
- mat-files with symbolic robot specific model expressions
- C-functions and -headers with symbolic robot specific model code
- robot specific MEX functions based on the generated C-code (C-compiler
must be installed).
Example
% load robot model
mdl_twolink
cg = CodeGenerator(twolink);
cg.geneverything();
% a new class has been automatically generated in the robot directory.
addpath robot
tl = @robot();
% this class is a subclass of SerialLink, and thus polymorphic with
% SerialLink but its methods have been overloaded with robot-specific code,
% for example
T = tl.fkine([0.2 0.3]);
% uses concise symbolic expressions rather than the generalized A-matrix
% approach
% The Simulink block library containing robot-specific blocks can be
% opened by
open robot/robotslib.slx
% and the blocks dragged into your own models.
Methods
gencoriolis | generate Coriolis/centripetal code |
genfdyn | generate forward dynamics code |
genfkine | generate forward kinematics code |
genfriction | generate joint friction code |
gengravload | generate gravity load code |
geninertia | generate inertia matrix code |
geninvdyn | generate inverse dynamics code |
genjacobian | generate Jacobian code |
geneverything | generate code for all of the above |
Properties (read/write)
basepath | basic working directory of the code generator |
robjpath | subdirectory for specialized MATLAB functions |
sympath | subdirectory for symbolic expressions |
slib | filename of the Simulink library |
slibpath | subdirectory for the Simulink library |
verbose | print code generation progress on console (logical) |
saveresult | save symbolic expressions to .mat-files (logical) |
logfile | print modeling progress to specified text file (string) |
genmfun | generate executable M-functions (logical) |
genslblock | generate Embedded MATLAB Function blocks (logical) |
genccode | generate C-functions and -headers (logical) |
genmex | generate MEX-functions as replacement for M-functions (logical) |
compilemex | automatically compile MEX-functions after generation (logical) |
Properties (read only)
rob | SerialLink object to generate code for (1x1). |
Notes
- Requires the MATLAB Symbolic Toolbox.
- For robots with > 3 joints the symbolic expressions are massively
complex, they are slow and you may run out of memory.
- As much as possible the symbolic calculations are down row-wise to
reduce the computation/memory burden.
- Requires a C-compiler if robot specific MEX-functions shall be
generated as m-functions replacement (see MATLAB documentation of MEX
files).
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
SerialLink, Link
CodeGenerator.CodeGenerator
Construct a code generator object
cGen = CodeGenerator(rob, options) is a code generator object for the SerialLink
object rob.
Options
CodeGenerator has many options, and useful sets of options are called
optionSets, and the following are recognized:
'default' | set the options: verbose, saveResult, genMFun, genSLBlock |
'debug' | set the options: verbose, saveResult, genMFun, genSLBlock
and create a logfile named 'robModel.log' in the working directory |
'silent' | set the options: saveResult, genMFun, genSLBlock |
'disk' | set the options: verbose, saveResult |
'workspace' | set the option: verbose; just outputs symbolic expressions to workspace |
'mfun' | set the options: verbose, saveResult, genMFun |
'slblock' | set the options: verbose, saveResult, genSLBlock |
'ccode' | set the options: verbose, saveResult, genCcode |
'mex' | set the options: verbose, saveResult, genMEX |
If no optionSet is provided, then 'default' is used.
The options themselves control the code generation and user information:
'verbose' | write code generation progress to command window |
'saveResult | save results to hard disk (always enabled, when genMFun and genSLBlock are set) |
'logFile', logfile | write code generation progress to specified logfile |
'genMFun' | generate robot specific m-functions |
'genSLBlock' | generate real-time capable robot specific Simulink blocks |
'genccode' | generate robot specific C-functions and -headers |
'mex' | generate robot specific MEX-functions as replacement for the m-functions |
'compilemex' | select whether generated MEX-function should be compiled directly after generation |
Any option may also be modified individually as optional parameter value pairs.
Author
Joern Malzahn
2012 RST, Technische Universitaet Dortmund, Germany.
http://www.rst.e-technik.tu-dortmund.de
CodeGenerator.addpath
Adds generated code to search path
cGen.addpath() adds the generated m-functions and block library to the
MATLAB function search path.
Author
Joern Malzahn
2012 RST, Technische Universitaet Dortmund, Germany.
http://www.rst.e-technik.tu-dortmund.de
See also
addpath
CodeGenerator.genccodecoriolis
Generate C-function for robot inertia matrix
cGen.genccodecoriolis() generates robot-specific C-functions to compute
the robot coriolis matrix.
Notes
- Is called by CodeGenerator.gencoriolis if cGen has active flag genccode or
genmex.
- The .c and .h files are generated in the directory specified by the
ccodepath property of the CodeGenerator object.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gencoriolis, CodeGenerator.genmexcoriolis
CodeGenerator.genccodefdyn
Generate C-code for forward dynamics
cGen.genccodeinvdyn() generates a robot-specific C-code to compute the
forward dynamics.
Notes
- Is called by CodeGenerator.genfdyn if cGen has active flag genccode or
genmex.
- The .c and .h files are generated in the directory specified
by the ccodepath property of the CodeGenerator object.
- The resulting C-function is composed of previously generated C-functions
for the inertia matrix, Coriolis matrix, vector of gravitational load and
joint friction vector. This function recombines these components to
compute the forward dynamics.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfdyn, CodeGenerator.genccodeinvdyn
CodeGenerator.genccodefkine
Generate C-code for the forward kinematics
cGen.genccodefkine() generates a robot-specific C-function to compute
forward kinematics.
Notes
- Is called by CodeGenerator.genfkine if cGen has active flag genccode or
genmex
- The generated .c and .h files are wirtten to the directory specified in
the ccodepath property of the CodeGenerator object.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfkine, CodeGenerator.genmexfkine
CodeGenerator.genccodefriction
Generate C-code for the joint friction
cGen.genccodefriction() generates a robot-specific C-function to compute
vector of friction torques/forces.
Notes
- Is called by CodeGenerator.genfriction if cGen has active flag genccode or
genmex
- The generated .c and .h files are wirtten to the directory specified in
the ccodepath property of the CodeGenerator object.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfriction, CodeGenerator.genmexfriction
CodeGenerator.genccodegravload
Generate C-code for the vector of
gravitational load torques/forces
cGen.genccodegravload() generates a robot-specific C-function to compute
vector of gravitational load torques/forces.
Notes
- Is called by CodeGenerator.gengravload if cGen has active flag genccode or
genmex
- The generated .c and .h files are wirtten to the directory specified in
the ccodepath property of the CodeGenerator object.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gengravload, CodeGenerator.genmexgravload
CodeGenerator.genccodeinertia
Generate C-function for robot inertia matrix
cGen.genccodeinertia() generates robot-specific C-functions to compute
the robot inertia matrix.
Notes
- Is called by CodeGenerator.geninertia if cGen has active flag genccode or
genmex.
- The generated .c and .h files are generated in the directory specified
by the ccodepath property of the CodeGenerator object.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninertia, CodeGenerator.genmexinertia
CodeGenerator.genccodeinvdyn
Generate C-code for inverse dynamics
cGen.genccodeinvdyn() generates a robot-specific C-code to compute the
inverse dynamics.
Notes
- Is called by CodeGenerator.geninvdyn if cGen has active flag genccode or
genmex.
- The .c and .h files are generated in the directory specified
by the ccodepath property of the CodeGenerator object.
- The resulting C-function is composed of previously generated C-functions
for the inertia matrix, coriolis matrix, vector of gravitational load and
joint friction vector. This function recombines these components to
compute the inverse dynamics.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninvdyn, CodeGenerator.genccodefdyn
CodeGenerator.genccodejacobian
Generate C-functions for robot jacobians
cGen.genccodejacobian() generates a robot-specific C-function to compute
the jacobians with respect to the robot base as well as the end effector.
Notes
- Is called by CodeGenerator.genjacobian if cGen has active flag genccode or
genmex.
- The generated .c and .h files are generated in the directory specified
by the ccodepath property of the CodeGenerator object.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genccodefkine, CodeGenerator.genjacobian
CodeGenerator.gencoriolis
Generate code for Coriolis force
coriolis = cGen.gencoriolis() is a symbolic matrix (NxN) of centrifugal and Coriolis
forces/torques.
Notes
- The Coriolis matrix is stored row by row to avoid memory issues.
The generated code recombines these rows to output the full matrix.
- Side effects of execution depends on the cGen flags:
- saveresult: the symbolic expressions are saved to
disk in the directory specified by cGen.sympath
- genmfun: ready to use m-functions are generated and
provided via a subclass of SerialLink stored in cGen.robjpath
- genslblock: a Simulink block is generated and stored in a
robot specific block library cGen.slib in the directory
cGen.basepath
- genccode: generates C-functions and -headers in the directory
specified by the ccodepath property of the CodeGenerator object.
- mex: generates robot specific MEX-functions as replacement for the
m-functions mentioned above. Access is provided by the SerialLink
subclass. The MEX files rely on the C code generated before.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninertia, CodeGenerator.genfkine
CodeGenerator.genfdyn
Generate code for forward dynamics
Iqdd = cGen.genfdyn() is a symbolic vector (1xN) of joint inertial
reaction forces/torques.
Notes
- Side effects of execution depends on the cGen flags:
- saveresult: the symbolic expressions are saved to
disk in the directory specified by cGen.sympath
- genmfun: ready to use m-functions are generated and
provided via a subclass of SerialLink stored in cGen.robjpath
- genslblock: a Simulink block is generated and stored in a
robot specific block library cGen.slib in the directory
cGen.basepath
- genccode: generates C-functions and -headers in the directory
specified by the ccodepath property of the CodeGenerator object.
- mex: generates robot specific MEX-functions as replacement for the
m-functions mentioned above. Access is provided by the SerialLink
subclass. The MEX files rely on the C code generated before.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninertia, CodeGenerator.genfkine
CodeGenerator.genfkine
Generate code for forward kinematics
T = cGen.genfkine() generates a symbolic homogeneous transform matrix (4x4) representing
the pose of the robot end-effector in terms of the symbolic joint coordinates q1, q2, ...
[T, allt] = cGen.genfkine() as above but also generates symbolic homogeneous transform
matrices (4x4xN) for the poses of the individual robot joints.
Notes
- Side effects of execution depends on the cGen flags:
- saveresult: the symbolic expressions are saved to
disk in the directory specified by cGen.sympath
- genmfun: ready to use m-functions are generated and
provided via a subclass of SerialLink stored in cGen.robjpath
- genslblock: a Simulink block is generated and stored in a
robot specific block library cGen.slib in the directory
cGen.basepath
- genccode: generates C-functions and -headers in the directory
specified by the ccodepath property of the CodeGenerator object.
- mex: generates robot specific MEX-functions as replacement for the
m-functions mentioned above. Access is provided by the SerialLink
subclass. The MEX files rely on the C code generated before.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninvdyn, CodeGenerator.genjacobian
CodeGenerator.genfriction
Generate code for joint friction
f = cGen.genfriction() is the symbolic vector (1xN) of joint friction
forces.
Notes
- Side effects of execution depends on the cGen flags:
- saveresult: the symbolic expressions are saved to
disk in the directory specified by cGen.sympath
- genmfun: ready to use m-functions are generated and
provided via a subclass of SerialLink stored in cGen.robjpath
- genslblock: a Simulink block is generated and stored in a
robot specific block library cGen.slib in the directory
cGen.basepath
- genccode: generates C-functions and -headers in the directory
specified by the ccodepath property of the CodeGenerator object.
- mex: generates robot specific MEX-functions as replacement for the
m-functions mentioned above. Access is provided by the SerialLink
subclass. The MEX files rely on the C code generated before.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninvdyn, CodeGenerator.genfdyn
CodeGenerator.gengravload
Generate code for gravitational load
g = cGen.gengravload() is a symbolic vector (1xN) of joint load
forces/torques due to gravity.
Notes
- Side effects of execution depends on the cGen flags:
- saveresult: the symbolic expressions are saved to
disk in the directory specified by cGen.sympath
- genmfun: ready to use m-functions are generated and
provided via a subclass of SerialLink stored in cGen.robjpath
- genslblock: a Simulink block is generated and stored in a
robot specific block library cGen.slib in the directory
cGen.basepath
- genccode: generates C-functions and -headers in the directory
specified by the ccodepath property of the CodeGenerator object.
- mex: generates robot specific MEX-functions as replacement for the
m-functions mentioned above. Access is provided by the SerialLink
subclass. The MEX files rely on the C code generated before.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator, CodeGenerator.geninvdyn, CodeGenerator.genfdyn
CodeGenerator.geninertia
Generate code for inertia matrix
i = cGen.geninertia() is the symbolic robot inertia matrix (NxN).
Notes
- The inertia matrix is stored row by row to avoid memory issues.
The generated code recombines these rows to output the full matrix.
- Side effects of execution depends on the cGen flags:
- saveresult: the symbolic expressions are saved to
disk in the directory specified by cGen.sympath
- genmfun: ready to use m-functions are generated and
provided via a subclass of SerialLink stored in cGen.robjpath
- genslblock: a Simulink block is generated and stored in a
robot specific block library cGen.slib in the directory
cGen.basepath
- genccode: generates C-functions and -headers in the directory
specified by the ccodepath property of the CodeGenerator object.
- mex: generates robot specific MEX-functions as replacement for the
m-functions mentioned above. Access is provided by the SerialLink
subclass. The MEX files rely on the C code generated before.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninvdyn, CodeGenerator.genfdyn
CodeGenerator.geninvdyn
Generate code for inverse dynamics
tau = cGen.geninvdyn() is the symbolic vector (1xN) of joint forces/torques.
Notes
- The inverse dynamics vector is composed of the previously computed inertia matrix
coriolis matrix, vector of gravitational load and joint friction for speedup.
The generated code recombines these components to output the final vector.
- Side effects of execution depends on the cGen flags:
- saveresult: the symbolic expressions are saved to
disk in the directory specified by cGen.sympath
- genmfun: ready to use m-functions are generated and
provided via a subclass of SerialLink stored in cGen.robjpath
- genslblock: a Simulink block is generated and stored in a
robot specific block library cGen.slib in the directory
cGen.basepath
- genccode: generates C-functions and -headers in the directory
specified by the ccodepath property of the CodeGenerator object.
- mex: generates robot specific MEX-functions as replacement for the
m-functions mentioned above. Access is provided by the SerialLink
subclass. The MEX files rely on the C code generated before.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfdyn, CodeGenerator.genfkine
CodeGenerator.genjacobian
Generate code for robot Jacobians
j0 = cGen.genjacobian() is the symbolic expression for the Jacobian
matrix (6xN) expressed in the base coordinate frame.
[j0, Jn] = cGen.genjacobian() as above but also returns the symbolic
expression for the Jacobian matrix (6xN) expressed in the end-effector
frame.
Notes
- Side effects of execution depends on the cGen flags:
- saveresult: the symbolic expressions are saved to
disk in the directory specified by cGen.sympath
- genmfun: ready to use m-functions are generated and
provided via a subclass of SerialLink stored in cGen.robjpath
- genslblock: a Simulink block is generated and stored in a
robot specific block library cGen.slib in the directory
cGen.basepath
- genccode: generates C-functions and -headers in the directory
specified by the ccodepath property of the CodeGenerator object.
- mex: generates robot specific MEX-functions as replacement for the
m-functions mentioned above. Access is provided by the SerialLink
subclass. The MEX files rely on the C code generated before.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfkine
CodeGenerator.genmexcoriolis
Generate C-MEX-function for robot coriolis matrix
cGen.genmexcoriolis() generates robot-specific MEX-functions to compute
robot coriolis matrix.
Notes
- Is called by CodeGenerator.gencoriolis if cGen has active flag genmex
- The MEX file uses the .c and .h files generated in the directory
specified by the ccodepath property of the CodeGenerator object.
- Access to generated functions is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
- You will need a C compiler to use the generated MEX-functions. See the
MATLAB documentation on how to setup the compiler in MATLAB.
Nevertheless the basic C-MEX-code as such may be generated without a
compiler. In this case switch the cGen flag compilemex to false.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gencoriolis
CodeGenerator.genmexfdyn
Generate C-MEX-function for forward dynamics
cGen.genmexfdyn() generates a robot-specific MEX-function to compute
the forward dynamics.
Notes
- Is called by CodeGenerator.genfdyn if cGen has active flag genmex
- The MEX file uses the .c and .h files generated in the directory
specified by the ccodepath property of the CodeGenerator object.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
- You will need a C compiler to use the generated MEX-functions. See the
MATLAB documentation on how to setup the compiler in MATLAB.
Nevertheless the basic C-MEX-code as such may be generated without a
compiler. In this case switch the cGen flag compilemex to false.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfdyn, CodeGenerator.genmexinvdyn
CodeGenerator.genmexfkine
Generate C-MEX-function for forward kinematics
cGen.genmexfkine() generates a robot-specific MEX-function to compute
forward kinematics.
Notes
- Is called by CodeGenerator.genfkine if cGen has active flag genmex
- The MEX file uses the .c and .h files generated in the directory
specified by the ccodepath property of the CodeGenerator object.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
- You will need a C compiler to use the generated MEX-functions. See the
MATLAB documentation on how to setup the compiler in MATLAB.
Nevertheless the basic C-MEX-code as such may be generated without a
compiler. In this case switch the cGen flag compilemex to false.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfkine
CodeGenerator.genmexfriction
Generate C-MEX-function for joint friction
cGen.genmexfriction() generates a robot-specific MEX-function to compute
the vector of joint friction.
Notes
- Is called by CodeGenerator.genfriction if cGen has active flag genmex
- The MEX file uses the .c and .h files generated in the directory
specified by the ccodepath property of the CodeGenerator object.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
- You will need a C compiler to use the generated MEX-functions. See the
MATLAB documentation on how to setup the compiler in MATLAB.
Nevertheless the basic C-MEX-code as such may be generated without a
compiler. In this case switch the cGen flag compilemex to false.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gengravload
CodeGenerator.genmexgravload
Generate C-MEX-function for gravitational load
cGen.genmexgravload() generates a robot-specific MEX-function to compute
gravitation load forces and torques.
Notes
- Is called by CodeGenerator.gengravload if cGen has active flag genmex
- The MEX file uses the .c and .h files generated in the directory
specified by the ccodepath property of the CodeGenerator object.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
- You will need a C compiler to use the generated MEX-functions. See the
MATLAB documentation on how to setup the compiler in MATLAB.
Nevertheless the basic C-MEX-code as such may be generated without a
compiler. In this case switch the cGen flag compilemex to false.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gengravload
CodeGenerator.genmexinertia
Generate C-MEX-function for robot inertia matrix
cGen.genmexinertia() generates robot-specific MEX-functions to compute
robot inertia matrix.
Notes
- Is called by CodeGenerator.geninertia if cGen has active flag genmex
- The MEX file uses the .c and .h files generated in the directory
specified by the ccodepath property of the CodeGenerator object.
- Access to generated functions is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
- You will need a C compiler to use the generated MEX-functions. See the
MATLAB documentation on how to setup the compiler in MATLAB.
Nevertheless the basic C-MEX-code as such may be generated without a
compiler. In this case switch the cGen flag compilemex to false.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninertia
CodeGenerator.genmexinvdyn
Generate C-MEX-function for inverse dynamics
cGen.genmexinvdyn() generates a robot-specific MEX-function to compute
the inverse dynamics.
Notes
- Is called by CodeGenerator.geninvdyn if cGen has active flag genmex.
- The MEX file uses the .c and .h files generated in the directory
specified by the ccodepath property of the CodeGenerator object.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
- You will need a C compiler to use the generated MEX-functions. See the
MATLAB documentation on how to setup the compiler in MATLAB.
Nevertheless the basic C-MEX-code as such may be generated without a
compiler. In this case switch the cGen flag compilemex to false.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gengravload
CodeGenerator.genmexjacobian
Generate C-MEX-function for the robot Jacobians
cGen.genmexjacobian() generates robot-specific MEX-function to compute
the robot Jacobian with respect to the base as well as the end effector
frame.
Notes
- Is called by CodeGenerator.genjacobian if cGen has active flag genmex.
- The MEX file uses the .c and .h files generated in the directory
specified by the ccodepath property of the CodeGenerator object.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
- You will need a C compiler to use the generated MEX-functions. See the
MATLAB documentation on how to setup the compiler in MATLAB.
Nevertheless the basic C-MEX-code as such may be generated without a
compiler. In this case switch the cGen flag compilemex to false.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genjacobian
CodeGenerator.genmfuncoriolis
Generate M-functions for Coriolis matrix
cGen.genmfuncoriolis() generates a robot-specific M-function to compute
the Coriolis matrix.
Notes
- Is called by CodeGenerator.gencoriolis if cGen has active flag genmfun
- The Coriolis matrix is stored row by row to avoid memory issues.
- The generated M-function recombines the individual M-functions for each row.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gencoriolis, CodeGenerator.geninertia
CodeGenerator.genmfunfdyn
Generate M-function for forward dynamics
cGen.genmfunfdyn() generates a robot-specific M-function to compute
the forward dynamics.
Notes
- Is called by CodeGenerator.genfdyn if cGen has active flag genmfun
- The generated M-function is composed of previously generated M-functions
for the inertia matrix, coriolis matrix, vector of gravitational load and
joint friction vector. This function recombines these components to compute
the forward dynamics.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninvdyn
CodeGenerator.genmfunfkine
Generate M-function for forward kinematics
cGen.genmfunfkine() generates a robot-specific M-function to compute
forward kinematics.
Notes
- Is called by CodeGenerator.genfkine if cGen has active flag genmfun
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genjacobian
CodeGenerator.genmfunfriction
Generate M-function for joint friction
cGen.genmfunfriction() generates a robot-specific M-function to compute
joint friction.
Notes
- Is called only if cGen has active flag genmfun
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gengravload
CodeGenerator.genmfungravload
Generate M-functions for gravitational load
cGen.genmfungravload() generates a robot-specific M-function to compute
gravitation load forces and torques.
Notes
- Is called by CodeGenerator.gengravload if cGen has active flag genmfun
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninertia
CodeGenerator.genmfuninertia
Generate M-function for robot inertia matrix
cGen.genmfuninertia() generates a robot-specific M-function to compute
robot inertia matrix.
Notes
- Is called by CodeGenerator.geninertia if cGen has active flag genmfun
- The inertia matrix is stored row by row to avoid memory issues.
- The generated M-function recombines the individual M-functions for each row.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gencoriolis
CodeGenerator.genmfuninvdyn
Generate M-functions for inverse dynamics
cGen.genmfuninvdyn() generates a robot-specific M-function to compute
inverse dynamics.
Notes
- Is called by CodeGenerator.geninvdyn if cGen has active flag genmfun
- The generated M-function is composed of previously generated M-functions
for the inertia matrix, coriolis matrix, vector of gravitational load and
joint friction vector. This function recombines these components to
compute the inverse dynamics.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninvdyn
CodeGenerator.genmfunjacobian
Generate M-functions for robot Jacobian
cGen.genmfunjacobian() generates a robot-specific M-function to compute
robot Jacobian.
Notes
- Is called by CodeGenerator.genjacobian, if cGen has active flag genmfun
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gencoriolis
CodeGenerator.genslblockcoriolis
Generate Simulink block for Coriolis matrix
cGen.genslblockcoriolis() generates a robot-specific Simulink block to compute
Coriolis/centripetal matrix.
Notes
- Is called by CodeGenerator.gencoriolis if cGen has active flag genslblock
- The Coriolis matrix is stored row by row to avoid memory issues.
- The Simulink block recombines the the individual blocks for each row.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.gencoriolis
CodeGenerator.genslblockfdyn
Generate Simulink block for forward dynamics
cGen.genslblockfdyn() generates a robot-specific Simulink block to compute
forward dynamics.
Notes
- Is called by CodeGenerator.genfdyn if cGen has active flag genslblock
- The generated Simulink block is composed of previously generated blocks
for the inertia matrix, coriolis matrix, vector of gravitational load and
joint friction vector. The block recombines these components to compute
the forward dynamics.
- Access to generated function is provided via subclass of SerialLink
whose class definition is stored in cGen.robjpath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfdyn
CodeGenerator.genslblockfkine
Generate Simulink block for forward kinematics
cGen.genslblockfkine() generates a robot-specific Simulink block to compute
forward kinematics.
Notes
- Is called by CodeGenerator.genfkine if cGen has active flag genslblock.
- The Simulink blocks are generated and stored in a robot specific block
library cGen.slib in the directory cGen.basepath.
- Blocks are created for intermediate transforms T0, T1 etc. as well.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfkine
CodeGenerator.genslblockfriction
Generate Simulink block for joint friction
cGen.genslblockfriction() generates a robot-specific Simulink block to compute
the joint friction model.
Notes
- Is called by CodeGenerator.genfriction if cGen has active flag genslblock
- The Simulink blocks are generated and stored in a robot specific block
library cGen.slib in the directory cGen.basepath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genfriction
CodeGenerator.genslblockgravload
Generate Simulink block for gravitational load
cGen.genslblockgravload() generates a robot-specific Simulink block to compute
gravitational load.
Notes
- Is called by CodeGenerator.gengravload if cGen has active flag genslblock
- The Simulink blocks are generated and stored in a robot specific block
library cGen.slib in the directory cGen.basepath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also CodeGenerator.CodeGenerator, CodeGenerator.gengravload
CodeGenerator.genslblockinertia
Generate Simulink block for inertia matrix
cGen.genslbgenslblockinertia() generates a robot-specific Simulink block to compute
robot inertia matrix.
Notes
- Is called by CodeGenerator.geninertia if cGen has active flag genslblock
- The Inertia matrix is stored row by row to avoid memory issues.
- The Simulink block recombines the the individual blocks for each row.
- The Simulink blocks are generated and stored in a robot specific block
library cGen.slib in the directory cGen.basepath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninertia
CodeGenerator.genslblockinvdyn
Generate Simulink block for inverse dynamics
cGen.genslblockinvdyn() generates a robot-specific Simulink block to compute
inverse dynamics.
Notes
- Is called by CodeGenerator.geninvdyn if cGen has active flag genslblock
- The generated Simulink block is composed of previously generated blocks
for the inertia matrix, coriolis matrix, vector of gravitational load and
joint friction vector. The block recombines these components to compute
the forward dynamics.
- The Simulink blocks are generated and stored in a robot specific block
library cGen.slib in the directory cGen.basepath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.geninvdyn
CodeGenerator.genslblockjacobian
Generate Simulink block for robot Jacobians
cGen.genslblockjacobian() generates a robot-specific Simulink block to compute
robot Jacobians (world and tool frame).
Notes
- Is called by CodeGenerator.genjacobian if cGen has active flag genslblock
- The Simulink blocks are generated and stored in a robot specific block
library cGen.slib in the directory cGen.basepath.
Author
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
CodeGenerator.CodeGenerator, CodeGenerator.genjacobian
CodeGenerator.logmsg
Print CodeGenerator logs.
count = CGen.logmsg( FORMAT, A, ...) is the number of characters written to the CGen.logfile.
For the additional arguments see fprintf.
Note
Matlab ships with a function for writing formatted strings into a text
file or to the console (fprintf). The function works with single
target identifiers (file, console, string). This function uses the
same syntax as for the fprintf function to output log messages to
either the Matlab console, a log file or both.
Authors
Joern Malzahn, (joern.malzahn@tu-dortmund.de)
See also
multidfprintf, fprintf, sprintf
CodeGenerator.purge
Cleanup generated files
cGen.purge() deletes all generated files, first displays a question dialog to
make sure the user really wants to delete all generated files.
cGen.purge(1) as above but skips the question dialog.
Author
Joern Malzahn
2012 RST, Technische Universitaet Dortmund, Germany.
http://www.rst.e-technik.tu-dortmund.de
CodeGenerator.rmpath
Removes generated code from search path
cGen.rmpath() removes generated m-functions and block library from the
MATLAB function search path.
Author
Joern Malzahn
2012 RST, Technische Universitaet Dortmund, Germany.
http://www.rst.e-technik.tu-dortmund.de
See also
rmpath
© 1990-2014 Peter Corke.