Component Class Reference

Component. More...

#include <component.h>

Inherits OdeRobot.

Inherited by AtomComponent, PrimitiveComponent, RobotComponent, and SimpleComponent.

Inheritance diagram for Component:

Inheritance graph
[legend]
Collaboration diagram for Component:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Component (const OdeHandle &odeHandle, const OsgHandle &osgHandle, const ComponentConf &conf)
 ~Component ()
virtual int getSensorNumber ()
 returns number of sensors
virtual int getMotorNumber ()
 returns number of motors
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 void resetMotorsRecursive ()
 This sets all motors in the component structure to zero, starting from this component.
virtual void update ()=0
 update the OSG notes here
virtual void place (const Pos &pos)=0
 sets the vehicle to position pos pos desired position of the robot
virtual bool collisionCallback (void *data, dGeomID o1, dGeomID o2)
 checks for internal collisions and treats them.
virtual void doInternalStuff (const GlobalData &globalData)
 this function is called in each timestep.
virtual Position getPosition () const =0
 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 PrimitivegetMainPrimitive () const =0
 return reference to the simple Primitive, or to the main Primitive of the robot assigend to the component.
virtual int getNumberSubcomponents ()
 Gets the Number of subcomponents of this component.
virtual int getNumberSubcomponentsAll ()
 Gets the Number of all Subcomponents recursivly connected.
virtual void addSubcomponent (Component *newsubcomponent, Joint *newconnectingjoint, bool softlink)
 This method adds an existing Component as a subcomponent to this component.
virtual ComponentremoveSubcomponent (int removedsubcomponentnumber)
 This method removes an existing Component as a subcomponent of this component.
virtual ComponentremoveSubcomponent (Component *removedsubcomponent)
 This method removes an existing Component as a subcomponent of this component.
virtual void updateOriginsRecursive (Component *parent)
 This updates the origin references within the component tree.
virtual void removeSoftlinksRecursive ()
 This removes all softlinks of the structure that has THIS as his origin.
virtual bool hasSubcomponent (Component *subcomp)
 This method looks if a special component is a subcomponent of this component.
virtual bool isComponentConnected (Component *connectedComp)
 This method looks if a special component somehow connected to this component.
virtual componentConnectiongetConnection (int connectionnumber)
 This garants an direct access to the connections between the components.
virtual componentConnectiongetConnection (Component *targetcomponent)
 This returns the connection that connects to the target component.
virtual ComponentgetBestDivideComponent (double targetrelation, int maxsize, Component *currentBestDivideComponent)
 This divides the component structure, following this component into two seperate component structures.

Static Public Member Functions

static ComponentConf getDefaultConf ()

Public Attributes

ComponentConf conf
std::vector< componentConnectionconnection
std::vector< Component * > backwardreference
ComponentoriginComponent
ComponentdirectOriginComponent

Classes

struct  componentConnection

Detailed Description

Component.


Constructor & Destructor Documentation

Component ( const OdeHandle odeHandle,
const OsgHandle osgHandle,
const ComponentConf conf 
)

~Component (  ) 


Member Function Documentation

void addSubcomponent ( Component newsubcomponent,
Joint newconnectingjoint,
bool  softlink 
) [virtual]

This method adds an existing Component as a subcomponent to this component.

Parameters:
subcomponent to add
reference to external created joint, which connects both components

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).

Implements OdeRobot.

Reimplemented in AtomComponent, RobotComponent, and SimpleComponent.

void doInternalStuff ( const GlobalData globalData  )  [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

Implements OdeRobot.

Reimplemented in AtomComponent, RobotComponent, and SimpleComponent.

Component * getBestDivideComponent ( double  targetrelation,
int  maxsize,
Component currentBestDivideComponent 
) [virtual]

This divides the component structure, following this component into two seperate component structures.

Parameters:
the relation between the two new component structures, if it is 1/2 the structures would have the same number of components or only have a difference by one if the whole structures has an odd number of components
maximum size of the whole Component structure of the first call of this function
the best component for dividing at the moment of calling this function; it should be NULL for the first call of the function, so that no best component is set up till now
Returns:
the best Componet for dividing at the moment the function is finished

Component::componentConnection * getConnection ( Component targetcomponent  )  [virtual]

This returns the connection that connects to the target component.

Parameters:
the reference to the component which is subcomponent in the searched connection
Returns:
the reference of connection element

Component::componentConnection * getConnection ( int  connectionnumber  )  [virtual]

This garants an direct access to the connections between the components.

Be carefull with using the given references.

Parameters:
the number of the connection
Returns:
the reference of connection element

static ComponentConf getDefaultConf (  )  [inline, static]

virtual Primitive* getMainPrimitive (  )  const [pure 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 OdeRobot.

Implemented in AtomComponent, PrimitiveComponent, RobotComponent, and SimpleComponent.

int getMotorNumber (  )  [virtual]

returns number of motors

Implements AbstractRobot.

Reimplemented in AtomComponent, and RobotComponent.

int getNumberSubcomponents (  )  [virtual]

Gets the Number of subcomponents of this component.

Returns:
Number of subcomponents

int getNumberSubcomponentsAll (  )  [virtual]

Gets the Number of all Subcomponents recursivly connected.

Returns:
Number of subcomponents

virtual Position getPosition (  )  const [pure virtual]

returns position of the object

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

Reimplemented from OdeRobot.

Implemented in AtomComponent, PrimitiveComponent, RobotComponent, and SimpleComponent.

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 in AtomComponent, RobotComponent, and SimpleComponent.

int getSensorNumber (  )  [virtual]

returns number of sensors

Implements AbstractRobot.

Reimplemented in AtomComponent, and RobotComponent.

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

Implements AbstractRobot.

Reimplemented in AtomComponent, and RobotComponent.

bool hasSubcomponent ( Component subcomp  )  [virtual]

This method looks if a special component is a subcomponent of this component.

Only direct subcomponents are registrated. Components which are only connected by softlink are a connection here as well.

Parameters:
the component, which could be a subcomponent of this component
Returns:
true if it is a subcomponent, false if not

bool isComponentConnected ( Component connectedComp  )  [virtual]

This method looks if a special component somehow connected to this component.

Parameters:
the component, which could be connected
Returns:
true if it is connected, false if not

virtual void place ( const Pos pos  )  [pure virtual]

sets the vehicle to position pos pos desired position of the robot

Parameters:
pos desired position of the robot

Reimplemented from OdeRobot.

Implemented in AtomComponent, PrimitiveComponent, RobotComponent, and SimpleComponent.

void removeSoftlinksRecursive (  )  [virtual]

This removes all softlinks of the structure that has THIS as his origin.

Component * removeSubcomponent ( Component removedsubcomponent  )  [virtual]

This method removes an existing Component as a subcomponent of this component.

This also removes all Subcomponents of the subcomponent.

Parameters:
subcomponent to remove
Returns:
reference to the removed subcomponent, so that it could be used to do other things

Component * removeSubcomponent ( int  removedsubcomponentnumber  )  [virtual]

This method removes an existing Component as a subcomponent of this component.

This also removes all Subcomponents of the subcomponent.

Parameters:
subcomponent number to remove
Returns:
reference to the removed subcomponent, so that it could be used to do other things

void resetMotorsRecursive (  )  [virtual]

This sets all motors in the component structure to zero, starting from this 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:
 

Implements AbstractRobot.

Reimplemented in AtomComponent, and RobotComponent.

virtual void update (  )  [pure virtual]

update the OSG notes here

Implements OdeRobot.

Implemented in AtomComponent, PrimitiveComponent, RobotComponent, and SimpleComponent.

void updateOriginsRecursive ( Component parent  )  [virtual]

This updates the origin references within the component tree.

If this is a removed subcomponent for examble, then parent should be this itself, so it is the top of the tree.

Parameters:
the component wich is the top of the tree structure, could also be this component itself


Member Data Documentation

std::vector<Component*> backwardreference

ComponentConf conf

std::vector<componentConnection> connection

Component* directOriginComponent

Component* originComponent


The documentation for this class was generated from the following files:
Generated on Mon Aug 7 16:55:27 2006 for Robotsystem of the Robot Group Leipzig by  doxygen 1.4.7