PIDMC Class Reference#include <PIDMC.h>
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 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.
|
OutputPID & | getPID (unsigned int i) |
| Use this if you want to double check the PID you set.
|
const OutputPID & | getPID (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 |
( |
|
) |
[inline] |
Constructor, uses default PIDs and 0 weight for all.
Definition at line 44 of file PIDMC.h.
PIDMC::PIDMC |
( |
float |
powerlevel, |
|
|
float |
w = 1 | |
|
) |
| | [inline] |
Constructor, sets general power level of all.
Definition at line 49 of file PIDMC.h.
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.
virtual PIDMC::~PIDMC |
( |
|
) |
[inline, virtual] |
Destructor.
Definition at line 65 of file PIDMC.h.
Member Function Documentation
virtual int PIDMC::updateOutputs |
( |
|
) |
[inline, virtual] |
virtual int PIDMC::isDirty |
( |
|
) |
[inline, virtual] |
virtual int PIDMC::isAlive |
( |
|
) |
[inline, virtual] |
virtual void PIDMC::DoStart |
( |
|
) |
[inline, virtual] |
marks this as dirty each time it is added
Reimplemented from MotionCommand.
Definition at line 76 of file PIDMC.h.
void PIDMC::setDefaults |
( |
float |
weight = 1 |
) |
[inline] |
void PIDMC::setJointPowerLevel |
( |
unsigned int |
i, |
|
|
float |
p, |
|
|
float |
w = 1 | |
|
) |
| | [inline] |
Sets the PIDs to a percentage of default for a given joint, and sets weight.
Definition at line 85 of file PIDMC.h.
void PIDMC::setAllPowerLevel |
( |
float |
p, |
|
|
float |
w = 1 | |
|
) |
| | [inline] |
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().
void PIDMC::setPID |
( |
unsigned int |
i, |
|
|
const OutputPID & |
pid | |
|
) |
| | [inline] |
Use this to set the PID value and weight.
Definition at line 124 of file PIDMC.h.
OutputPID& PIDMC::getPID |
( |
unsigned int |
i |
) |
[inline] |
Use this if you want to double check the PID you set.
Definition at line 131 of file PIDMC.h.
const OutputPID& PIDMC::getPID |
( |
unsigned int |
i |
) |
const [inline] |
Use this if you want to double check the PID you set.
Definition at line 136 of file PIDMC.h.
static bool PIDMC::isPID |
( |
unsigned int |
i |
) |
[inline, static, protected] |
returns true if the output i is a PID joint
Definition at line 142 of file PIDMC.h.
Member Data Documentation
The documentation for this class was generated from the following file:
|