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, WheeledRobot, NumberOfDifferentTypes } |
The possible type of wrapped objects. More... | |
Public Member Functions | |
QColor | color () const |
Returns the color to use when rendering this. | |
virtual bool | computeDistanceAndOrientationFromRobot (const WheeledRobot2DWrapper &robot, double &distance, double &angle) const =0 |
Computes the distance and orientation of this object respect to the given robot. | |
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 wrapped PhyObject. | |
virtual const PhyObject * | phyObject () const =0 |
Returns a pointer to the wrapped 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 wrapper object. | |
bool | useColorTextureOfOwner () const |
Returns whether this will be rendered with the color and texture of the owner (if we have one) | |
virtual WObject * | wObject () |
Returns a pointer to the wrapped object. | |
virtual const WObject * | wObject () const |
Returns a pointer to the wrapped object (const version) | |
Protected Member Functions | |
PhyObject2DWrapper (Arena *arena) | |
Constructor. | |
virtual | ~PhyObject2DWrapper () |
Destructor. | |
Protected Attributes | |
Arena *const | m_arena |
The pointer to the arena in which this object lives. | |
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 50 of file wheeledexperimenthelper.h.
Member Enumeration Documentation
enum Type |
The possible type of wrapped objects.
Definition at line 56 of file wheeledexperimenthelper.h.
Constructor & Destructor Documentation
|
protected |
Constructor.
- Parameters
-
arena the arena in which this object lives
Definition at line 198 of file wheeledexperimenthelper.cpp.
|
protectedvirtual |
Destructor.
Definition at line 204 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 260 of file wheeledexperimenthelper.cpp.
References WObject::color(), and PhyObject2DWrapper::wObject().
|
pure virtual |
Computes the distance and orientation of this object respect to the given robot.
This function computes the distance of this object from the given robot. The distance is computed between the nearest points of the two objects. The robot is always modelled as a vertical cylindrical object. The function returns false if it makes no sense to compute the distance
- Parameters
-
robot the robot from which the distance should be computed distance the computed distance angle the computed orientation
- Returns
- false if the distance couldn't be computed
Implemented in WheeledRobot2DWrapper, Cylinder2DWrapper, and Box2DWrapper.
Referenced by Arena::handleKinematicRobotCollisions(), KheperaSampledProximityIRSensor::update(), EpuckSampledProximityIRSensor::update(), and MarXbotSampledProximityIRSensor::update().
|
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 WheeledRobot2DWrapper, Cylinder2DWrapper, and Box2DWrapper.
bool getStatic | ( | ) | const |
Returns true if the object is static.
This function returns always true if the wrapped object is not a PhyObject (i.e. phyObject() returns NULL)
- Returns
- true if the object is static (or if the wrapped object is not a phyObject)
Definition at line 226 of file wheeledexperimenthelper.cpp.
References PhyObject::getStatic(), and PhyObject2DWrapper::phyObject().
|
pure virtual |
Returns a pointer to the wrapped PhyObject.
You should avoid changing the PhyObject directly, use the methods of this class, instead. The returned pointer can be NULL if the wrapped object is not a phyObject
- Returns
- a pointer to the wrapped PhyObject
Implemented in WheeledRobot2DWrapper, Cylinder2DWrapper, and Box2DWrapper.
Referenced by Arena::delete2DObject(), PhyObject2DWrapper::getStatic(), PhyObject2DWrapper::setStatic(), and PhyObject2DWrapper::wObject().
|
pure virtual |
Returns a pointer to the wrapped PhyObject (const version)
The returned pointer can be NULL if the wrapped object is not a phyObject
- Returns
- a const pointer to the wrapped PhyObject
Implemented in WheeledRobot2DWrapper, Cylinder2DWrapper, and Box2DWrapper.
wVector position | ( | ) | const |
Returns the position of the object.
- Returns
- the position of the object
Definition at line 240 of file wheeledexperimenthelper.cpp.
References WObject::matrix(), wMatrix::w_pos, and PhyObject2DWrapper::wObject().
Referenced by Box2DWrapper::computeDistanceAndOrientationFromRobot(), Cylinder2DWrapper::computeDistanceAndOrientationFromRobot(), and WheeledRobot2DWrapper::computeDistanceAndOrientationFromRobot().
void setColor | ( | QColor | color | ) |
Sets the color to use when rendering this.
- Parameters
-
color the color to use when rendering this
Definition at line 255 of file wheeledexperimenthelper.cpp.
References WObject::setColor(), and PhyObject2DWrapper::wObject().
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 235 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 WheeledRobot2DWrapper, Cylinder2DWrapper, and Box2DWrapper.
|
virtual |
Sets whether the object is static or not.
Not all type of objects can change between static and dynamic. This function does nothing if the wrapped object is not a PhyObject (i.e. phyObject() returns NULL)
- Parameters
-
s if true the object will be static
Reimplemented in Cylinder2DWrapper, and Box2DWrapper.
Definition at line 219 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 245 of file wheeledexperimenthelper.cpp.
References WObject::setTexture(), and PhyObject2DWrapper::wObject().
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 265 of file wheeledexperimenthelper.cpp.
References WObject::setUseColorTextureOfOwner(), and PhyObject2DWrapper::wObject().
QString texture | ( | ) | const |
Returns the name of the texture.
- Returns
- the name of the texture
Definition at line 250 of file wheeledexperimenthelper.cpp.
References WObject::texture(), and PhyObject2DWrapper::wObject().
|
pure virtual |
Returns the type of this wrapper object.
The type is used by e.g. sensors
- Returns
- the type of this wrapper object
Implemented in WheeledRobot2DWrapper, Cylinder2DWrapper, and Box2DWrapper.
Referenced by KheperaSampledProximityIRSensor::update(), EpuckSampledProximityIRSensor::update(), and MarXbotSampledProximityIRSensor::update().
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 270 of file wheeledexperimenthelper.cpp.
References WObject::useColorTextureOfOwner(), and PhyObject2DWrapper::wObject().
|
virtual |
Returns a pointer to the wrapped object.
You should avoid changing the wrapped directly, use the methods of this class, instead. The default implementation of this function simply calls phyObject()
- Returns
- a pointer to the wrapped object
Reimplemented in WheeledRobot2DWrapper.
Definition at line 209 of file wheeledexperimenthelper.cpp.
References PhyObject2DWrapper::phyObject().
Referenced by PhyObject2DWrapper::color(), PhyObject2DWrapper::position(), PhyObject2DWrapper::setColor(), PhyObject2DWrapper::setTexture(), PhyObject2DWrapper::setUseColorTextureOfOwner(), PhyObject2DWrapper::texture(), and PhyObject2DWrapper::useColorTextureOfOwner().
|
virtual |
Returns a pointer to the wrapped object (const version)
The default implementation of this function simply calls phyObject()
- Returns
- a const pointer to the wrapped object
Reimplemented in WheeledRobot2DWrapper.
Definition at line 214 of file wheeledexperimenthelper.cpp.
References PhyObject2DWrapper::phyObject().
Friends And Related Function Documentation
|
friend |
The Arena class is friend to be able to instantiate and delete this class.
Definition at line 281 of file wheeledexperimenthelper.h.
Member Data Documentation
|
protected |
The pointer to the arena in which this object lives.
Definition at line 260 of file wheeledexperimenthelper.h.
Referenced by Box2DWrapper::computeDistanceAndOrientationFromRobot(), Cylinder2DWrapper::computeDistanceAndOrientationFromRobot(), and WheeledRobot2DWrapper::computeDistanceAndOrientationFromRobot().
The documentation for this class was generated from the following files:
- experiments/include/wheeledexperimenthelper.h
- experiments/src/wheeledexperimenthelper.cpp