MultiMotorController Class Reference

MultiMotorController class. More...

Inheritance diagram for MultiMotorController:

Public Member Functions

 MultiMotorController (QVector< PhyDOF * > motors, World *world)
 Constructor.
 
virtual ~MultiMotorController ()
 Destructor.
 
QVector< PhyDOF * > & motors ()
 return motors controlled
 
QVector< wPID * > & positionPIDs ()
 return PID used for controlling motors with position modality
 
bool setEnableLimitsRaw (int axis, bool b)
 Enable/disable the limits for the corresponding joint.
 
virtual void update ()
 apply the torque on the basis of minimum-jerk trajectory
 
QVector< wPID * > & velocityPIDs ()
 return PID used for controlling motors with velocity modality
 
DeviceDriver Interface
virtual bool close ()
 close
 
virtual bool configure (yarp::os::Searchable &config)
 configure
 
virtual bool open (yarp::os::Searchable &config)
 open
 
Common Control Interface
virtual bool getAxes (int *ax)
 see YARP documentation
 
virtual bool getRefAcceleration (int j, double *acc)
 see YARP documentation
 
virtual bool getRefAccelerations (double *accs)
 see YARP documentation
 
virtual bool setRefAcceleration (int j, double acc)
 see YARP documentation
 
virtual bool setRefAccelerations (const double *accs)
 see YARP documentation
 
virtual bool stop (int j)
 see YARP documentation
 
virtual bool stop ()
 see YARP documentation
 
IPositionControl Interface
virtual bool checkMotionDone (int j, bool *flag)
 see YARP documentation
 
virtual bool checkMotionDone (bool *flag)
 see YARP documentation
 
virtual bool getRefSpeed (int j, double *ref)
 see YARP documentation
 
virtual bool getRefSpeeds (double *spds)
 see YARP documentation
 
virtual bool positionMove (int j, double ref)
 see YARP documentation
 
virtual bool positionMove (const double *refs)
 see YARP documentation
 
virtual bool relativeMove (int j, double delta)
 see YARP documentation
 
virtual bool relativeMove (const double *deltas)
 see YARP documentation
 
virtual bool setPositionMode ()
 see YARP documentation
 
virtual bool setRefSpeed (int j, double sp)
 see YARP documentation
 
virtual bool setRefSpeeds (const double *spds)
 see YARP documentation
 
IVelocityControl Interface
virtual bool setVelocityMode ()
 see YARP documentation
 
virtual bool velocityMove (int j, double sp)
 see YARP documentation
 
virtual bool velocityMove (const double *sp)
 see YARP documentation
 
IControlMode Interface
virtual bool getControlMode (int j, int *mode)
 see YARP documentation
 
virtual bool getControlModes (int *modes)
 see YARP documentation
 
virtual bool setImpedancePositionMode (int)
 TOMASSINO: I don't know what to put here, leaving empty.
 
virtual bool setImpedanceVelocityMode (int)
 TOMASSINO: I don't know what to put here, leaving empty.
 
virtual bool setOpenLoopMode (int j)
 see YARP documentation
 
virtual bool setPositionMode (int j)
 see YARP documentation
 
virtual bool setTorqueMode (int j)
 see YARP documentation
 
virtual bool setVelocityMode (int j)
 see YARP documentation
 
IEncoders Interface
virtual bool getEncoder (int j, double *v)
 see YARP documentation
 
virtual bool getEncoders (double *encs)
 see YARP documentation
 
virtual bool getEncoderAcceleration (int j, double *spds)
 see YARP documentation
 
virtual bool getEncoderAccelerations (double *accs)
 see YARP documentation
 
virtual bool getEncoderSpeed (int j, double *sp)
 see YARP documentation
 
virtual bool getEncoderSpeeds (double *spds)
 see YARP documentation
 
virtual bool resetEncoder (int j)
 see YARP documentation
 
virtual bool resetEncoders ()
 see YARP documentation
 
virtual bool setEncoder (int j, double val)
 see YARP documentation
 
virtual bool setEncoders (const double *vals)
 see YARP documentation
 
IControlLimits Interface
virtual bool getLimits (int axis, double *min, double *max)
 see YARP documentation
 
virtual bool setLimits (int axis, double min, double max)
 see YARP documentation
 
IControlLimitsRaw Interface
virtual bool getLimitsRaw (int axis, double *min, double *max)
 see YARP documentation
 
virtual bool setLimitsRaw (int axis, double min, double max)
 see YARP documentation
 
- Public Member Functions inherited from MotorController
 MotorController (World *world)
 constructor
 
virtual ~MotorController ()
 Destructor.
 
bool isEnabled ()
 return true is if enable (hence if it is on)
 
void setEnabled (bool b)
 Enable/Disable this motorcontroller.
 
Worldworld ()
 return the world
 
- Public Member Functions inherited from Ownable
 Ownable ()
 Constructor.
 
virtual ~Ownable ()
 Destructor.
 
const QList< Owned > & owned () const
 Returns the list of objects owned by this one.
 
Ownableowner () const
 Returns the owner of this object.
 
void setOwner (Ownable *owner, bool destroy=true)
 Sets the owner of this object.
 

Additional Inherited Members

- Public Types inherited from Ownable
typedef QList< OwnedOwnedList
 The type for the list of owned objects.
 

Detailed Description

MultiMotorController class.

Motivation
This class allow to control the position or the velocity of a vector of PhyDOF
Description
It work in two modality: position and velocity.
Position Modality
It compute a minimum-jerk trajectory accordlying to the same equation implemented into iCub DSP chips.

\[ \Theta(t,T) = \left( 10\left(\frac{t}{T}\right)^3 - 15\left(\frac{t}{T}\right)^4 + 6\left(\frac{t}{T}\right)^5 \right) \left( x_f - x_0 \right) + x_0 + dx_0\left( \frac{t}{T} -6\left(\frac{t}{T}\right)^3 +8\left(\frac{t}{T}\right)^4 -3\left(\frac{t}{T}\right)^5 \right) \]

where $x_0$ if start position, $x_f$ final (desired) position, $T$ is the period on which movement will last and $dx_0$ is the velocity of joint when movement starts. The joints will be actuated in order to stay at position $\Theta(t,T)$ during the movement.
$T$ is calculated on the basis of reference speed (setRefSpeed) accordlying to following equation:

\[ T = \frac{\left| x_f - x_0 \right|}{ RefSpeed } \]

The time counter $t$ will resetted to zero at each positionMove calls and it span from 0 to $T$ incremented at each step of World::timeStep(), hence the total movement will require $\frac{T}{timeStep}$ steps to get completed.
The reference acceleration (RefAcceleration) will be used to know how much acceleration to set on motor during the movement.
Velocity Modality
It accelerate/decelerate the joint velocity in order to reach the desired setted by velocityMove without execeeding the reference acceleration setted (RelAcceleration)
Warnings

Definition at line 179 of file motorcontrollers.h.

Constructor & Destructor Documentation

MultiMotorController ( QVector< PhyDOF * >  motors,
World world 
)

Constructor.

Parameters
dofsvector of TorqueMotors actuated by this controller

Definition at line 156 of file motorcontrollers.cpp.

References farsa::toRad().

~MultiMotorController ( )
virtual

Destructor.

Definition at line 215 of file motorcontrollers.cpp.

Member Function Documentation

bool checkMotionDone ( int  j,
bool *  flag 
)
virtual

see YARP documentation

Definition at line 406 of file motorcontrollers.cpp.

bool checkMotionDone ( bool *  flag)
virtual

see YARP documentation

Definition at line 416 of file motorcontrollers.cpp.

bool close ( )
virtual

close

Definition at line 274 of file motorcontrollers.cpp.

bool configure ( yarp::os::Searchable &  config)
virtual

configure

Definition at line 278 of file motorcontrollers.cpp.

bool getAxes ( int *  ax)
virtual

see YARP documentation

Definition at line 284 of file motorcontrollers.cpp.

bool getControlMode ( int  j,
int *  mode 
)
virtual

see YARP documentation

Definition at line 599 of file motorcontrollers.cpp.

bool getControlModes ( int *  modes)
virtual

see YARP documentation

Definition at line 607 of file motorcontrollers.cpp.

bool getEncoder ( int  j,
double *  v 
)
virtual

see YARP documentation

Definition at line 634 of file motorcontrollers.cpp.

References farsa::toDegree().

bool getEncoderAcceleration ( int  j,
double *  spds 
)
virtual

see YARP documentation

Definition at line 680 of file motorcontrollers.cpp.

bool getEncoderAccelerations ( double *  accs)
virtual

see YARP documentation

Definition at line 684 of file motorcontrollers.cpp.

bool getEncoders ( double *  encs)
virtual

see YARP documentation

Definition at line 646 of file motorcontrollers.cpp.

References farsa::toDegree().

bool getEncoderSpeed ( int  j,
double *  sp 
)
virtual

see YARP documentation

Definition at line 657 of file motorcontrollers.cpp.

References farsa::toDegree().

bool getEncoderSpeeds ( double *  spds)
virtual

see YARP documentation

Definition at line 669 of file motorcontrollers.cpp.

References farsa::toDegree().

bool getLimits ( int  axis,
double *  min,
double *  max 
)
virtual

see YARP documentation

Definition at line 702 of file motorcontrollers.cpp.

References farsa::toDegree().

bool getLimitsRaw ( int  axis,
double *  min,
double *  max 
)
virtual

see YARP documentation

Definition at line 728 of file motorcontrollers.cpp.

References farsa::toDegree().

bool getRefAcceleration ( int  j,
double *  acc 
)
virtual

see YARP documentation

Definition at line 499 of file motorcontrollers.cpp.

References farsa::toDegree().

bool getRefAccelerations ( double *  accs)
virtual

see YARP documentation

Definition at line 511 of file motorcontrollers.cpp.

References farsa::toDegree().

bool getRefSpeed ( int  j,
double *  ref 
)
virtual

see YARP documentation

Definition at line 476 of file motorcontrollers.cpp.

References farsa::toDegree().

bool getRefSpeeds ( double *  spds)
virtual

see YARP documentation

Definition at line 488 of file motorcontrollers.cpp.

References farsa::toDegree().

QVector<PhyDOF*>& motors ( )
inline

return motors controlled

Definition at line 192 of file motorcontrollers.h.

bool open ( yarp::os::Searchable &  config)
virtual

open

Definition at line 270 of file motorcontrollers.cpp.

bool positionMove ( int  j,
double  ref 
)
virtual

see YARP documentation

Definition at line 294 of file motorcontrollers.cpp.

References farsa::ramp(), and farsa::toRad().

bool positionMove ( const double *  refs)
virtual

see YARP documentation

Definition at line 323 of file motorcontrollers.cpp.

References farsa::ramp(), and farsa::toRad().

QVector<wPID*>& positionPIDs ( )
inline

return PID used for controlling motors with position modality

Definition at line 196 of file motorcontrollers.h.

bool relativeMove ( int  j,
double  delta 
)
virtual

see YARP documentation

Definition at line 351 of file motorcontrollers.cpp.

References farsa::ramp(), and farsa::toRad().

bool relativeMove ( const double *  deltas)
virtual

see YARP documentation

Definition at line 379 of file motorcontrollers.cpp.

References farsa::ramp(), and farsa::toRad().

bool resetEncoder ( int  j)
virtual

see YARP documentation

Definition at line 618 of file motorcontrollers.cpp.

bool resetEncoders ( )
virtual

see YARP documentation

Definition at line 622 of file motorcontrollers.cpp.

bool setEnableLimitsRaw ( int  axis,
bool  b 
)

Enable/disable the limits for the corresponding joint.

Definition at line 744 of file motorcontrollers.cpp.

Referenced by PhyiCub::PhyiCub().

bool setEncoder ( int  j,
double  val 
)
virtual

see YARP documentation

Definition at line 626 of file motorcontrollers.cpp.

bool setEncoders ( const double *  vals)
virtual

see YARP documentation

Definition at line 630 of file motorcontrollers.cpp.

virtual bool setImpedancePositionMode ( int  )
inlinevirtual

TOMASSINO: I don't know what to put here, leaving empty.

Definition at line 277 of file motorcontrollers.h.

virtual bool setImpedanceVelocityMode ( int  )
inlinevirtual

TOMASSINO: I don't know what to put here, leaving empty.

Definition at line 279 of file motorcontrollers.h.

bool setLimits ( int  axis,
double  min,
double  max 
)
virtual

see YARP documentation

Definition at line 688 of file motorcontrollers.cpp.

References farsa::max(), farsa::min(), and farsa::toRad().

Referenced by PhyiCub::PhyiCub().

bool setLimitsRaw ( int  axis,
double  min,
double  max 
)
virtual

see YARP documentation

Definition at line 716 of file motorcontrollers.cpp.

References farsa::toRad().

Referenced by PhyiCub::PhyiCub().

bool setOpenLoopMode ( int  j)
virtual

see YARP documentation

Definition at line 614 of file motorcontrollers.cpp.

bool setPositionMode ( )
virtual

see YARP documentation

Definition at line 289 of file motorcontrollers.cpp.

bool setPositionMode ( int  j)
virtual

see YARP documentation

Definition at line 569 of file motorcontrollers.cpp.

bool setRefAcceleration ( int  j,
double  acc 
)
virtual

see YARP documentation

Definition at line 453 of file motorcontrollers.cpp.

References farsa::toRad().

bool setRefAccelerations ( const double *  accs)
virtual

see YARP documentation

Definition at line 465 of file motorcontrollers.cpp.

References farsa::toRad().

bool setRefSpeed ( int  j,
double  sp 
)
virtual

see YARP documentation

Definition at line 428 of file motorcontrollers.cpp.

References farsa::toRad().

bool setRefSpeeds ( const double *  spds)
virtual

see YARP documentation

Definition at line 441 of file motorcontrollers.cpp.

References farsa::toRad().

bool setTorqueMode ( int  j)
virtual

see YARP documentation

Definition at line 591 of file motorcontrollers.cpp.

bool setVelocityMode ( )
virtual

see YARP documentation

Definition at line 547 of file motorcontrollers.cpp.

bool setVelocityMode ( int  j)
virtual

see YARP documentation

Definition at line 580 of file motorcontrollers.cpp.

bool stop ( int  j)
virtual

see YARP documentation

Definition at line 522 of file motorcontrollers.cpp.

Referenced by PhyiCub::configurePosture().

bool stop ( )
virtual

see YARP documentation

Definition at line 535 of file motorcontrollers.cpp.

void update ( )
virtual

apply the torque on the basis of minimum-jerk trajectory

Implements MotorController.

Definition at line 222 of file motorcontrollers.cpp.

References World::timeStep(), and MotorController::world().

Referenced by PhyiCub::preUpdate().

bool velocityMove ( int  j,
double  sp 
)
virtual

see YARP documentation

Definition at line 552 of file motorcontrollers.cpp.

References farsa::toRad().

bool velocityMove ( const double *  sp)
virtual

see YARP documentation

Definition at line 561 of file motorcontrollers.cpp.

References farsa::toRad().

QVector<wPID*>& velocityPIDs ( )
inline

return PID used for controlling motors with velocity modality

Definition at line 204 of file motorcontrollers.h.


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