Skip to content

Robot models

Peter Corke edited this page Jun 16, 2020 · 1 revision

MATLAB

The RTB folder models contains files named mdl_ROBOT.m where ROBOT is the name of a particular robot, eg. mdl_puma560.m. The mdl_ prefix is redundant but is a hangover from when there were fewer models and they all lived in the top-level folder.

There are two formats of these files:

  • old style is a script that creates a variable of SerialLink type as well as some other variables which define some joint configurations, typically at least qz which is a vector of zeros of the appropriate length. Limitations of this format:
    • the variable name is predefined in the script, the user cannot choose it
    • the joint configuration variables can clash if multiple robot models are loaded and used simultaneously
  • new style is a function that can:
    • return the SerialLink object to a user-specified variable. The joint configurations are defined within the SerialLink object as dynamic properties, eg. p560.qz.
    • write to the Base workspace if no output arguments are given, for backward compatibility with old-style scripts.

Python

Propose that every robot has its own file ROBOT.py in the folder models. Each file defines a class which subclasses SerialLink and provides the appropriate initialisation.

ROBOT.py:

import roboticstoolbox

class ROBOT(SerialLink):

    def __init(self):
        # create the links and add them

        # set up configurations, eg.
        self.qz = [0, 0, 0, 0, 0, 0]