Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PIDMC Class Reference

#include <PIDMC.h>

Inheritance diagram for PIDMC:

Inheritance graph
[legend]
List of all members.

Detailed Description

A nice little MotionCommand for manually manipulating the PID values.

This will, by default, autoprune after its PID values have been set.

Although this doesn't handle directly sending PID commands to the system (the MotionManager::updatePIDs() does that) a little documentation on how Tekkotsu ad OPEN-R handle the PIDs might be nice.

In Tekkotsu, each of P,I, and D are a single floating point number. However, OPEN-R has, in essence, a limited precision floating point number. Each value is broken into a gain (mantissa) and shift (exponent). The shifts appear to be 4 bit values, and are inverted. In other words, x = g/(1<<(0x10-s)), or $ x = \frac{g}{2^{16-s}} $ The gain is probably 6-8 bits of resolution.

On the ERS-2xx series, each joint is completely independent. One caveat is that the shift value 0x0A gives a warning (AGRMSDriver::SetGain() : 0x0A IS USED FOR GAIN SHIFT VALUE.) for some unknown reason.

On the ERS-7, all the joints share the last set shift values, so a global set of shifts must be enforced. This of course, pretty much kills the whole point of having the shifts.

To understand the conversion from Tekkotsu format to the OPEN-R format, see MotionManager::updatePIDs().

A final note: the OPENR::SetJointGain function seems to be a rather costly function call. You should probably try to avoid setting PIDs at too high a frequency.

Definition at line 41 of file PIDMC.h.

Public Member Functions

 PIDMC ()
 Constructor, uses default PIDs and 0 weight for all.
 PIDMC (float powerlevel, float w=1)
 Constructor, sets general power level of all.
 PIDMC (unsigned int low, unsigned int high, float powerlevel, float w=1)
 Constructor, sets general power level of a range of joints, uses default and 0 weight for others, see setRangePowerLevel().
virtual ~PIDMC ()
 Destructor.
void setDefaults (float weight=1)
 Sets the PIDs to the defaults specified in RobotInfo.
void setJointPowerLevel (unsigned int i, float p, float w=1)
 Sets the PIDs to a percentage of default for a given joint, and sets weight.
void setAllPowerLevel (float p, float w=1)
 Sets the PIDs to a percentage of default for all joints.
void setRangePowerLevel (unsigned int low, unsigned int high, float p, float w=1)
 Sets a range of joints' PIDs to a given power level and weight.
void setPID (unsigned int i, const OutputPID &pid)
 Use this to set the PID value and weight.
OutputPIDgetPID (unsigned int i)
 Use this if you want to double check the PID you set.
const OutputPIDgetPID (unsigned int i) const
 Use this if you want to double check the PID you set.
virtual int updateOutputs ()
 Inherited.
virtual int isDirty ()
 Inherited.
virtual int isAlive ()
 Inherited.
virtual void DoStart ()
 marks this as dirty each time it is added

Static Protected Member Functions

static bool isPID (unsigned int i)
 returns true if the output i is a PID joint

Protected Attributes

bool dirty
 true if there are changes that have not been picked up by Motion
OutputPID PIDs [NumPIDJoints]
 the PIDs being requested


Constructor & Destructor Documentation

PIDMC::PIDMC ( unsigned int  low,
unsigned int  high,
float  powerlevel,
float  w = 1 
) [inline]

Constructor, sets general power level of a range of joints, uses default and 0 weight for others, see setRangePowerLevel().

Parameters:
low the first joint to apply powerlevel to
high one-past last joint to apply powerlevel to (i.e. exclusive upper limit)
powerlevel scaling factor for all of the default PID parameters
w MotionManager weight for averaging conflicting commands
Note that if you want to set a single joint i, then low = i, and high = i + 1 because high is an exclusive upper limit

Definition at line 59 of file PIDMC.h.


Member Function Documentation

void PIDMC::setRangePowerLevel ( unsigned int  low,
unsigned int  high,
float  p,
float  w = 1 
) [inline]

Sets a range of joints' PIDs to a given power level and weight.

Parameters:
low the first joint to apply power level p to
high one-past last joint to apply power level p to (i.e. exclusive upper limit)
p scaling factor for all of the default PID parameters
w MotionManager weight for averaging conflicting commands
Note that if you want to set a single joint i with this function (as opposed to setJointPowerLevel() which is designed for that...) then you would need to pass low = i, and high = i + 1 because high is an exclusive upper limit

Definition at line 111 of file PIDMC.h.

Referenced by PIDMC().


The documentation for this class was generated from the following file:

Tekkotsu v3.0
Generated Fri May 11 20:08:31 2007 by Doxygen 1.4.7