Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TwoAxisServo Class Reference

general servo motor for 2 axis joints More...

#include <twoaxisservo.h>

Inheritance diagram for TwoAxisServo:
Collaboration diagram for TwoAxisServo:

Public Member Functions

 TwoAxisServo (TwoAxisJoint *joint, double _min1, double _max1, double power1, double _min2, double _max2, double power2, double damp=0.2, double integration=2, double maxVel=10.0, double jointLimit=1.3, bool minmaxCheck=true)
 min and max values are understood as travel bounds. More...
 
virtual ~TwoAxisServo ()
 
virtual void set (double pos1, double pos2)
 sets the set point of the servo. More...
 
virtual double get1 () const
 returns the position of the servo (joint) of 1. More...
 
virtual double get2 () const
 returns the position of the servo (joint) of 2. More...
 
void get (double &p1, double &p2) const
 returns the positions of the joint in ranges [-1, 1] (scaled by min, max) More...
 
virtual void init (Primitive *own, Joint *joint=0) override
 initialises motor with body of robot More...
 
virtual bool sense (const GlobalData &globaldata) override
 performs sense action More...
 
virtual int getSensorNumber () const override
 returns the number of sensors values produced by this sensor More...
 
virtual std::list< sensorgetList () const
 returns a list of sensor values (usually in the range [-1,1] ) This function should be overloaded. More...
 
virtual int get (sensor *sensors, int length) const
 writes the sensor values (usually in the range [-1,1] ) into the given sensor array and returns the number of sensors written. More...
 
virtual int getMotorNumber () const override
 return the dimensionality of this motor More...
 
virtual bool act (GlobalData &globaldata) override
 performs the actions, This is usually called in doInternalStuff() from the robot More...
 
virtual int set (const motor *values, int length) override
 sends the action commands to the motor. More...
 
virtual void setPower (double power1, double power2)
 adjusts the power of the servo More...
 
virtual void setPower1 (double power1)
 returns the power of the servo More...
 
virtual void setPower2 (double power2)
 returns the power of the servo More...
 
virtual double getPower1 ()
 returns the power of the servo More...
 
virtual double getPower2 ()
 returns the power of the servo More...
 
virtual double getDamping1 ()
 returns the damping of the servo (axis 1) More...
 
virtual double getDamping2 ()
 returns the damping of the servo (axis 2) More...
 
virtual TwoAxisJointgetJoint ()
 
virtual void setDamping1 (double damp)
 sets the damping of the servo (axis 1) More...
 
virtual void setDamping2 (double damp)
 sets the damping of the servo (axis 1) More...
 
virtual void setDamping (double _damp)
 sets the damping of the servo (both axis) More...
 
virtual double & offsetCanceling ()
 returns the damping of the servo More...
 
virtual void setMinMax1 (double _min, double _max)
 
virtual void setMinMax2 (double _min, double _max)
 
virtual void setMaxVel (double maxVel)
 adjusts maximal speed of servo More...
 
virtual double getMaxVel ()
 adjusts maximal speed of servo More...
 
- Public Member Functions inherited from Sensor
 Sensor ()
 
virtual ~Sensor ()
 
virtual std::list
< SensorMotorInfo
getSensorInfos () const
 returns a list of sensor infos ( More...
 
virtual void update ()
 to update any visual appearance More...
 
std::list< sensorgetListOfArray () const
 helper function for performance implementation of list<> get() based on array-get More...
 
- Public Member Functions inherited from SensorMotorInfoAble
 SensorMotorInfoAble ()
 
void setBaseName (const std::string &basename)
 
void setBaseInfo (const SensorMotorInfo &baseinfo)
 
SensorMotorInfo getBaseInfo ()
 
void setNamingFunc (const NamingFunction &func)
 
NamingFunction getNamingFunc () const
 
void setNames (const std::vector< std::string > &names)
 set names explicitly (basename is anyway suffixed) More...
 
std::string getName (int index) const
 returns the name of a single item. Typically called from within Sensor and Motor class. More...
 
std::list< SensorMotorInfogetInfos (int number) const
 get all infos. More...
 
- Public Member Functions inherited from Motor
 Motor ()
 
virtual ~Motor ()
 
virtual std::list
< SensorMotorInfo
getMotorInfos () const
 returns a list of motor names ( More...
 

Protected Attributes

TwoAxisJointjoint
 
double min1
 
double max1
 
double min2
 
double max2
 
PID pid1
 
PID pid2
 
double maxVel
 
double jointLimit
 
- Protected Attributes inherited from SensorMotorInfoAble
NamingFunction func
 
SensorMotorInfo baseinfo
 

Additional Inherited Members

- Public Types inherited from Sensor
enum  Dimensions {
  X = 1, Y = 2, Z = 4, XY = X | Y,
  XZ = X | Z, YZ = Y | Z, XYZ = X | Y | Z
}
 defines which dimensions should be sensed. The meaning is sensor specific. More...
 
- Public Types inherited from SensorMotorInfoAble
typedef std::function
< std::string(int)> 
NamingFunction
 function that returns the name given the index More...
 
- Static Public Member Functions inherited from Sensor
static std::list< sensorselectrows (const matrix::Matrix &m, short dimensions)
 selects the rows specified by dimensions (X->0, Y->1, Z->2) More...
 
static int selectrows (sensor *sensors, int length, const matrix::Matrix &m, short dimensions)
 selects the rows specified by dimensions (X->0, Y->1, Z->2) More...
 
static Dimensions parseSensorDimension (char *str)
 
static std::string dimensions2String (short dimensions)
 
- Static Public Member Functions inherited from SensorMotorInfoAble
static std::string defaultNameing (int index)
 the default implementation is for index==0: basename, otherwise basename + (index+1) More...
 

Detailed Description

general servo motor for 2 axis joints

Constructor & Destructor Documentation

TwoAxisServo ( TwoAxisJoint joint,
double  _min1,
double  _max1,
double  power1,
double  _min2,
double  _max2,
double  power2,
double  damp = 0.2,
double  integration = 2,
double  maxVel = 10.0,
double  jointLimit = 1.3,
bool  minmaxCheck = true 
)

min and max values are understood as travel bounds.

Min should be less than 0.

~TwoAxisServo ( )
virtual

Member Function Documentation

virtual bool act ( GlobalData globaldata)
inlineoverridevirtual

performs the actions, This is usually called in doInternalStuff() from the robot

Implements Motor.

void get ( double &  p1,
double &  p2 
) const
inline

returns the positions of the joint in ranges [-1, 1] (scaled by min, max)

virtual int get ( sensor sensors,
int  length 
) const
inlinevirtual

writes the sensor values (usually in the range [-1,1] ) into the given sensor array and returns the number of sensors written.

A default implementation based on get() is provided. Only if performance matters overwrite this function.

Parameters
sensorscall by refernce array which received the values
lengthcapacity of sensors array
Returns
number of sensor values written

Reimplemented from Sensor.

virtual double get1 ( ) const
inlinevirtual

returns the position of the servo (joint) of 1.

axis in ranges [-1, 1] (scaled by min1, max1)

Reimplemented in TwoAxisServoCentered.

virtual double get2 ( ) const
inlinevirtual

returns the position of the servo (joint) of 2.

axis in ranges [-1, 1] (scaled by min2, max2)

Reimplemented in TwoAxisServoCentered.

virtual double getDamping1 ( )
inlinevirtual

returns the damping of the servo (axis 1)

Reimplemented in TwoAxisServoVel.

virtual double getDamping2 ( )
inlinevirtual

returns the damping of the servo (axis 2)

Reimplemented in TwoAxisServoVel.

virtual TwoAxisJoint* getJoint ( )
inlinevirtual
virtual std::list<sensor> getList ( ) const
inlinevirtual

returns a list of sensor values (usually in the range [-1,1] ) This function should be overloaded.

If performance matters, implement get(double*, int) and use getListOfArray to implement this.

Implements Sensor.

virtual double getMaxVel ( )
inlinevirtual

adjusts maximal speed of servo

Reimplemented in TwoAxisServoVel.

virtual int getMotorNumber ( ) const
inlineoverridevirtual

return the dimensionality of this motor

Implements Motor.

virtual double getPower1 ( )
inlinevirtual

returns the power of the servo

Reimplemented in TwoAxisServoVel.

virtual double getPower2 ( )
inlinevirtual

returns the power of the servo

Reimplemented in TwoAxisServoVel.

virtual int getSensorNumber ( ) const
inlineoverridevirtual

returns the number of sensors values produced by this sensor

Implements Sensor.

virtual void init ( Primitive own,
Joint joint = 0 
)
inlineoverridevirtual

initialises motor with body of robot

Implements Motor.

Reimplemented in TwoAxisServoVel.

virtual double& offsetCanceling ( )
inlinevirtual

returns the damping of the servo

Reimplemented in TwoAxisServoVel.

virtual bool sense ( const GlobalData globaldata)
inlineoverridevirtual

performs sense action

Implements Sensor.

void set ( double  pos1,
double  pos2 
)
virtual

sets the set point of the servo.

Position must be between -1 and 1. It is scaled to fit into min, max

Reimplemented in TwoAxisServoVel, and TwoAxisServoCentered.

virtual int set ( const motor values,
int  length 
)
inlineoverridevirtual

sends the action commands to the motor.

It returns the number of used values. (should be equal to getMotorNumber)

Implements Motor.

virtual void setDamping ( double  _damp)
inlinevirtual

sets the damping of the servo (both axis)

virtual void setDamping1 ( double  damp)
inlinevirtual

sets the damping of the servo (axis 1)

Reimplemented in TwoAxisServoVel.

virtual void setDamping2 ( double  damp)
inlinevirtual

sets the damping of the servo (axis 1)

Reimplemented in TwoAxisServoVel.

virtual void setMaxVel ( double  maxVel)
inlinevirtual

adjusts maximal speed of servo

Reimplemented in TwoAxisServoVel.

virtual void setMinMax1 ( double  _min,
double  _max 
)
inlinevirtual
virtual void setMinMax2 ( double  _min,
double  _max 
)
inlinevirtual
virtual void setPower ( double  power1,
double  power2 
)
inlinevirtual

adjusts the power of the servo

Reimplemented in TwoAxisServoVel.

virtual void setPower1 ( double  power1)
inlinevirtual

returns the power of the servo

Reimplemented in TwoAxisServoVel.

virtual void setPower2 ( double  power2)
inlinevirtual

returns the power of the servo

Reimplemented in TwoAxisServoVel.

Member Data Documentation

TwoAxisJoint* joint
protected
double jointLimit
protected
double max1
protected
double max2
protected
double maxVel
protected
double min1
protected
double min2
protected
PID pid1
protected
PID pid2
protected

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