The class modelling an e-puck robot. More...

Inheritance diagram for PhyEpuck:

Public Member Functions

 PhyEpuck (World *world, QString name, const wMatrix &transformation=wMatrix::identity())
 Creates an e-puck robot. More...
 
virtual ~PhyEpuck ()
 Destructor. More...
 
void doKinematicSimulation (bool k)
 Changes the robot model from dynamic to kinematic and vice-versa. More...
 
bool getDrawFrontMarker () const
 Returns whether a marker in the front part of the robot is drawn or not. More...
 
SimulatedIRGroundSensorControllergroundIRSensorController ()
 Returns the ground IR sensors controller. More...
 
bool isKinematic () const
 Returns true if we are using the kinematic model. More...
 
QList< QColor > ledColors () const
 Returns the color of the leds. More...
 
virtual void postUpdate ()
 Post-updates the robot. More...
 
virtual void preUpdate ()
 Pre-updates the robot. More...
 
SimulatedIRProximitySensorControllerproximityIRSensorController ()
 Returns the proximity infrared sensors controller. More...
 
const QList< PhyCylinder::SegmentColor > & segmentsColor () const
 Returns the colors of segments of the turret. More...
 
void setDrawFrontMarker (bool drawMarker)
 Whether to draw a marker in the front part of the robot or not. More...
 
void setGroundIRSensorsGraphicalProperties (bool drawSensor, bool drawRay=false, bool drawRealRay=false)
 Sets whether ground IR sensors are drawn or not and how. More...
 
void setLedColors (QList< QColor > c, QColor upperBaseColor=QColor())
 Sets the color of the leds of the epuck. More...
 
void setProximityIRSensorsGraphicalProperties (bool drawSensor, bool drawRay=false, bool drawRealRay=false)
 Sets whether proximity IR sensors are drawn or not and how. More...
 
WheelMotorControllerwheelsController ()
 Returns the motor controller for the wheels. More...
 
- Public Member Functions inherited from WObject
 WObject (World *world, QString name="unamed", const wMatrix &tm=wMatrix::identity(), bool addToWorld=true)
 create the object and automatically put this into the world More...
 
virtual ~WObject ()
 destroy the Object and drop it from the world More...
 
QColor color () const
 return the color of this object More...
 
void drawLocalAxes (bool d)
 Sets whether the object local frame of reference should be drawn or not. More...
 
bool isInvisible () const
 return if it is invisible More...
 
const QString & label () const
 Returns the text label to render along with the object. More...
 
const QColor & labelColor () const
 Returns the color of the label. More...
 
const wVectorlabelPosition () const
 Returns the label position relative to this object. More...
 
bool labelShown () const
 Returns whether the label is shown or not. More...
 
bool localAxesDrawn () const
 Returns true if the local frame of refecence of the object should be drawn. More...
 
const wMatrixmatrix () const
 return a reference to the transformation matrix More...
 
QString name () const
 Return the name of this object. More...
 
void setAlpha (int alpha)
 set the value of alpha channel (the transparency) More...
 
void setColor (QColor c)
 Set the color to use on rendering. More...
 
void setInvisible (bool b)
 set invisibility More...
 
void setLabel (QString label)
 Sets a text label to render along with the object. More...
 
void setLabel (QString label, wVector pos)
 Sets a text label to render along with the object and its position. More...
 
void setLabel (QString label, wVector pos, QColor color)
 Sets a text label to render along with the object and its position and color. More...
 
void setLabelColor (const QColor &color)
 Sets the color of the label. More...
 
void setLabelPosition (const wVector &pos)
 Sets the label position relative to this object. More...
 
void setMatrix (const wMatrix &newm)
 set a new matrix More...
 
void setPosition (const wVector &newpos)
 set the position specified in global coordinate frame More...
 
void setPosition (real x, real y, real z)
 set the position specified in global coordinate frame More...
 
void setTexture (QString textureName)
 Set the texture to use for this WObject when rendered. More...
 
void setUseColorTextureOfOwner (bool b)
 set if the object will be rendered with the color and texture of our owner (if we have one) More...
 
void showLabel (bool show)
 Sets whether to show the label or not. More...
 
QString texture () const
 Return the texture name. More...
 
bool useColorTextureOfOwner () const
 if true, we will use color and texture of our owner (if we have one) More...
 
Worldworld ()
 Return the world. More...
 
const Worldworld () const
 Return the world (const version) More...
 
- Public Member Functions inherited from Ownable
 Ownable ()
 Constructor. More...
 
virtual ~Ownable ()
 Destructor. More...
 
const QList< Owned > & owned () const
 Returns the list of objects owned by this one. More...
 
Ownableowner () const
 Returns the owner of this object. More...
 
void setOwner (Ownable *owner, bool destroy=true)
 Sets the owner of this object. More...
 

Static Public Attributes

static const real axletrack = 0.053f
 The distance between the two motorized wheels. More...
 
static const real batterym = 0.042f
 The mass of the battery. More...
 
static const real batteryplacedistancefromground = 0.0015f
 The distance of the battery pack from the ground. More...
 
static const real batteryplacex = 0.043f
 The x dimension of the battery pack under the robot. More...
 
static const real batteryplacey = 0.055f
 The y dimension of the battery pack under the robot. More...
 
static const real batteryplacez = 0.033f
 The z dimension of the battery pack under the robot. More...
 
static const real bodyh = 0.021f
 The height of the upper part of the robot (containing the main electionic board) More...
 
static const real bodyr = 0.035f
 The radius of the upper part of the robot (containing the main electionic board) More...
 
static const real passivewheelm = 0.005f
 The mass of the passive wheels. More...
 
static const real passivewheelr = 0.005f
 The radius of the passive wheels. More...
 
static const real wheelh = 0.003f
 The height of the motorized wheels. More...
 
static const real wheelm = 0.010f
 The mass of one motorized wheel. More...
 
static const real wheelr = 0.0205f
 The radius of the motorized wheels. More...
 
static const real wholebodym = 0.078f
 The mass of the robot without the wheels and the battery. More...
 

Protected Slots

void setLeftWheelDesideredVelocity (real velocity)
 Sets the desidered velocity of the left wheel. More...
 
void setRightWheelDesideredVelocity (real velocity)
 Sets the desidered velocity of the right wheel. More...
 

Protected Member Functions

virtual void changedMatrix ()
 The function called when the transformation matrix of the robot is changed. More...
 

Additional Inherited Members

- Public Types inherited from Ownable
typedef QList< OwnedOwnedList
 The type for the list of owned objects. More...
 
- Protected Attributes inherited from WObject
QColor colorv
 Color, it contains also alpha channel. More...
 
bool invisible
 if TRUE it will not renderized More...
 
QColor labelcol
 The color of the label. More...
 
bool labeldrawn
 Whether the label should be rendered or not. More...
 
wVector labelpos
 The position of the label in the object frame of reference. More...
 
QString labelv
 The text label of the object. More...
 
bool localFrameOfReferenceDrawn
 If true, the local frame of reference of the object is drawn. More...
 
QString namev
 Name of the WObject. More...
 
QString texturev
 Texture name. More...
 
wMatrix tm
 Trasformation matrix. More...
 
bool usecolortextureofowner
 if true, we will use color and texture of our owner (if we have one). More...
 
Worldworldv
 World. More...
 

Detailed Description

The class modelling an e-puck robot.

This class models an e-puck robot. For more information about the robot go to http://mobots.epfl.ch/e-puck.html

Definition at line 46 of file phyepuck.h.

Constructor & Destructor Documentation

~PhyEpuck ( )
virtual

Destructor.

Definition at line 274 of file phyepuck.cpp.

Member Function Documentation

void changedMatrix ( )
protectedvirtual

The function called when the transformation matrix of the robot is changed.

This updates the matrix of all sub-objects

Reimplemented from WObject.

Definition at line 442 of file phyepuck.cpp.

References WObject::matrix(), WObject::setMatrix(), WObject::tm, and PhyJoint::updateJointInfo().

void doKinematicSimulation ( bool  k)

Changes the robot model from dynamic to kinematic and vice-versa.

Parameters
kif true switches to the kinematic e-puck model, if false to the dynamic one (at creation the model is always dynamic)

Definition at line 355 of file phyepuck.cpp.

References PhyObject::setKinematic().

bool getDrawFrontMarker ( ) const

Returns whether a marker in the front part of the robot is drawn or not.

Returns
true if a marker in the front part of the robot is drawn

Definition at line 350 of file phyepuck.cpp.

Referenced by PhyEpuck::setDrawFrontMarker().

SimulatedIRGroundSensorController* groundIRSensorController ( )
inline

Returns the ground IR sensors controller.

Returns
the ground IR sensors controller

Definition at line 169 of file phyepuck.h.

bool isKinematic ( ) const
inline

Returns true if we are using the kinematic model.

Returns
true if we are using the kinematic model

Definition at line 247 of file phyepuck.h.

QList< QColor > ledColors ( ) const

Returns the color of the leds.

Returns
the color of leds

Definition at line 409 of file phyepuck.cpp.

References WObject::color().

void postUpdate ( )
virtual

Post-updates the robot.

This method is called at each step of the world just after the physic update

Reimplemented from WObject.

Definition at line 305 of file phyepuck.cpp.

References SensorController::isEnabled(), WObject::matrix(), WObject::tm, SimulatedIRProximitySensorController::update(), and SimulatedIRGroundSensorController::update().

void preUpdate ( )
virtual

Pre-updates the robot.

This method is called at each step of the world just before the physic update

Reimplemented from WObject.

Definition at line 288 of file phyepuck.cpp.

References PhyEpuck::axletrack, MotorController::isEnabled(), WObject::matrix(), WObject::setMatrix(), WheelMotorController::update(), PhyEpuck::wheelr, and WObject::world().

SimulatedIRProximitySensorController* proximityIRSensorController ( )
inline

Returns the proximity infrared sensors controller.

Returns
the proximity infrared sensors controller

Definition at line 159 of file phyepuck.h.

const QList< PhyCylinder::SegmentColor > & segmentsColor ( ) const

Returns the colors of segments of the turret.

This is a low-level function that returns the color of segments on the turrent

Returns
the colors of segments of the turret

Definition at line 422 of file phyepuck.cpp.

References WObject::color(), and PhyCylinder::segmentsColor().

void setDrawFrontMarker ( bool  drawMarker)

Whether to draw a marker in the front part of the robot or not.

Parameters
drawMarkerif true draws a marker in the front part of the robot

Definition at line 329 of file phyepuck.cpp.

References GraphicalWObject::attachToObject(), PhyEpuck::batteryplacedistancefromground, PhyEpuck::batteryplacez, PhyEpuck::bodyh, PhyEpuck::bodyr, PhyEpuck::getDrawFrontMarker(), wMatrix::roll(), WObject::setColor(), WObject::setTexture(), WObject::setUseColorTextureOfOwner(), and WObject::world().

void setGroundIRSensorsGraphicalProperties ( bool  drawSensor,
bool  drawRay = false,
bool  drawRealRay = false 
)

Sets whether ground IR sensors are drawn or not and how.

Parameters
drawSensorwhether to draw the sensor or not
drawRaywhether to draw the IR rays or not
drawRealRayif true rays are drawn in their actual length, otherwise only the direction is given

Definition at line 324 of file phyepuck.cpp.

References SimulatedIRGroundSensorController::setGraphicalProperties().

void setLedColors ( QList< QColor >  c,
QColor  upperBaseColor = QColor() 
)

Sets the color of the leds of the epuck.

This function takes a list of exactly 8 colors for the leds. If this function is never called, all leds take the color set by setColor(). As soon as this function is called, the color of the leds becomes indipendent of the color set by setColor()

Parameters
cthe list of colors of leds. This must have exactly 8 elements, otherwise colors are not changed
upperBaseColorthe color of the upper base. This is ignored if it is an invalid color

Definition at line 388 of file phyepuck.cpp.

References WObject::color(), farsa::normalizeRad(), PhyCylinder::setLowerBaseColor(), PhyCylinder::setSegmentsColor(), PhyCylinder::setUpperBaseColor(), and WObject::setUseColorTextureOfOwner().

void setLeftWheelDesideredVelocity ( real  velocity)
protectedslot

Sets the desidered velocity of the left wheel.

This is used when in kinematic to move the robot. We only use velocity because robots can only move by setting wheel velocities

Parameters
velocitythe desidered velocity (in radiants per second)

Definition at line 432 of file phyepuck.cpp.

Referenced by PhyEpuck::PhyEpuck().

void setProximityIRSensorsGraphicalProperties ( bool  drawSensor,
bool  drawRay = false,
bool  drawRealRay = false 
)

Sets whether proximity IR sensors are drawn or not and how.

Parameters
drawSensorwhether to draw the sensor or not
drawRaywhether to draw the IR rays or not
drawRealRayif true rays are drawn in their actual length, otherwise only the direction is given

Definition at line 319 of file phyepuck.cpp.

References SimulatedIRProximitySensorController::setGraphicalProperties().

void setRightWheelDesideredVelocity ( real  velocity)
protectedslot

Sets the desidered velocity of the right wheel.

This is used when in kinematic to move the robot. We only use velocity because robots can only move by setting wheel velocities

Parameters
velocitythe desidered velocity (in radiants per second)

Definition at line 437 of file phyepuck.cpp.

Referenced by PhyEpuck::PhyEpuck().

WheelMotorController* wheelsController ( )
inline

Returns the motor controller for the wheels.

Returns
the motor controller for the wheels

Definition at line 149 of file phyepuck.h.

Member Data Documentation

const real axletrack = 0.053f
static

The distance between the two motorized wheels.

Definition at line 111 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck(), and PhyEpuck::preUpdate().

const real batterym = 0.042f
static

The mass of the battery.

Definition at line 68 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck().

const real batteryplacedistancefromground = 0.0015f
static

The distance of the battery pack from the ground.

Definition at line 73 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck(), and PhyEpuck::setDrawFrontMarker().

const real batteryplacex = 0.043f
static

The x dimension of the battery pack under the robot.

Definition at line 53 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck().

const real batteryplacey = 0.055f
static

The y dimension of the battery pack under the robot.

Definition at line 58 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck().

const real batteryplacez = 0.033f
static

The z dimension of the battery pack under the robot.

Definition at line 63 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck(), and PhyEpuck::setDrawFrontMarker().

const real bodyh = 0.021f
static

The height of the upper part of the robot (containing the main electionic board)

Definition at line 85 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck(), and PhyEpuck::setDrawFrontMarker().

const real bodyr = 0.035f
static

The radius of the upper part of the robot (containing the main electionic board)

Definition at line 79 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck(), and PhyEpuck::setDrawFrontMarker().

const real passivewheelm = 0.005f
static

The mass of the passive wheels.

The real robot has no passive wheels, here we need them to reduce the friction with the ground

Definition at line 127 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck().

const real passivewheelr = 0.005f
static

The radius of the passive wheels.

The real robot has no passive wheels, here we need them to reduce the friction with the ground

Definition at line 119 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck().

const real wheelh = 0.003f
static

The height of the motorized wheels.

Definition at line 101 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck().

const real wheelm = 0.010f
static

The mass of one motorized wheel.

Definition at line 106 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck().

const real wheelr = 0.0205f
static

The radius of the motorized wheels.

Definition at line 96 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck(), and PhyEpuck::preUpdate().

const real wholebodym = 0.078f
static

The mass of the robot without the wheels and the battery.

Definition at line 91 of file phyepuck.h.

Referenced by PhyEpuck::PhyEpuck().


The documentation for this class was generated from the following files: