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
AngularMotor Class Referenceabstract

Abstract angular motor class. More...

#include <angularmotor.h>

Inheritance diagram for AngularMotor:
Collaboration diagram for AngularMotor:

Public Member Functions

 AngularMotor (const OdeHandle &odeHandle, Joint *joint)
 creates a AMotor attached to the same bodies as the given joint. More...
 
virtual ~AngularMotor ()
 
virtual int getNumberOfAxes () const =0
 returns the number of Axis of this Motor 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 override
 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 override
 returns the speed (PositionRate) of all axis 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 set (int axisNumber, double velocity)=0
 sets the desired speed of the motor at the given axis. More...
 
virtual double get (int axisNumber) const =0
 returns the speed (PositionRate) at the given axis, or zero if the axis is out of range More...
 
virtual void setPower (double power)=0
 sets the maximal force the motor has More...
 
virtual double getPower ()
 return the maximal force More...
 
virtual JointgetJoint ()
 returns the joint to which this motor is attached More...
 
virtual void setParam (int parameter, double value)
 sets the parameters of the motor More...
 
virtual double getParam (int parameter)
 return the ODE joint parameter (see ODE manual) More...
 
virtual void setVelovityFactor (double factor)
 sets factor for velocity More...
 
virtual double getVelovityFactor (double factor)
 retuns factor for velocity 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

dJointID motor
 
OdeHandle odeHandle
 
double velocityFactor
 
Jointjoint
 
bool initialized
 
- 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

Abstract angular motor class.

This is a wrapper for ODE's AMotor.

Constructor & Destructor Documentation

AngularMotor ( const OdeHandle odeHandle,
Joint joint 
)

creates a AMotor attached to the same bodies as the given joint.

~AngularMotor ( )
virtual

Member Function Documentation

virtual bool act ( GlobalData globaldata)
inlineoverridevirtual

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

Implements Motor.

int get ( sensor sensors,
int  len 
) const
overridevirtual

returns the speed (PositionRate) of all axis

Parameters
velocitiesdouble array to fill in the velocities
lenlength of the given array
Returns
number actually returned velocities

Reimplemented from Sensor.

virtual double get ( int  axisNumber) const
pure virtual

returns the speed (PositionRate) at the given axis, or zero if the axis is out of range

Implemented in AngularMotorNAxis, AngularMotor3AxisEuler, AngularMotor2Axis, and AngularMotor1Axis.

virtual Joint* getJoint ( )
inlinevirtual

returns the joint to which this motor is attached

virtual std::list<sensor> getList ( ) const
inlineoverridevirtual

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 int getMotorNumber ( ) const
inlineoverridevirtual

return the dimensionality of this motor

Implements Motor.

virtual int getNumberOfAxes ( ) const
pure virtual

returns the number of Axis of this Motor

Implemented in AngularMotorNAxis, AngularMotor3AxisEuler, AngularMotor2Axis, and AngularMotor1Axis.

double getParam ( int  parameter)
virtual

return the ODE joint parameter (see ODE manual)

gets the parameters of the motor

double getPower ( )
virtual

return the maximal force

virtual int getSensorNumber ( ) const
inlineoverridevirtual

returns the number of sensors values produced by this sensor

Implements Sensor.

double getVelovityFactor ( double  factor)
virtual

retuns factor for velocity

void init ( Primitive own,
Joint joint = 0 
)
overridevirtual

initialises motor with body of robot

Implements Motor.

Reimplemented in AngularMotorNAxis, AngularMotor3AxisEuler, AngularMotor2Axis, and AngularMotor1Axis.

virtual bool sense ( const GlobalData globaldata)
inlineoverridevirtual

performs sense action

Implements Sensor.

int set ( const motor values,
int  len 
)
overridevirtual

sends the action commands to the motor.

sets the desired speed of all motor.

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

Parameters
velocitiesdouble array with desired velocities
lenlength of the given array
Returns
number actually set velocities

Implements Motor.

virtual void set ( int  axisNumber,
double  velocity 
)
pure virtual

sets the desired speed of the motor at the given axis.

Parameters
velocityDesired motor velocity (this will be an angular or linear velocity).

Implemented in AngularMotorNAxis, AngularMotor3AxisEuler, AngularMotor2Axis, and AngularMotor1Axis.

void setParam ( int  parameter,
double  value 
)
virtual

sets the parameters of the motor

virtual void setPower ( double  power)
pure virtual

sets the maximal force the motor has

Implemented in AngularMotorNAxis, AngularMotor3AxisEuler, AngularMotor2Axis, and AngularMotor1Axis.

void setVelovityFactor ( double  factor)
virtual

sets factor for velocity

Member Data Documentation

bool initialized
protected
Joint* joint
protected
dJointID motor
protected
OdeHandle odeHandle
protected
double velocityFactor
protected

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