MarXbotAttachmentDeviceMotorController Class Reference

The class modelling the motor for the attachment device of the MarXbot. More...

Inheritance diagram for MarXbotAttachmentDeviceMotorController:

Public Types

enum  Status { Open, HalfClosed, Closed }
 The possible status of the attachment device. See class description for more information. More...
 

Public Member Functions

 MarXbotAttachmentDeviceMotorController (PhyMarXbot *robot)
 Constructor.
 
virtual ~MarXbotAttachmentDeviceMotorController ()
 Destructor.
 
PhyMarXbotattachedRobot ()
 Returns the robot to which we are attached.
 
const PhyMarXbotattachedRobot () const
 Returns the robot to which we are attached (const version)
 
bool attachedToRobot () const
 Returns true if we are attached to another robot.
 
bool attachmentDeviceEnabled () const
 Returns true if the attachment device is enabled.
 
bool attachmentPossible () const
 Returns true if this robot is near enough to another robot to attach to it.
 
double getDesiredPosition () const
 Returns the desired position of the attachment device.
 
Status getDesiredStatus () const
 Returns the desired status of the attachment device.
 
double getDesiredVelocity () const
 Returns the desired velocity of the attachment device.
 
double getMaxVelocity () const
 Returns the maximum speed at which the attachment device can move.
 
double getPosition () const
 Returns the current position of the attachment device.
 
Status getStatus () const
 Returns the current status of the attachment device.
 
double getVelocity () const
 Returns the current velocity of the attachment device.
 
QVector< PhyMarXbot * > otherAttachedRobots ()
 Returns the list of all robots that are attached to us.
 
bool otherAttachedToUs () const
 Returns true if there are robots that are attached to us.
 
void setDesiredPosition (double pos)
 Sets the desired position of the attachment device.
 
void setDesiredStatus (Status status)
 Changes the status of the attachment device.
 
void setDesiredVelocity (double vel)
 Sets the desired velocity of the attachment device.
 
void setMaxVelocity (double speed)
 Sets the maximum speed at which the attachment device can move.
 
virtual void update ()
 The method updating the attachment device at each timestep.
 
- Public Member Functions inherited from MotorController
 MotorController (World *world)
 constructor
 
virtual ~MotorController ()
 Destructor.
 
bool isEnabled ()
 return true is if enable (hence if it is on)
 
void setEnabled (bool b)
 Enable/Disable this motorcontroller.
 
Worldworld ()
 return the world
 
- Public Member Functions inherited from Ownable
 Ownable ()
 Constructor.
 
virtual ~Ownable ()
 Destructor.
 
const QList< Owned > & owned () const
 Returns the list of objects owned by this one.
 
Ownableowner () const
 Returns the owner of this object.
 
void setOwner (Ownable *owner, bool destroy=true)
 Sets the owner of this object.
 

Friends

class PhyMarXbot
 The PhyMarXbot class is friend to call the attachmentDeviceAboutToBeDestroyed() function.
 

Detailed Description

The class modelling the motor for the attachment device of the MarXbot.

This class models the motors for the attachment device of the MarXbot. The device has two degrees of freedom: the orientation (i.e. where it is relative to the robot turret) and the status, that is whether the device is open, half-closed or closed. Regarding orientation, it is possible to control it by position or by velocity. In both cases the movement is never faster than a maximum speed (that can be changed). When the attachment device is open, it can be rotated using this motor. If it is half-closed or closed and the robot is actually attached to another robot, the motor controlling the rotation is disabled and the attachment device rotates freely. Moreover every command to the attachment device (e.g. setDesiredPosition, setDesiredVelocity...) is ignored. If instead the robot is not attached to another robot, the device behaves normally (as if the attachment device was open). Given two robots A and B, A attaches to B if the following requirements are satisfied:

  • the attachment device of A is in contact with the turret of B and the attachment device of B is far from the turret of A. In other words the two attachment devices must not be in contact;
  • the attachment device of A was in the open status in the previous timestep and is switched to half-closed or closed status in this timestep. The attachment is instantaneous (i.e. it happends in one timestep). The status of the device after the attachment determines how the two robots can move with respect to each other: if it is closed, B cannot rotate its attachment device (a fixed joint is added between the attachment device of A and the turret of B); if it is half-closed, B can rotate its attachment device with the limitation that it can collide with the attachment device of A and so a 360° rotation is not possible (a hinge is added between the attachment device of A and the turret of B). To detach, a robot simply has to change the status of its attachment device to open. This motor only works for dynamic robots. For the attachment process to be successful, both robots must be dynamical and have the attachment device enabled. If the robot attachment device is not enabled, changes to the device status are not applied

Definition at line 492 of file motorcontrollers.h.

Member Enumeration Documentation

enum Status

The possible status of the attachment device. See class description for more information.

Definition at line 499 of file motorcontrollers.h.

Constructor & Destructor Documentation

Constructor.

Parameters
robotthe robot whose attachment device we control (must not be NULL)

Definition at line 944 of file motorcontrollers.cpp.

Destructor.

Definition at line 955 of file motorcontrollers.cpp.

Member Function Documentation

PhyMarXbot* attachedRobot ( )
inline

Returns the robot to which we are attached.

If we are not attached to any robot, this returns NULL

Returns
the robot to which we are attached or NULL if we are not attached to another robot

Definition at line 654 of file motorcontrollers.h.

const PhyMarXbot* attachedRobot ( ) const
inline

Returns the robot to which we are attached (const version)

If we are not attached to any robot, this returns NULL

Returns
the robot to which we are attached or NULL if we are not attached to another robot

Definition at line 666 of file motorcontrollers.h.

bool attachedToRobot ( ) const
inline

Returns true if we are attached to another robot.

Returns
true if we are attached to another robot

Definition at line 642 of file motorcontrollers.h.

Referenced by MarXbotAttachmentDeviceMotorController::setDesiredPosition(), and MarXbotAttachmentDeviceMotorController::setDesiredVelocity().

bool attachmentPossible ( ) const
inline

Returns true if this robot is near enough to another robot to attach to it.

This function only check whether this robot is near enough to another robot and the attachment device is in the right direction. It doesn't check if the status of the attachment device is the right one for attaching or not

Definition at line 632 of file motorcontrollers.h.

double getDesiredPosition ( ) const

Returns the desired position of the attachment device.

Returns
the desired position of the attachment device

Definition at line 1072 of file motorcontrollers.cpp.

References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().

Status getDesiredStatus ( ) const
inline

Returns the desired status of the attachment device.

Returns
the desired status of the attachment device

Definition at line 608 of file motorcontrollers.h.

double getDesiredVelocity ( ) const

Returns the desired velocity of the attachment device.

Returns
the desired velocity of the attachment device

Definition at line 1097 of file motorcontrollers.cpp.

References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().

double getMaxVelocity ( ) const

Returns the maximum speed at which the attachment device can move.

Returns
the maximum speed at which the attachment device can move (in rad/sec)

Definition at line 1056 of file motorcontrollers.cpp.

References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().

double getPosition ( ) const

Returns the current position of the attachment device.

Returns
the current position of the attachment device (in radiants)

Definition at line 1081 of file motorcontrollers.cpp.

References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().

Status getStatus ( ) const
inline

Returns the current status of the attachment device.

Returns
the current status of the attachment device

Definition at line 618 of file motorcontrollers.h.

double getVelocity ( ) const

Returns the current velocity of the attachment device.

Returns
the current velocity of the attachment device (in rad/sec)

Definition at line 1106 of file motorcontrollers.cpp.

References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().

QVector<PhyMarXbot*> otherAttachedRobots ( )
inline

Returns the list of all robots that are attached to us.

This list doesn't contain the robot to which we are attached

Returns
the list of all robots that are attached to us

Definition at line 688 of file motorcontrollers.h.

bool otherAttachedToUs ( ) const
inline

Returns true if there are robots that are attached to us.

This does not include the robot to which we are attached

Returns
true if there are robots that are attached to us

Definition at line 677 of file motorcontrollers.h.

void setDesiredPosition ( double  pos)

Sets the desired position of the attachment device.

Parameters
posthe desired position of the attachment device (in radiants)

Definition at line 1065 of file motorcontrollers.cpp.

References MarXbotAttachmentDeviceMotorController::attachedToRobot(), MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().

void setDesiredStatus ( Status  status)

Changes the status of the attachment device.

If the attachment device is already at the desired status, nothing happends

Parameters
statusthe desired status of the attachment device

Definition at line 1115 of file motorcontrollers.cpp.

References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled().

void setDesiredVelocity ( double  vel)

Sets the desired velocity of the attachment device.

Parameters
velthe desidered velocity of the attachment device (in rad/sec)

Definition at line 1090 of file motorcontrollers.cpp.

References MarXbotAttachmentDeviceMotorController::attachedToRobot(), MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().

void setMaxVelocity ( double  speed)

Sets the maximum speed at which the attachment device can move.

Parameters
speedthe maximum speed at which the attachment device can move (in rad/sec)

Definition at line 1049 of file motorcontrollers.cpp.

References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().

void update ( )
virtual

The method updating the attachment device at each timestep.

Implements MotorController.

Definition at line 961 of file motorcontrollers.cpp.

References PhyMarXbot::attachmentDevice(), PhyMarXbot::attachmentDeviceController(), PhyJoint::dofs(), and PhyMarXbot::turret().

Referenced by PhyMarXbot::preUpdate().

Friends And Related Function Documentation

friend class PhyMarXbot
friend

The PhyMarXbot class is friend to call the attachmentDeviceAboutToBeDestroyed() function.

Definition at line 752 of file motorcontrollers.h.


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