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

PhysicalObject Class Reference

#include <PhysicalObject.h>

Inheritance diagram for PhysicalObject:

GraphicalObject Border CappedRectangle Circle ComposedPhysicalObject Elastoid Spherus VisualSensor ArticulatedComponent Pac ArticulatedAgentBase ArticulatedLink ArticulatedAgentQuasistatic Iunctus List of all members.

Public Member Functions

Public Attributes

Protected Attributes


Detailed Description

A physical object has the following properties: position r, velocity v, mass m, angle alpha, angular velocity omega. The linear properties are the properties of the center of mass, relative to the laboratory reference system. The rotational properties refer to the rotation around the z axis that passes through the center of mass of the object, relative to the laboratory reference system.

The object can have tactile sensors distributed on its surface. nSensors is the number of tactile sensors. The tactile sensors have a maximum activation (1) for a force greater than saturationForce.

Definition at line 26 of file PhysicalObject.h.


Constructor & Destructor Documentation

PhysicalObject::PhysicalObject std::string  label = "",
int  nSensors = 0,
real  saturationForce = 0.5,
Color  outlineColor = GUI::colorBlack,
Color  fillColor = GUI::colorTransparent
 

Default constructor; initializes everything with 0.

Definition at line 8 of file PhysicalObject.cpp.

References activations, alpha, boxMax, boxMin, externalTorque, I, m, omega, parent, real, relativeAlpha, and Vector2::setXY().

PhysicalObject::~PhysicalObject  )  [virtual]
 

Destructor; purges the lists.

Definition at line 33 of file PhysicalObject.cpp.

References activations, and deleteContacts().


Member Function Documentation

void PhysicalObject::addContact ContactInfo contact  )  [inline]
 

Adds given contact to the contact list.

Definition at line 116 of file PhysicalObject.h.

Referenced by ContactInfo::setupObject().

virtual void PhysicalObject::computeBox  )  [inline, virtual]
 

Computes the coordinates of the bounding box. It is called after each call to integrate() or rollback().

Reimplemented in CappedRectangle, and Circle.

Definition at line 83 of file PhysicalObject.h.

Referenced by ComposedPhysicalObject::computeMemberPositions(), integrate(), and rollback().

void PhysicalObject::computeDerivatives GlobalContactInfoVector globalContacts  )  [virtual]
 

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

Reimplemented in Spherus, Elastoid, and ArticulatedAgentQuasistatic.

Definition at line 80 of file PhysicalObject.cpp.

References contacts, ContactInfo::force, ContactInfo::n, omega, ContactInfo::pxn, setSensors(), ContactInfo::sigma, and v.

Referenced by Spherus::computeDerivatives().

void PhysicalObject::computeDerivativesWithoutContacts ContactSolver contactSolver  )  [virtual]
 

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

Reimplemented in Spherus, Border, Elastoid, and ArticulatedAgentQuasistatic.

Definition at line 71 of file PhysicalObject.cpp.

References externalForce, externalTorque, omega, Vector2::setToZero(), and v.

Referenced by Spherus::computeDerivativesWithoutContacts().

virtual void PhysicalObject::computeInertia  )  [inline, virtual]
 

Computes the moment of inertia around the z axis that passes through the center, based on the mass and the geometrical properties. To be overridden.

Reimplemented in CappedRectangle, and Circle.

Definition at line 65 of file PhysicalObject.h.

References I.

virtual void PhysicalObject::computeMass real  density = ThyrixParameters::defaultDensity  )  [inline, virtual]
 

Sets the mass based on the density. To be overridden.

Reimplemented in CappedRectangle, and Circle.

Definition at line 61 of file PhysicalObject.h.

References m.

virtual void PhysicalObject::controll  )  [inline, 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 in Iunctus, Spherus, and Pac.

Definition at line 102 of file PhysicalObject.h.

Referenced by Simulator::controll().

void PhysicalObject::deleteContacts  )  [virtual]
 

Delete the contacts of the object.

Reimplemented in Iunctus, Spherus, Elastoid, ArticulatedAgentBase, and ArticulatedLink.

Definition at line 43 of file PhysicalObject.cpp.

References contacts, purgeContainer(), and resetSensors().

Referenced by Spherus::deleteContacts(), Iunctus::deleteContacts(), ArticulatedLink::deleteContacts(), ArticulatedAgentBase::deleteContacts(), and ~PhysicalObject().

virtual bool PhysicalObject::detectContacts CappedRectangle object,
GlobalContactInfoVector contacts
[inline, virtual]
 

Reimplemented in CappedRectangle, and VisualSensor.

Definition at line 47 of file PhysicalObject.h.

References detectContacts().

virtual bool PhysicalObject::detectContacts Circle object,
GlobalContactInfoVector contacts
[inline, virtual]
 

Reimplemented in CappedRectangle, Circle, and VisualSensor.

Definition at line 44 of file PhysicalObject.h.

References detectContacts().

virtual bool PhysicalObject::detectContacts Border object,
GlobalContactInfoVector contacts
[inline, virtual]
 

Reimplemented in Border, CappedRectangle, Circle, and VisualSensor.

Definition at line 41 of file PhysicalObject.h.

References detectContacts().

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

Contact handling.

Implemented in Spherus, Border, CappedRectangle, Circle, ComposedPhysicalObject, Elastoid, VisualSensor, and ArticulatedAgentBase.

Referenced by VisualSensor::detectContacts(), Simulator::detectContacts(), detectContacts(), Circle::detectContacts(), CappedRectangle::detectContacts(), and Border::detectContacts().

virtual void PhysicalObject::detectInternalContacts GlobalContactInfoVector globalContacts  )  [inline, 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 in Spherus, Elastoid, and ArticulatedAgentBase.

Definition at line 107 of file PhysicalObject.h.

virtual bool PhysicalObject::detectMouseContact const Vector2 rMouse,
Vector2 p,
PhysicalObject *&  object
[inline, 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 in Spherus, CappedRectangle, Circle, ComposedPhysicalObject, Elastoid, and ArticulatedAgentBase.

Definition at line 133 of file PhysicalObject.h.

void PhysicalObject::drawContactForces GUI gui  ) 
 

Draws the contact forces.

Definition at line 135 of file PhysicalObject.cpp.

References contacts, GUI::drawForce(), ContactInfo::force, ContactInfo::n, ContactInfo::p, r, and ContactInfo::sigma.

void PhysicalObject::fillContactMatrix ContactSolver contactSolver,
ContactInfo contact
[virtual]
 

Computes the contribution of the current object to the matrix of interactions between all objects that are in contact.

Reimplemented in Border, ArticulatedAgentBase, and ArticulatedLink.

Definition at line 95 of file PhysicalObject.cpp.

References ContactInfo::alpha, ContactSolver::contactMatrix, contacts, ContactSolver::contactVector, Vector2::cross(), ContactInfo::n, omega, ContactInfo::p, ContactInfo::pxn, and ContactInfo::sigma.

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

Advances the time to the next timestep.

Reimplemented in Spherus, Border, ComposedPhysicalObject, Elastoid, ArticulatedAgentQuasistatic, and ArticulatedLink.

Definition at line 56 of file PhysicalObject.cpp.

References alpha, alphaOld, computeBox(), Integrator::integrate(), normalizeAlpha(), omega, r, rOld, and v.

Referenced by Spherus::integrate(), and ComposedPhysicalObject::integrate().

virtual int PhysicalObject::isCircle  )  [inline, virtual]
 

Verifies if the object has circular symmetry; in this case, computations of rotational properties can be skipped, on various occasions. By default, returns 0 (not symmetrical). To be overridden by symmetrical objects (Circle).

Reimplemented in Circle.

Definition at line 70 of file PhysicalObject.h.

void PhysicalObject::normalizeAlpha  )  [inline]
 

Normalizes Alpha to a value between 0 and 2 PI.

Definition at line 203 of file PhysicalObject.h.

References alpha.

Referenced by integrate().

void PhysicalObject::registerPrimitives Simulator simulator  )  [virtual]
 

Registers all composing primitives of the object with the simulator.

Reimplemented in ComposedPhysicalObject, Elastoid, and ArticulatedAgentBase.

Definition at line 39 of file PhysicalObject.cpp.

References Simulator::registerPrimitive().

Referenced by Simulator::registerObject().

void PhysicalObject::resetSensors  )  [virtual]
 

Resets tactile sensors to zero.

Reimplemented in ComposedPhysicalObject.

Definition at line 48 of file PhysicalObject.cpp.

References activations.

Referenced by deleteContacts(), and ComposedPhysicalObject::resetSensors().

void PhysicalObject::rollback  )  [virtual]
 

Rolls back the time to the previous timestep.

Reimplemented in Border, ComposedPhysicalObject, ArticulatedAgentQuasistatic, and ArticulatedLink.

Definition at line 65 of file PhysicalObject.cpp.

References alpha, computeBox(), and r.

Referenced by ComposedPhysicalObject::rollback().

void PhysicalObject::setMass real  m  )  [inline]
 

Sets the mass m of the object.

Definition at line 58 of file PhysicalObject.h.

void PhysicalObject::setPosition real  x,
real  y
[inline]
 

Sets the position r of the object.

Definition at line 52 of file PhysicalObject.h.

References r, Vector2::x, and Vector2::y.

virtual void PhysicalObject::setSensor ContactInfo contact  )  [inline, virtual]
 

Sets the activation of a tactile sensor, corresponding to the given contact. To be overridden.

Reimplemented in CappedRectangle, and Circle.

Definition at line 98 of file PhysicalObject.h.

Referenced by setSensors(), and ComposedPhysicalObject::setSensors().

void PhysicalObject::setSensors  )  [virtual]
 

Sets the activations of the tactile sensors, on the basis of the contact forces related to the contacts of the object with other objects.

Reimplemented in ComposedPhysicalObject.

Definition at line 126 of file PhysicalObject.cpp.

References contacts, and setSensor().

Referenced by computeDerivatives().

void PhysicalObject::setVelocity real  vx,
real  vy
[inline]
 

Sets the velocity v of the object.

Definition at line 55 of file PhysicalObject.h.

References v, Vector2::x, and Vector2::y.


Member Data Documentation

real* PhysicalObject::activations
 

A vector containing the activations of the sensors.

Definition at line 193 of file PhysicalObject.h.

Referenced by PhysicalObject(), resetSensors(), and ~PhysicalObject().

real PhysicalObject::alpha
 

Rotation angle around center of mass relative to the LRS

Definition at line 149 of file PhysicalObject.h.

Referenced by Simulator::applyMouseForce(), ArticulatedAgentQuasistatic::backwardDynamics(), VisualSensor::computeGamma(), ComposedPhysicalObject::computeMemberPositions(), VisualSensor::draw(), Iunctus::draw(), ArticulatedAgentQuasistatic::forwardAccelerations(), ArticulatedAgentQuasistatic::forwardKinematics(), Simulator::indexContacts(), Spherus::integrate(), integrate(), normalizeAlpha(), PhysicalObject(), and rollback().

real PhysicalObject::alphaOld
 

Value of alpha at the previous timestep.

Definition at line 152 of file PhysicalObject.h.

Referenced by ComposedPhysicalObject::computeMemberPositions(), and integrate().

Vector2 PhysicalObject::boxMax
 

Minimum coordinates of the axis-aligned bounding box surrounding the object.

Definition at line 184 of file PhysicalObject.h.

Referenced by ComposedPhysicalObject::computeMemberPositions(), ArticulatedAgentQuasistatic::integrate(), PhysicalObject(), and ArticulatedAgentQuasistatic::rollback().

Vector2 PhysicalObject::boxMin
 

Minimum coordinates of the axis-aligned bounding box surrounding the object.

Definition at line 181 of file PhysicalObject.h.

Referenced by ComposedPhysicalObject::computeMemberPositions(), ArticulatedAgentQuasistatic::integrate(), PhysicalObject(), ArticulatedAgentQuasistatic::rollback(), and Simulator::sortObjects().

ContactInfoPVector PhysicalObject::contacts
 

The list of contacts that act on the object. The list owns the contacts.

Definition at line 187 of file PhysicalObject.h.

Referenced by ArticulatedAgentQuasistatic::backwardDynamics(), computeDerivatives(), deleteContacts(), drawContactForces(), fillContactMatrix(), ArticulatedAgentQuasistatic::forwardAccelerations(), and setSensors().

Vector2 PhysicalObject::externalForce
 

The sum of external forces acting on the object

Definition at line 161 of file PhysicalObject.h.

Referenced by ElasticLink::applyForces(), Simulator::applyMouseForce(), ArticulatedAgentQuasistatic::backwardDynamics(), Spherus::computeDerivativesWithoutContacts(), and computeDerivativesWithoutContacts().

real PhysicalObject::externalTorque
 

The sum of external torques acting on the object

Definition at line 164 of file PhysicalObject.h.

Referenced by Simulator::applyMouseForce(), ArticulatedAgentQuasistatic::backwardDynamics(), computeDerivativesWithoutContacts(), and PhysicalObject().

real PhysicalObject::I
 

Moment of inertia for rotation around the z axis that passes through the center of mass.

Definition at line 158 of file PhysicalObject.h.

Referenced by computeInertia(), ComposedPhysicalObject::computeMassProperties(), and PhysicalObject().

std::string PhysicalObject::label
 

A text label for the object; used primarily for debugging.

Definition at line 190 of file PhysicalObject.h.

Referenced by ComposedPhysicalObject::addObject().

real PhysicalObject::m
 

Mass

Definition at line 146 of file PhysicalObject.h.

Referenced by Spherus::computeCircleProprioception(), computeMass(), ComposedPhysicalObject::computeMassProperties(), and PhysicalObject().

int PhysicalObject::nSensors [protected]
 

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

Reimplemented in Spherus.

Definition at line 200 of file PhysicalObject.h.

real PhysicalObject::omega
 

Angular velocity around center of mass relative to the LRS

Definition at line 155 of file PhysicalObject.h.

Referenced by computeDerivatives(), computeDerivativesWithoutContacts(), fillContactMatrix(), ArticulatedAgentQuasistatic::forwardAccelerations(), integrate(), and PhysicalObject().

PhysicalObject* PhysicalObject::parent
 

The parent of the object. It is NULL for simple objects, not NULL for objects that are members of composed objects.

Definition at line 168 of file PhysicalObject.h.

Referenced by ComposedPhysicalObject::addObject(), PhysicalObject(), and ContactInfo::setupObject().

Vector2 PhysicalObject::r
 

Position of the center of mass of the object relative to laboratory reference system (LRS)

Definition at line 137 of file PhysicalObject.h.

Referenced by ElasticLink::applyForces(), Simulator::applyMouseForce(), Spherus::computeMemberPositions(), ComposedPhysicalObject::computeMemberPositions(), Spherus::computeState(), VisualSensor::detectContacts(), Circle::detectContacts(), CappedRectangle::detectContacts(), VisualSensor::draw(), Spherus::draw(), Iunctus::draw(), ElasticLink::draw(), drawContactForces(), ArticulatedAgentQuasistatic::forwardKinematics(), integrate(), rollback(), setPosition(), and ContactInfo::setupObject().

real PhysicalObject::relativeAlpha
 

The rotation of the member object relative to the reference system of the composed object (ORS), for objects that are members of composed objects.

Definition at line 178 of file PhysicalObject.h.

Referenced by ComposedPhysicalObject::addObject(), ComposedPhysicalObject::computeMemberPositions(), and PhysicalObject().

Vector2 PhysicalObject::relativeR
 

The position of the member object relative to the reference system of the composed object (ORS), for objects that are members of composed objects.

Definition at line 173 of file PhysicalObject.h.

Referenced by ComposedPhysicalObject::addObject(), ComposedPhysicalObject::computeMassProperties(), and ComposedPhysicalObject::computeMemberPositions().

Vector2 PhysicalObject::rOld
 

Value of r at the previous timestep.

Definition at line 140 of file PhysicalObject.h.

Referenced by ComposedPhysicalObject::computeMemberPositions(), and integrate().

real PhysicalObject::saturationForce
 

The saturation contact force for contact sensors

Definition at line 196 of file PhysicalObject.h.

Vector2 PhysicalObject::v
 

Velocity relative to the LRS

Definition at line 143 of file PhysicalObject.h.

Referenced by ArticulatedAgentQuasistatic::backwardDynamics(), Spherus::computeCircleProprioception(), computeDerivatives(), computeDerivativesWithoutContacts(), ArticulatedAgentQuasistatic::forwardAccelerations(), integrate(), and setVelocity().


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

Thyrix homepageUsers' guide

(C) Arxia 2004-2005