#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; 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 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 | |
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 double | getDistanceToComponent (Component *comp) |
Gets the distance between two components. | |
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 | removeAllSubcomponentsRecursive () |
This removes all subcomponents of THIS component, and all their subcomponents, till the whole structure is destroyed. | |
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 (unsigned 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 bool | setSoftlink (unsigned int position, bool state) |
Sets the connection between the component and one of its subcomponents to be a softlink. | |
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 | |
ComponentConf | getDefaultConf () |
Public Attributes | |
ComponentConf | conf |
std::vector< componentConnection > | connection |
std::vector< Component * > | backwardreference |
Component * | originComponent |
Component * | directOriginComponent |
A component includes the routines for managing sensor and motor values from a controller. With a bunch of components it is possible to create a tree like structure. There is always a root structure. Components could be used as normal robot objects, so they can get motor and sensor values. These values are shared with all components in the tree structure of a component. Between the differnt objects of the component class could exist connections, which are physical represented by Ode-Joints. The components use the motor values they get, to control the joints between them. From these joints sensor values are read out, which where send with the getSensor () function like a normal robot does. But the arrray of sensor values comes from all components within the structure beneth the component, from which the function was called. You could say that each component is a non physical shell around a physical object like a primitive or a robot in classical meaning of this project. These shells build a connection between the physical parts and control these connections, which could be also physical existend.
|
|
|
|
|
This method adds an existing Component as a subcomponent to this component.
|
|
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.
|
|
this function is called in each timestep. It should perform robot-internal checks, like space-internal collision detection, sensor resets/update etc.
Implements OdeRobot.
Reimplemented in AtomComponent, RobotComponent, and SimpleComponent.
|
|
This divides the component structure, following this component into two seperate component structures.
|
|
This returns the connection that connects to the target component.
|
|
This garants an direct access to the connections between the components. Be carefull with using the given references.
|
|
|
|
Gets the distance between two components.
|
|
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.
|
|
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.
Implements AbstractRobot.
Reimplemented in AtomComponent, and RobotComponent.
|
|
Gets the Number of subcomponents of this component.
|
|
Gets the Number of all Subcomponents recursivly connected.
|
|
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.
Reimplemented in AtomComponent, RobotComponent, and SimpleComponent.
|
|
Returns number of sensors; recursivly adding of the number of sensors all subcomponents and the robots of all Subcomponents.
Implements AbstractRobot.
Reimplemented in AtomComponent, and RobotComponent.
|
|
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.
|
|
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.
|
|
This method looks if a special component somehow connected to this component.
|
|
sets the vehicle to position pos
Reimplemented from OdeRobot.
Implemented in AtomComponent, PrimitiveComponent, RobotComponent, and SimpleComponent.
|
|
This removes all subcomponents of THIS component, and all their subcomponents, till the whole structure is destroyed.
|
|
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.
|
|
This method removes an existing Component as a subcomponent of this component. This also removes all Subcomponents of the subcomponent.
|
|
This sets all motors in the component structure to zero, starting from this component.
|
|
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.
|
|
Sets the connection between the component and one of its subcomponents to be a softlink. That means that the recusion for this branch stops here.
|
|
update the OSG notes here
Implements OdeRobot.
Implemented in AtomComponent, PrimitiveComponent, RobotComponent, and SimpleComponent.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|