Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Spherus Class Reference

#include <Spherus.h>

Inheritance diagram for Spherus:

PhysicalObject GraphicalObject List of all members.

Public Member Functions

Public Attributes

Static Public Attributes


Detailed Description

Defines the Spherus agent. The agent is composed of two circles, each at distance l from the center r of the agent. The angle of the line defined by the circles with the horisontal is alpha.

Definition at line 22 of file Spherus.h.


Constructor & Destructor Documentation

Spherus::Spherus real  x,
real  y,
real  alpha = 0.0,
real  extension = 0.6,
real  R = 0.1,
Controller controller = NULL
 

Definition at line 19 of file Spherus.cpp.

References circles, computeMemberPositions(), computeSinCos(), extensionActivation, eyes, M_PI, nTactileSensors, nVisionSensors, rocketActivations, rocketForceValues, Vector2::setXY(), and targetExtension.

Spherus::~Spherus  )  [virtual]
 

Definition at line 46 of file Spherus.cpp.

References circles, and eyes.


Member Function Documentation

void Spherus::computeCircleProprioception Circle circle,
float &  forward,
float &  backward
 

Definition at line 133 of file Spherus.cpp.

References PhysicalObject::m, M_PI, real, PhysicalObject::v, Vector2::x, and Vector2::y.

Referenced by controll().

void Spherus::computeDerivatives GlobalContactInfoVector globalContacts  )  [virtual]
 

Computes the derivatives, given the contact forces. The globalContacts pointer is needed for contact processing for articulated agents.

Reimplemented from PhysicalObject.

Definition at line 201 of file Spherus.cpp.

References circles, and PhysicalObject::computeDerivatives().

void Spherus::computeDerivativesWithoutContacts ContactSolver contactSolver  )  [virtual]
 

Computes the derivatives (velocity, angular velocity) of the object, ignoring any eventual contact forces.

Reimplemented from PhysicalObject.

Definition at line 147 of file Spherus.cpp.

References circles, PhysicalObject::computeDerivativesWithoutContacts(), cosAlpha, elasticK, extension, PhysicalObject::externalForce, real, rocketForces, rocketForceValues, Vector2::setXY(), and sinAlpha.

void Spherus::computeMemberPositions  ) 
 

Definition at line 71 of file Spherus.cpp.

References circles, cosAlpha, extension, PhysicalObject::r, Vector2::setXY(), sinAlpha, Vector2::x, and Vector2::y.

Referenced by Spherus().

void Spherus::computeSinCos  ) 
 

Definition at line 66 of file Spherus.cpp.

References cosAlpha, and sinAlpha.

Referenced by computeState(), and Spherus().

void Spherus::computeState  ) 
 

Computes alpha and extension as a function of the positions of the two eyes, calls computeSinCos.

Definition at line 54 of file Spherus.cpp.

References circles, computeSinCos(), extension, PhysicalObject::r, real, sqr(), Vector2::x, and Vector2::y.

Referenced by integrate().

void Spherus::controll  )  [virtual]
 

Transmits perceptual information to the controller and gets motor information from it. To be overridden by agents or other objects with self-generated movement.

Reimplemented from PhysicalObject.

Definition at line 76 of file Spherus.cpp.

References Controller::advanceTime(), circles, computeCircleProprioception(), controller, extension, extensionActivation, eyes, Controller::getOutput(), maxExtension, rocketActivations, rocketForceValues, Controller::setInput(), and targetExtension.

void Spherus::deleteContacts  )  [virtual]
 

Delete the contacts of the object.

Reimplemented from PhysicalObject.

Definition at line 186 of file Spherus.cpp.

References circles, PhysicalObject::deleteContacts(), and eyes.

bool Spherus::detectContacts PhysicalObject object,
GlobalContactInfoVector contacts
[virtual]
 

Contact handling.

Implements PhysicalObject.

Definition at line 173 of file Spherus.cpp.

References circles, VisualSensor::detectContacts(), Circle::detectContacts(), and eyes.

void Spherus::detectInternalContacts GlobalContactInfoVector contacts  )  [virtual]
 

Detects internal contacts. Does nothing for primitive objects or composed objects. To be overriden by complex objects that have parts that move relative to each other, such as articulated objects.

Reimplemented from PhysicalObject.

Definition at line 182 of file Spherus.cpp.

References circles, and Circle::detectContacts().

bool Spherus::detectMouseContact const Vector2 rMouse,
Vector2 p,
PhysicalObject *&  object
[virtual]
 

Detects whether a click of the mouse at rMouse has touched the object. In case of contact, returns true and sets p to the relative vector between the center of the object and the contact point; p is expressed in the object reference frame because it rotates with the object while the object is dragged. The object needs to be set by the function because, for articulated objects, the dragged object is an articulation and not the whole articulated object. To be overriden by the various object primitives.

Reimplemented from PhysicalObject.

Definition at line 193 of file Spherus.cpp.

References circles, and Circle::detectMouseContact().

void Spherus::draw GUI gui  )  [virtual]
 

Draw the object to the graphical user interface.

Implements GraphicalObject.

Definition at line 219 of file Spherus.cpp.

References circles, Circle::draw(), VisualSensor::draw(), GUI::drawForce(), GUI::drawLine(), eyes, PhysicalObject::r, rocketForces, GUI::setBrushColor(), GUI::setPenColor(), Vector2::x, and Vector2::y.

void Spherus::integrate const Integrator integrator  )  [virtual]
 

Advances the time to the next timestep.

Reimplemented from PhysicalObject.

Definition at line 208 of file Spherus.cpp.

References PhysicalObject::alpha, circles, computeState(), and PhysicalObject::integrate().


Member Data Documentation

Circle* Spherus::circles[2]
 

The circles composing the agent

Definition at line 35 of file Spherus.h.

Referenced by computeDerivatives(), computeDerivativesWithoutContacts(), computeMemberPositions(), computeState(), controll(), deleteContacts(), detectContacts(), detectInternalContacts(), detectMouseContact(), draw(), integrate(), Spherus(), and ~Spherus().

Controller* Spherus::controller
 

Definition at line 75 of file Spherus.h.

Referenced by controll().

real Spherus::cosAlpha
 

Definition at line 51 of file Spherus.h.

Referenced by computeDerivativesWithoutContacts(), computeMemberPositions(), and computeSinCos().

real Spherus::extension
 

The distance between the circles.

Definition at line 32 of file Spherus.h.

Referenced by computeDerivativesWithoutContacts(), computeMemberPositions(), computeState(), and controll().

real Spherus::extensionActivation
 

Definition at line 42 of file Spherus.h.

Referenced by controll(), and Spherus().

VisualSensor* Spherus::eyes[2]
 

Definition at line 37 of file Spherus.h.

Referenced by controll(), deleteContacts(), detectContacts(), draw(), Spherus(), and ~Spherus().

const unsigned int Spherus::nEffectors = 2*2+1 [static]
 

Definition at line 17 of file Spherus.cpp.

const unsigned int Spherus::nSensors = 2*(nVisionSensors+nTactileSensors)+1+4 [static]
 

The number of unit sensors (pixels) in the tactile sensor.

Reimplemented from PhysicalObject.

Definition at line 16 of file Spherus.cpp.

real Spherus::R
 

The radius of the circles composing the agent

Definition at line 29 of file Spherus.h.

real Spherus::rocketActivations[2]
 

Definition at line 39 of file Spherus.h.

Referenced by controll(), and Spherus().

Vector2 Spherus::rocketForces[2]
 

Definition at line 41 of file Spherus.h.

Referenced by computeDerivativesWithoutContacts(), and draw().

real Spherus::rocketForceValues[2]
 

Definition at line 40 of file Spherus.h.

Referenced by computeDerivativesWithoutContacts(), controll(), and Spherus().

real Spherus::sinAlpha
 

Definition at line 51 of file Spherus.h.

Referenced by computeDerivativesWithoutContacts(), computeMemberPositions(), and computeSinCos().

real Spherus::targetExtension
 

The target distance between the circles

Definition at line 45 of file Spherus.h.

Referenced by controll(), and Spherus().


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

Thyrix homepageUsers' guide

(C) Arxia 2004-2005