Robot Simulator of the Robotics Group for Self-Organization of Control: Hexapod Class Reference

# Hexapod Class Reference

`#include <hexapod.h>`

Inherits lpzrobots::OdeRobot, and Inspectable.

Collaboration diagram for Hexapod:
[legend]

List of all members.

## Public Member Functions
| Hexapod (const OdeHandle &odeHandle, const OsgHandle &osgHandle, const HexapodConf &conf, const std::string &name)
| constructor of VierBeiner robot
virtual | ~Hexapod ()
virtual void | update ()
| updates the OSG nodes of the vehicle
virtual void | place (const osg::Matrix &pose)
| sets the pose of the vehicle
virtual int | getSensors (sensor *sensors, int sensornumber)
| returns actual sensorvalues
virtual void | setMotors (const motor *motors, int motornumber)
| sets actual motorcommands
virtual int | getSensorNumber ()
| returns number of sensors
virtual int | getMotorNumber ()
| returns number of motors
virtual bool | collisionCallback (void *data, dGeomID o1, dGeomID o2)
| checks for internal collisions and treats them.
virtual void | doInternalStuff (GlobalData &globalData)
| this function is called in each timestep.
double | round (double, int)
| calculates the total energy consumption of all servos.
virtual double | energyConsumption ()
virtual double | energyConsumpThroughtHeatLoss (const dReal *torques)
virtual double | outwardMechanicalPower (const dReal *torques, const dReal *angularV)
virtual double | costOfTransport (double E, double W, double V, double T)
virtual double | getMassOfRobot ()
virtual double * | getPosition ()
virtual void | notifyOnChange (const paramkey &key)
| Is called when a parameter was changes via setParam().
virtual void | resetMotorPower (double power)
virtual double | getPower ()
virtual Primitive * | getMainPrimitive () const
| the main object of the robot, which is used for position and speed tracking
## Static Public Member Functions
static HexapodConf | getDefaultConf ()
## Public Attributes
HexapodConf | conf
double | legmass
int | countt
bool | created
RaySensorBank | irSensorBank
double | costOfTran
double * | energyOneStep
| energy consumption for one time step
double | E_t
| energy consumption over a period t;
bool | recordGait
double * | heights
double * | angles
## Protected Member Functions
virtual void | create (const osg::Matrix &pose)
| creates vehicle at desired pose
virtual void | destroy ()
| destroys vehicle and space
## Protected Attributes
Primitive * | trunk
Primitive * | irbox
Primitive * | stabaliserTransform
Primitive * | bigboxtransform
Primitive * | headtrans
std::vector< Primitive * > | legs
std::vector< Primitive * > | thorax
std::vector< Pos > | thoraxPos
std::vector< TwoAxisServo * > | hipservos
std::vector< OneAxisServo * > | tebiasprings
std::vector< OneAxisServo * > | tarsussprings
std::vector< OneAxisServo * > | whiskersprings

## Constructor & Destructor Documentation

Hexapod | ( | const OdeHandle & | odeHandle,
|  | const OsgHandle & | osgHandle,
|  | const HexapodConf & | conf,
|  | const std::string & | name |
| ) |  |  |

constructor of VierBeiner robot

Parameters:

  | odeHandle | data structure for accessing ODE
  | osgHandle | ata structure for accessing OSG
  | conf | configuration object

virtual ~Hexapod | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

bool collisionCallback | ( | void * | data,
|  | dGeomID | o1,
|  | dGeomID | o2 |
| ) |  |  | `[virtual]`

checks for internal collisions and treats them.

In case of a treatment return true (collision will be ignored by other objects and the default routine) else false (collision is passed to other objects and (if not treated) to the default routine).

Reimplemented from OdeRobot.

double costOfTransport | ( | double | E,
|  | double | W,
|  | double | V,
|  | double | T |
| ) |  |  | `[virtual]`

void create | ( | const osg::Matrix & | pose | ) | `[protected, virtual]`

creates vehicle at desired pose

creates vehicle at desired position

Parameters:

  | pose | 4x4 pose matrix
  | pos | struct Position with desired position

void destroy | ( |  | ) | `[protected, virtual]`

destroys vehicle and space

void doInternalStuff | ( | GlobalData & | global | ) | `[virtual]`

this function is called in each timestep.

It should perform robot-internal checks, like space-internal collision detection, sensor resets/update etc.

Parameters:

  | globalData | structure that contains global data from the simulation environment

It should perform robot-internal checks, like space-internal collision detection, sensor resets/update etc.

Parameters:

  | global | structure that contains global data from the simulation environment

Reimplemented from OdeRobot.

double energyConsumpThroughtHeatLoss | ( | const dReal * | torques | ) | `[virtual]`

double energyConsumption | ( |  | ) | `[virtual]`

static HexapodConf getDefaultConf | ( |  | ) | `[inline, static]`

< angle range for vertical direction of legs

virtual Primitive* getMainPrimitive | ( |  | ) | const`[inline, virtual]`

the main object of the robot, which is used for position and speed tracking

Reimplemented from OdeRobot.

double getMassOfRobot | ( |  | ) | `[virtual]`

int getMotorNumber | ( |  | ) | `[virtual]`

returns number of motors

Implements AbstractRobot.

virtual double* getPosition | ( |  | ) | `[inline, virtual]`

double getPower | ( |  | ) | `[virtual]`

int getSensorNumber | ( |  | ) | `[virtual]`

returns number of sensors

Implements AbstractRobot.

int getSensors | ( | sensor * | sensors,
|  | int | sensornumber |
| ) |  |  | `[virtual]`

returns actual sensorvalues

Parameters:

  | sensors | sensors scaled to [-1,1]
  | sensornumbHexapod::getDefaultConf()er | length of the sensor array

Returns:
  number of actually written sensors

Implements AbstractRobot.

void notifyOnChange | ( | const paramkey & | key | ) | `[virtual]`

Is called when a parameter was changes via setParam().

Note that it is not called of parameters of childs are changed, then there notifyOnChange() method is called. The key and of the changed parameter (use getParam() to retrieve its actual value). Overload this function when special actions have to be taken on parameter changes.

Reimplemented from Configurable.

double outwardMechanicalPower | ( | const dReal * | torques,
|  | const dReal * | angularV |
| ) |  |  | `[virtual]`

void place | ( | const osg::Matrix & | pose | ) | `[virtual]`

sets the pose of the vehicle

Parameters:

  | pose | desired pose matrix

Implements OdeRobot.

void resetMotorPower | ( | double | power | ) | `[virtual]`

double round | ( | double | num,
|  | int | x |
| ) |  |  |

calculates the total energy consumption of all servos.

void setMotors | ( | const motor * | motors,
|  | int | motornumber |
| ) |  |  | `[virtual]`

sets actual motorcommands

Parameters:

  | motors | motors scaled to [-1,1]
  | motornumber | length of the motor array

Implements AbstractRobot.

void update | ( |  | ) | `[virtual]`

updates the OSG nodes of the vehicle

updates the osg notes

Implements OdeRobot.

## Member Data Documentation

double* angles

Primitive * bigboxtransform`[protected]`

HexapodConf conf

double costOfTran

int countt

bool created

double E_t

energy consumption over a period t;

double* energyOneStep

energy consumption for one time step

Primitive * headtrans`[protected]`

double* heights

std::vector<TwoAxisServo*> hipservos`[protected]`

Primitive * irbox`[protected]`

RaySensorBank irSensorBank

double legmass

std::vector<Primitive*> legs`[protected]`

bool recordGait

Primitive * stabaliserTransform`[protected]`

std::vector<OneAxisServo*> tarsussprings`[protected]`

std::vector<OneAxisServo*> tebiasprings`[protected]`

std::vector<Primitive*> thorax`[protected]`

std::vector<Pos> thoraxPos`[protected]`

Primitive* trunk`[protected]`

std::vector<OneAxisServo*> whiskersprings`[protected]`

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

- hexapod.h
- hexapod.cpp