Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSCAR::DHData Class Reference
[FileData]

Reads DH parameters from a data file or programmatically create them. More...

#include <DHData.h>

Inheritance diagram for OSCAR::DHData:

Inheritance graph
[legend]
List of all members.

Public Types

enum  DHDataFormat { Craig, Paul }

Public Methods

 DHData (const String &filename, OSCARError &err=DUMMY_ERROR(noError), char commentMarker= '#', const String name=String(""))
 DHData (const Matrix &dhParams, AngleUnits angUnits=Degrees, DHDataFormat dhFormat=Craig, OSCARError &err=DUMMY_ERROR(noError), const String name=String(""))
 DHData (OSCARError &err=DUMMY_ERROR(noError), const String name=String(""))
 DHData (const DHData &rhs)
virtual ~DHData ()
DHData & operator= (const DHData &rhs)
unsigned int GetDOF (void) const
const MatrixGetParameters () const
bool SetParameters (const Matrix &dhParams, AngleUnits angUnits=Degrees, DHDataFormat dhFormat=Craig)
AngleUnits GetAngleUnits () const
void SetAngleUnits (AngleUnits angUnits)
double operator() (unsigned int jointNumber, unsigned int col) const
char GetJointType (unsigned int jointNumber) const
DHDataFormat GetDHDataFormat () const
void SetDHDataFormat (DHDataFormat dhFormat)

Static Public Attributes

const double var
const double VAR

Protected Attributes

Matrixdhparameters
char * joint_type
unsigned int DOF
DHDataFormat dhFormat
AngleUnits angleUnits

Private Methods

void loadparameters (std::ifstream &fileStream, const char commentMarker)
void toLowerCase (char *inputString, char *outputString)

Detailed Description

Author:
Chetan Kapoor
Reads DH parameters from a data file or programmatically create them. This derivation is necessary because in the case of DH parameters we also want to store data corresponding to the joint type. Also, in the data file for the DH parameters a "var" or "VAR" is used to specify whether the joint is prismatic or revolute.


Member Enumeration Documentation

enum OSCAR::DHData::DHDataFormat
 

Enumeration DHDataFormat contains format for DHData.

Enumeration DHDataFormat contains format for DHData.

Enumeration values:
Craig 
Paul 


Constructor & Destructor Documentation

OSCAR::DHData::DHData const String   filename,
OSCARError   err = DUMMY_ERROR(noError),
char    commentMarker = '#',
const String    name = String("")
 

Constructor.

This is the constructor for an object of type DHData. Use this to construct an DHData object by supplying a datafile that contains the DH parameters of the robot. Default for angle units is degrees. Possible errors that may occur include a fileOpenError or dhParamsIllformed exception.

Parameters:
filename This is a file that contains the DH parameters in a matrix format of size DOF by 4 of the robot you are trying to represent. The DH parameters can be represented using the notation based on the "Introduction to Robotics, Mechanics and Controls" book by John Craig OR using the notation as defined by Paul. The default is CRAIG. Each row of the matrix represents a joint. The first column holds the 'Alpha' values, the second 'a', the thirs 'd' and the fourth 'theta'. If a particular joint is revolute, then place the constant 'var' or 'VAR' in the 'theta' column for that particular joint. If a joint is prismatic, then place the constant 'var' or 'VAR' in the 'd' column in for that particular joint. Example DH parameters for a Puma 760 robot are listed below:
-----------------------------------------------------------------------------------------

# This is a DH parameter file for a Puma 760 6 DOF robot. # The variable is specified by typing a "var' or a "VAR" in its # field. i.e. If the joint is revolute then it will be in the fourth # coulumn and if the joint is prismatic it will be in the third column # The notation is based on the "Introduction to Robotics, Mechanics and Controls" # book by John Craig.

# The word below should specify the format of the DH Parameters (Craig or Paul) Craig
# Alpha(i-1) a(i-1) d(i) theta(i)
0 0 0 var # link 0-1
-90 0 0 var # link 1-2
0 650 200 var # link 2-3
-90 0 690 var # link 3-4
90 0 0 var # link 4-5
-90 0 0 var # link 5-6

# Note: The tool point for this robot is at approximately 0, 0, 180 # expressed in the last joints DH frame
-----------------------------------------------------------------------------------------

Parameters:
err A reference to an object of type OSCARError. The default OSCARError object holds values that imply a "No Error" state. This is an error code that is returned.
commentMarker This character defines the beginning of a comment. Once this is encountered, the whole line after this is assumed to be comment information.
name An String that specifies the Name of the object being created.
Exceptions:
dhParamsIllFormed dhParamsIllFormed Call GetError() for more information.
fileOpenError fileOpenError Call GetError() for more information.

OSCAR::DHData::DHData const Matrix   dhParams,
AngleUnits    angUnits = Degrees,
DHDataFormat    dhFormat = Craig,
OSCARError   err = DUMMY_ERROR(noError),
const String    name = String("")
 

Constructor.

This is the constructor for an object of type DHData. Use this to construct an DHData object from an Matrix of size (DOF by 4) that contains the DH parameters of the robot instead of loading the DH parameters from a data file. The units for angles will default to Degrees. Possible errors that may occur include dhParamsIllformed exception.

Parameters:
dhParams This is a matrix of size DOF by 4 that holds the DH parameters of the robot you are trying to represent. The DH parameters can be represented using the notation based on the "Introduction to Robotics, Mechanics and Controls" book by John Craig OR using the notation as defined by Paul. The default is CRAIG. Each row of the matrix represents a joint. The first column holds the 'Alpha' values, the second 'a', the thirs 'd' and the fourth 'theta'. If a particular joint is revolute, then place the constant 'var' or 'VAR' in the 'theta' column for that particular joint. If a joint is prismatic, then place the constant 'var' or 'VAR' in the 'd' column in for that particular joint.
angUnits Degrees or radians used to specify the angle data in the DH params
dhFormat Use this to specify whether the DH parameters are in the notation as specified in the "Introduction to Robotics: Mechanics and Control," John Craig (use DHData::Craig) or as defined by Paul (use DHData::Paul)
err This is an error code that is returned.
name An String that specifies the Name of the object being created.
Exceptions:
dhParamsIllFormed dhParamsIllFormed Call GetError() for more information.

OSCAR::DHData::DHData OSCARError   err = DUMMY_ERROR(noError),
const String    name = String("")
 

Constructor for creating an empty DHData object.

This creates an empty RDDHData object whose DOF is 0 and DH parameters are not defined. User should call SetParameters() to define the parameters. The type of Joint (R or P) will be automatically decoded from the DH parameters specified by the user. Default for angle unit is assumed to be Degrees and dh format is defaulted to Craig

Parameters:
err This is an error code that is returned.
name An String that specifies the Name of the object being created.

OSCAR::DHData::DHData const DHData &    rhs
 

Copy Constructor.

This is the Copy Constructor for an object of type DHData. Use this to construct an DHData object from an existing DHData object.

Parameters:
rhs An DHData object that will be used to initialize this new object.

virtual OSCAR::DHData::~DHData   [virtual]
 

Destructor.

This is the Destructor for an object of type DHData.


Member Function Documentation

AngleUnits OSCAR::DHData::GetAngleUnits   const [inline]
 

DHDataFormat OSCAR::DHData::GetDHDataFormat   const
 

Get the format for the DH parameters.

This method is used to get the format for the DH parameters. The format will be either Craig or Paul.

Returns:
The format for the DH parameters. Could be DHData::Craig or DHData::Paul. If DH parameters are not defined, a NULL character (short(0)) is returned and error is set
See also:
GetDOF()

GetJointType()

GetParameters()

Exceptions:
dhParametersNotDefined dhParametersNotDefined

unsigned int OSCAR::DHData::GetDOF void    const
 

Get the degrees-of-freedom (DOF) represented by the DH parameters.

This method is used to get the degrees-of-freedom (DOF) as represented by the DH parameters.

Returns:
The DOF of the manipulator specified by the DH parameters. If DH Parameters are not defined, a 0 is returned and error is set.
See also:
GetJointType()

GetParameters()

GetDHDataFormat()

Exceptions:
dhParametersNotDefined dhParametersNotDefined

char OSCAR::DHData::GetJointType unsigned int    jointNumber const
 

Get the joint type of a particular joint.

This method is used to get the joint type of a particular joint. The joint type will be either prismatic or revolute.

Parameters:
jointNumber The joint number for which you want the joint type. Joint numbers start at 0. The value of jointNumber should be less than DOF.
Returns:
Character 'P' signifying a prismatic joint and character 'R' specifying a rotary joint.
See also:
GetDOF()

GetDHDataFormat()

GetParameters()

const Matrix* OSCAR::DHData::GetParameters   const
 

Get a matrix representation of the DH parameters.

This method returns a matrix representation of the DH parameters.

Returns:
A pointer to a matrix holding the DH parameters. The size of the matrix will be DOF by 4. The columns of the matrix are Alpha, a, d, and theta respectively and each row represents a joint (joints starting from 0). A value of var or VAR specified in the d or theta column implies a prismatic or rotary joint respectively. If the parameters are not defined, a NULL is returned. In this case, call GetError() for detailed information
See also:
GetJointType()

GetDOF()

GetDHDataFormat()

SetParameters(const Matrix& )

dhParametersNotDefined dhParametersNotDefined

void OSCAR::DHData::loadparameters std::ifstream &    fileStream,
const char    commentMarker
[private]
 

Load dh parameters from a file.

This method is used to load dh parameters from a file.

Parameters:
fileStream An input stream.
commentMarker This character defines the beginning of a comment in the file. Once this is encountered, the whole line after this is assumed to be comment information.

double OSCAR::DHData::operator() unsigned int    jointNumber,
unsigned int    col
const
 

Get a particular element of the DH Parameter matrix.

This method is used to get a particular element of the DH Parameter matrix.

Parameters:
jointNumber The joint number for which you want the DH parameter. Joint numbers start at 0. The value of jointNumber should be less than DOF.
col The column you want. Column 0 = Alpha, Column 1 = a, Column 2 = d, Column 3 = theta. The value of col should be less than 4.
Returns:
A number that specifies a particular DH parameter. These are basically elements of DH matrix. If DH Parameters are not defined, this method will return a 0.0 and set error
See also:
GetJointType()

GetDOF()

GetDHDataFormat()

GetParameters()

Exceptions:
dhParametersNotDefined dhParametersNotDefined

DHData& OSCAR::DHData::operator= const DHData &    rhs
 

Assignment Operator.

This is the Assignment Operator for an object of type DHData.

Parameters:
rhs A DHData object that goes on the right hand side of the = operator
Returns:
A reference to the object on the left hand side of the = operator

void OSCAR::DHData::SetAngleUnits AngleUnits    angUnits [inline]
 

void OSCAR::DHData::SetDHDataFormat DHDataFormat    dhFormat
 

Set the format for the DH parameters. This method is used to set the format for the DH parameters. The format will be either Craig or Paul.

Parameters:
dhFormat Use this to specify whether the DH parameters are in the notation as specified in the "Introduction to Robotics: Mechanics and Control," John Craig (use DHData::Craig) or as defined in "Robot Dynamics Algorithms,' Featherstone (use DHData::Paul)
See also:
SetParameters()

GetDOF()

SetDHDataFormat()

bool OSCAR::DHData::SetParameters const Matrix   dhParams,
AngleUnits    angUnits = Degrees,
DHDataFormat    dhFormat = Craig
 

Change the value of the DH parameters.

Use this to modify the DH parameters stored in this objectby specifying a matrix of size (DOF by 4). Possible errors that may occur include dhParamsIllformed exception. The DOF of the manipulator represented by these parameters is calcuated based on the number of rows of dhParams. The type of the joint is also computed automatically based on specification of either 'd' or 'theta'

Parameters:
dhParams This is a matrix of size DOF by 4 that holds the DH parameters of the robot you are trying to represent. The DH parameters can be represented using the notation based on the "Introduction to Robotics, Mechanics and Controls" book by John Craig OR using the notation as defined by Paul. The default is CRAIG. Each row of the matrix represents a joint. The first column holds the 'Alpha' values, the second 'a', the thirs 'd' and the fourth 'theta'. If a particular joint is revolute, then place the constant 'var' or 'VAR' in the 'theta' column for that particular joint. If a joint is prismatic, then place the constant 'var' or 'VAR' in the 'd' column in for that particular joint.
angUnits Degrees or radians used to specify the angle data in the DH params
dhFormat Use this to specify whether the DH parameters are in the notation as specified in the "Introduction to Robotics: Mechanics and Control," John Craig (use DHData::Craig) or as defined by Paul (use DHData::Paul)
Exceptions:
dhParamsIllFormed dhParamsIllFormed Call GetError() for more information.
See also:
GetDOF()

GetJointType()

SetDHDataFormat()

void OSCAR::DHData::toLowerCase char *    inputString,
char *    outputString
[private]
 

Convert a string from Upper case to Lower Case.

This method is used to convert a string from Upper case to Lower Case.

Parameters:
inputString The string to be converted to lower case.
outputString On return, outputString will point to the converted string.


Member Data Documentation

AngleUnits OSCAR::DHData::angleUnits [protected]
 

DHDataFormat OSCAR::DHData::dhFormat [protected]
 

Matrix* OSCAR::DHData::dhparameters [protected]
 

unsigned int OSCAR::DHData::DOF [protected]
 

char* OSCAR::DHData::joint_type [protected]
 

const double OSCAR::DHData::VAR [static]
 

const double OSCAR::DHData::var [static]
 


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations