#include <component.h>
Inherits OdeRobot.
Inherited by AtomComponent, PrimitiveComponent, RobotComponent, and SimpleComponent.
Inheritance diagram for Component:


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 Primitive * | getMainPrimitive () 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 Component * | removeSubcomponent (int removedsubcomponentnumber) |
| This method removes an existing Component as a subcomponent of this component. | |
| virtual Component * | removeSubcomponent (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 componentConnection * | getConnection (int connectionnumber) |
| This garants an direct access to the connections between the components. | |
| virtual componentConnection * | getConnection (Component *targetcomponent) |
| This returns the connection that connects to the target component. | |
| virtual Component * | getBestDivideComponent (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< componentConnection > | connection |
| std::vector< Component * > | backwardreference |
| Component * | originComponent |
| Component * | directOriginComponent |
Classes | |
| struct | componentConnection |
| Component | ( | const OdeHandle & | odeHandle, | |
| const OsgHandle & | osgHandle, | |||
| const ComponentConf & | conf | |||
| ) |
| ~Component | ( | ) |
| void addSubcomponent | ( | Component * | newsubcomponent, | |
| Joint * | newconnectingjoint, | |||
| bool | softlink | |||
| ) | [virtual] |
This method adds an existing Component as a subcomponent to this component.
| 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.
| 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.
| 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 |
| Component::componentConnection * getConnection | ( | Component * | targetcomponent | ) | [virtual] |
This returns the connection that connects to the target component.
| the | reference to the component which is subcomponent in the searched connection |
| Component::componentConnection * getConnection | ( | int | connectionnumber | ) | [virtual] |
This garants an direct access to the connections between the components.
Be carefull with using the given references.
| the | number of the connection |
| 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.
| int getNumberSubcomponentsAll | ( | ) | [virtual] |
Gets the Number of all Subcomponents recursivly connected.
| virtual Position getPosition | ( | ) | const [pure virtual] |
returns position of the object
Reimplemented from OdeRobot.
Implemented in AtomComponent, PrimitiveComponent, RobotComponent, and SimpleComponent.
This is only a simple function, calculating the coordinates of the point exactly between two directly connected components.
| 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.
| the | component, which could be a subcomponent of this component |
| bool isComponentConnected | ( | Component * | connectedComp | ) | [virtual] |
This method looks if a special component somehow connected to this component.
| the | component, which could be connected |
| virtual void place | ( | const Pos & | pos | ) | [pure virtual] |
sets the vehicle to position pos pos desired position of the robot
| 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.
This method removes an existing Component as a subcomponent of this component.
This also removes all Subcomponents of the subcomponent.
| subcomponent | to remove |
| 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.
| subcomponent | number to remove |
| 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.
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.
| the | component wich is the top of the tree structure, could also be this component itself |
| std::vector<Component*> backwardreference |
| std::vector<componentConnection> connection |
1.4.7