A class wrapping a PhyObject to add methods suitable for wheeled robots simulations. More...

Public Types | |
enum | Type { Plane = 0, Wall, Box, RectangularTargetArea, Cylinder, SmallCylinder, BigCylinder, CircularTargetArea, NumberOfDifferentTypes } |
The possible type of wrapped objects. More... | |
Public Member Functions | |
QColor | color () const |
Returns the color to use when rendering this. | |
virtual void | computeLinearViewFieldOccupiedRange (const wMatrix &mtr, double &minAngle, double &maxAngle, double &distance) const =0 |
Computes the portion of a linear the view field occupied by this object. | |
bool | getStatic () const |
Returns true if the object is static. | |
virtual PhyObject * | phyObject ()=0 |
Returns a pointer to the wrapper PhyObject. | |
virtual const PhyObject * | phyObject () const =0 |
Returns a pointer to the wrapper PhyObject (const version) | |
wVector | position () const |
Returns the position of the object. | |
void | setColor (QColor color) |
Sets the color to use when rendering this. | |
void | setPosition (wVector pos) |
Sets the position of the object in the plane. | |
virtual void | setPosition (real x, real y)=0 |
Sets the position of the object in the plane. | |
virtual void | setStatic (bool s) |
Sets whether the object is static or not. | |
void | setTexture (QString textureName) |
Set the texture to use when rendering this. | |
void | setUseColorTextureOfOwner (bool b) |
Sets whether this will be rendered with the color and texture of our owner (if we have one) | |
QString | texture () const |
Returns the name of the texture. | |
virtual Type | type () const =0 |
Returns the type of this wrapped object. | |
bool | useColorTextureOfOwner () const |
Returns whether this will be rendered with the color and texture of the owner (if we have one) | |
Protected Member Functions | |
PhyObject2DWrapper () | |
Constructor. | |
virtual | ~PhyObject2DWrapper () |
Destructor. | |
Friends | |
class | Arena |
The Arena class is friend to be able to instantiate and delete this class. | |
Detailed Description
A class wrapping a PhyObject to add methods suitable for wheeled robots simulations.
This class wraps a PhyObject and adds methods which should be used when doing wheeled robots simulations to ensure everything works well. Objects cannot be instantiated directly, they are returned by functions of the Arena class
Definition at line 48 of file wheeledexperimenthelper.h.
Member Enumeration Documentation
enum Type |
The possible type of wrapped objects.
Definition at line 54 of file wheeledexperimenthelper.h.
Constructor & Destructor Documentation
|
protected |
Constructor.
Definition at line 97 of file wheeledexperimenthelper.cpp.
|
protectedvirtual |
Destructor.
Definition at line 102 of file wheeledexperimenthelper.cpp.
Member Function Documentation
QColor color | ( | ) | const |
Returns the color to use when rendering this.
- Returns
- the color to use when rendering this
Definition at line 142 of file wheeledexperimenthelper.cpp.
References PhyObject::color(), and PhyObject2DWrapper::phyObject().
|
pure virtual |
Computes the portion of a linear the view field occupied by this object.
This function must be implemented in subclasses to return the angular range occupied by the object on a linear camera described by the given matrix. The Z axis of the matrix is the upvector, the camera lies on the XY plane and points towars the X axis (i.e. angles start from the X axis). If the object is not visible by the camera, this function returns a negative distance. The min angle can be greater than the max angle if the object is behind the camera.
- Parameters
-
mtr the matrix describing the camera (see function description) minAngle this is set to the minimum angle of the view field occupied by the object maxAngle this is set to the maximum angle of the view field occupied by the object distance this is set to the distance of the object from the camera. It is negative if the object is not visible by the camera
Implemented in Cylinder2DWrapper, and Box2DWrapper.
bool getStatic | ( | ) | const |
Returns true if the object is static.
- Returns
- true if the object is static
Definition at line 112 of file wheeledexperimenthelper.cpp.
References PhyObject::getStatic(), and PhyObject2DWrapper::phyObject().
|
pure virtual |
Returns a pointer to the wrapper PhyObject.
You should avoid changing the PhyObject directly, use the methods of this class, instead
- Returns
- a pointer to the wrapper PhyObject
Implemented in Cylinder2DWrapper, and Box2DWrapper.
Referenced by PhyObject2DWrapper::color(), PhyObject2DWrapper::getStatic(), PhyObject2DWrapper::position(), PhyObject2DWrapper::setColor(), PhyObject2DWrapper::setStatic(), PhyObject2DWrapper::setTexture(), PhyObject2DWrapper::setUseColorTextureOfOwner(), PhyObject2DWrapper::texture(), and PhyObject2DWrapper::useColorTextureOfOwner().
|
pure virtual |
Returns a pointer to the wrapper PhyObject (const version)
- Returns
- a const pointer to the wrapper PhyObject
Implemented in Cylinder2DWrapper, and Box2DWrapper.
wVector position | ( | ) | const |
Returns the position of the object.
- Returns
- the position of the object
Definition at line 122 of file wheeledexperimenthelper.cpp.
References PhyObject::matrix(), PhyObject2DWrapper::phyObject(), and wMatrix::w_pos.
Referenced by RobotOnPlane::positionOnPlane().
void setColor | ( | QColor | color | ) |
Sets the color to use when rendering this.
- Parameters
-
color the color to use when rendering this
Definition at line 137 of file wheeledexperimenthelper.cpp.
References PhyObject2DWrapper::phyObject(), and PhyObject::setColor().
void setPosition | ( | wVector | pos | ) |
Sets the position of the object in the plane.
The Z coordinate is discarded. Not all type of objects can be moved
- Parameters
-
pos the new position (the z coordinate is discarded)
Definition at line 117 of file wheeledexperimenthelper.cpp.
|
pure virtual |
Sets the position of the object in the plane.
Not all type of objects can be moved
- Parameters
-
x the new x coordinate y the new y coordinate
Implemented in Cylinder2DWrapper, and Box2DWrapper.
|
virtual |
Sets whether the object is static or not.
Not all type of objects can change between static and dynamic
- Parameters
-
s if true the object will be static
Reimplemented in Cylinder2DWrapper, and Box2DWrapper.
Definition at line 107 of file wheeledexperimenthelper.cpp.
References PhyObject2DWrapper::phyObject(), and PhyObject::setStatic().
void setTexture | ( | QString | textureName | ) |
Set the texture to use when rendering this.
- Parameters
-
textureName the name of the texture
Definition at line 127 of file wheeledexperimenthelper.cpp.
References PhyObject2DWrapper::phyObject(), and PhyObject::setTexture().
Referenced by Arena::createWall().
void setUseColorTextureOfOwner | ( | bool | b | ) |
Sets whether this will be rendered with the color and texture of our owner (if we have one)
- Parameters
-
b if true we will use the color and texture of our owner (if we have one
Definition at line 147 of file wheeledexperimenthelper.cpp.
References PhyObject2DWrapper::phyObject(), and PhyObject::setUseColorTextureOfOwner().
QString texture | ( | ) | const |
Returns the name of the texture.
- Returns
- the name of the texture
Definition at line 132 of file wheeledexperimenthelper.cpp.
References PhyObject2DWrapper::phyObject(), and PhyObject::texture().
|
pure virtual |
Returns the type of this wrapped object.
The type is used by e.g. sensors
- Returns
- the type of this wrapped object
Implemented in Cylinder2DWrapper, and Box2DWrapper.
bool useColorTextureOfOwner | ( | ) | const |
Returns whether this will be rendered with the color and texture of the owner (if we have one)
- Returns
- true if this will be rendered using the color and texture of our owner
Definition at line 152 of file wheeledexperimenthelper.cpp.
References PhyObject2DWrapper::phyObject(), and PhyObject::useColorTextureOfOwner().
Friends And Related Function Documentation
|
friend |
The Arena class is friend to be able to instantiate and delete this class.
Definition at line 229 of file wheeledexperimenthelper.h.
The documentation for this class was generated from the following files:
- experiments/include/wheeledexperimenthelper.h
- experiments/src/wheeledexperimenthelper.cpp