Robotsystem of the Robot Group Leipzig: RobotComponent Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# RobotComponent Class Reference

This is a special class of the component system. More...

`#include <robotcomponent.h>`

Inherits Component.

Inheritance diagram for RobotComponent:

[legend]
Collaboration diagram for RobotComponent:

[legend]
List of all members.

## Public Member Functions
| RobotComponent (const OdeHandle &odeHandle, const OsgHandle &osgHandle, const ComponentConf &conf)
| ~RobotComponent ()
virtual int | getSensors (sensor *sensors, int sensornumber)
| Use this, to get all sensor values of all the joints of all subcomponents, and the sensors of all robots, belonging to all subcompionents.
virtual void | setMotors (const motor *motors, int motornumber)
| Sets the motor values for the joints connecting the component with its subcomponents, an recursivly the joints of all subComponents.
virtual int | getSensorNumber ()
| Returns number of sensors; recursivly adding of the number of sensors all subcomponents and the robots of all Subcomponents.
virtual int | getMotorNumber ()
| returns number of motors; recursivly adding of the number of sensors all subcomponents; at the moment only counts Hinge-, Slider-, Hinge2 and Universal-Joints; The Motor-Numbers of the robots of the Components is not counted.
virtual void | update ()
| update the OSG notes here
virtual void | place (const Pos &pos)
| sets the vehicle to position pos
virtual void | place (const osg::Matrix &pose)
| sets the pose of the vehicle
virtual bool | collisionCallback (void *data, dGeomID o1, dGeomID o2)
virtual void | doInternalStuff (GlobalData &globalData)
| this function is called in each timestep after control.
virtual Position | getPosition () const
| returns position of the object
virtual osg::Vec3 | getPositionbetweenComponents (Component *component)
| This is only a simple function, calculating the coordinates of the point exactly between two directly connected components.
virtual bool | setRobot (OdeRobot *newrobot)
| Sets the reference to the robot for the component, but only if there is no Primitive assigned to the component.
virtual OdeRobot * | getRobot ()
| returns a reference to the robot belonging to the component, if there is no robot it is an NULL pointer, then try getMeinPrimitive, because there is only a solid Primitive not a complex robot for this component
virtual Primitive * | getMainPrimitive () const
| return reference to the simple Primitive, or to the main Primitive of the robot assigend to the component.

## Detailed Description

This is a special class of the component system.

The physical object that belongs to objects of this class is a robot whose class is derived from OdeRobot. The sensor an motor values these component sends and gets could be used to controll the robot that belongs to this component. If this controling method should be used there are two controling parameters that tell the component, how to handle its sensor/motor values. These are the params completemotormode and complete sensormode of the componentConf. These two parameters control if the sensor/motor values will eb send to the robot of the component or not. If thei are not sent to the robot the robot needs its own controller.

## Constructor & Destructor Documentation

RobotComponent | ( | const OdeHandle & | odeHandle,
|  | const OsgHandle & | osgHandle,
|  | const ComponentConf & | conf |
| ) |  |  |

~RobotComponent | ( |  | ) |

## Member Function Documentation

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

Deprecated:
  Do not use it anymore, collision control is done automatically. 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 Component.

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

this function is called in each timestep after control.

It should perform robot-internal checks and actions, like acting and sensing of internal motors/sensors etc.

Parameters:

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

Implements OdeRobot.

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

return reference to the simple Primitive, or to the main Primitive of the robot assigend to the component.

If nothimng is assigned, NULL is returned.

Implements Component.

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

returns number of motors; recursivly adding of the number of sensors all subcomponents; at the moment only counts Hinge-, Slider-, Hinge2 and Universal-Joints; The Motor-Numbers of the robots of the Components is not counted.

Returns:
  number of motors of the component and all its subcomponents

Reimplemented from Component.

Position getPosition | ( |  | ) | const`[virtual]`

returns position of the object

Returns:
  vector of position (x,y,z)

Implements Component.

osg::Vec3 getPositionbetweenComponents | ( | Component * | component | ) | `[virtual]`

This is only a simple function, calculating the coordinates of the point exactly between two directly connected components.

Returns:
  Vector containing the Position

Parameters:

  | index | number of the position

Reimplemented from Component.

OdeRobot * getRobot | ( |  | ) | `[virtual]`

returns a reference to the robot belonging to the component, if there is no robot it is an NULL pointer, then try getMeinPrimitive, because there is only a solid Primitive not a complex robot for this component

Returns:
  the robot asigned to the component

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

Returns number of sensors; recursivly adding of the number of sensors all subcomponents and the robots of all Subcomponents.

Returns:
  number of sensors of the component and all its subcomponents

Reimplemented from Component.

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

Use this, to get all sensor values of all the joints of all subcomponents, and the sensors of all robots, belonging to all subcompionents.

The sensor values have the following sequence: values of the component connecting joints, values of the robot of the component, values of component connecting joints of the first subcomponent, values of the robot of the first subcomponent, ... sensor values of the connecting joints of this component and all subcomponents

Reimplemented from Component.

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

sets the pose of the vehicle

Parameters:

  | pose | desired 4x4 pose matrix

Implements OdeRobot.

void place | ( | const Pos & | pos | ) | `[virtual]`

sets the vehicle to position pos

Parameters:

  | pos | desired position of the robot

Implements Component.

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

Sets the motor values for the joints connecting the component with its subcomponents, an recursivly the joints of all subComponents.

The motors of all robots of the subcomponents is not set.

Parameters:

Reimplemented from Component.

bool setRobot | ( | OdeRobot * | newrobot | ) | `[virtual]`

Sets the reference to the robot for the component, but only if there is no Primitive assigned to the component.

Overwriting an existing robot reference is possible, also to set it NULL, and then set a reference to a Primitive with setSimplePrimitive ( .. ). But first the robot reference should be saved elsewhere or it won't be updated graficaly return true if the reference could be set; false else

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

update the OSG notes here

Implements Component.

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

- robotcomponent.h
- robotcomponent.cpp