The class modelling the motor for the attachment device of the MarXbot. More...
Public Types | |
enum | Status { Open, HalfClosed, Closed } |
The possible status of the attachment device. See class description for more information. More... | |
Public Types inherited from Ownable | |
typedef QList< Owned > | OwnedList |
The type for the list of owned objects. More... | |
Public Member Functions | |
MarXbotAttachmentDeviceMotorController (PhyMarXbot *robot) | |
Constructor. More... | |
virtual | ~MarXbotAttachmentDeviceMotorController () |
Destructor. More... | |
PhyMarXbot * | attachedRobot () |
Returns the robot to which we are attached. More... | |
const PhyMarXbot * | attachedRobot () const |
Returns the robot to which we are attached (const version) More... | |
bool | attachedToRobot () const |
Returns true if we are attached to another robot. More... | |
bool | attachmentDeviceEnabled () const |
Returns true if the attachment device is enabled. More... | |
bool | attachmentPossible () const |
Returns true if this robot is near enough to another robot to attach to it. More... | |
double | getDesiredPosition () const |
Returns the desired position of the attachment device. More... | |
Status | getDesiredStatus () const |
Returns the desired status of the attachment device. More... | |
double | getDesiredVelocity () const |
Returns the desired velocity of the attachment device. More... | |
double | getMaxVelocity () const |
Returns the maximum speed at which the attachment device can move. More... | |
double | getPosition () const |
Returns the current position of the attachment device. More... | |
Status | getStatus () const |
Returns the current status of the attachment device. More... | |
double | getVelocity () const |
Returns the current velocity of the attachment device. More... | |
QVector< PhyMarXbot * > | otherAttachedRobots () |
Returns the list of all robots that are attached to us. More... | |
bool | otherAttachedToUs () const |
Returns true if there are robots that are attached to us. More... | |
void | setDesiredPosition (double pos) |
Sets the desired position of the attachment device. More... | |
void | setDesiredStatus (Status status) |
Changes the status of the attachment device. More... | |
void | setDesiredVelocity (double vel) |
Sets the desired velocity of the attachment device. More... | |
void | setMaxVelocity (double speed) |
Sets the maximum speed at which the attachment device can move. More... | |
virtual void | update () |
The method updating the attachment device at each timestep. More... | |
Public Member Functions inherited from MotorController | |
MotorController (World *world) | |
constructor More... | |
virtual | ~MotorController () |
Destructor. More... | |
bool | isEnabled () |
return true is if enable (hence if it is on) More... | |
void | setEnabled (bool b) |
Enable/Disable this motorcontroller. More... | |
World * | world () |
return the world 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... | |
Ownable * | owner () const |
Returns the owner of this object. More... | |
void | setOwner (Ownable *owner, bool destroy=true) |
Sets the owner of this object. More... | |
Friends | |
class | PhyMarXbot |
The PhyMarXbot class is friend to call the attachmentDeviceAboutToBeDestroyed() function. More... | |
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 284 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 291 of file motorcontrollers.h.
Constructor & Destructor Documentation
MarXbotAttachmentDeviceMotorController | ( | PhyMarXbot * | robot | ) |
Constructor.
- Parameters
-
robot the robot whose attachment device we control (must not be NULL)
Definition at line 482 of file motorcontrollers.cpp.
|
virtual |
Destructor.
Definition at line 493 of file motorcontrollers.cpp.
Member Function Documentation
|
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 446 of file motorcontrollers.h.
|
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 458 of file motorcontrollers.h.
|
inline |
Returns true if we are attached to another robot.
- Returns
- true if we are attached to another robot
Definition at line 434 of file motorcontrollers.h.
Referenced by MarXbotAttachmentDeviceMotorController::setDesiredPosition(), and MarXbotAttachmentDeviceMotorController::setDesiredVelocity().
bool attachmentDeviceEnabled | ( | ) | const |
Returns true if the attachment device is enabled.
To enable/disable the attachment device you must use the PhyMarXbot methods
- Returns
- true if the attachment device is enabled, false otherwise
Definition at line 582 of file motorcontrollers.cpp.
References PhyMarXbot::attachmentDeviceEnabled().
Referenced by MarXbotAttachmentDeviceMotorController::getDesiredPosition(), MarXbotAttachmentDeviceMotorController::getDesiredVelocity(), MarXbotAttachmentDeviceMotorController::getMaxVelocity(), MarXbotAttachmentDeviceMotorController::getPosition(), MarXbotAttachmentDeviceMotorController::getVelocity(), MarXbotAttachmentDeviceMotorController::setDesiredPosition(), MarXbotAttachmentDeviceMotorController::setDesiredStatus(), MarXbotAttachmentDeviceMotorController::setDesiredVelocity(), and MarXbotAttachmentDeviceMotorController::setMaxVelocity().
|
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 424 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 610 of file motorcontrollers.cpp.
References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().
|
inline |
Returns the desired status of the attachment device.
- Returns
- the desired status of the attachment device
Definition at line 400 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 635 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 594 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 619 of file motorcontrollers.cpp.
References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().
|
inline |
Returns the current status of the attachment device.
- Returns
- the current status of the attachment device
Definition at line 410 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 644 of file motorcontrollers.cpp.
References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().
|
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 480 of file motorcontrollers.h.
|
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 469 of file motorcontrollers.h.
void setDesiredPosition | ( | double | pos | ) |
Sets the desired position of the attachment device.
- Parameters
-
pos the desired position of the attachment device (in radiants)
Definition at line 603 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
-
status the desired status of the attachment device
Definition at line 653 of file motorcontrollers.cpp.
References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled().
void setDesiredVelocity | ( | double | vel | ) |
Sets the desired velocity of the attachment device.
- Parameters
-
vel the desidered velocity of the attachment device (in rad/sec)
Definition at line 628 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
-
speed the maximum speed at which the attachment device can move (in rad/sec)
Definition at line 587 of file motorcontrollers.cpp.
References MarXbotAttachmentDeviceMotorController::attachmentDeviceEnabled(), PhyMarXbot::attachmentDeviceJoint(), and PhyJoint::dofs().
|
virtual |
The method updating the attachment device at each timestep.
Implements MotorController.
Definition at line 499 of file motorcontrollers.cpp.
References PhyMarXbot::attachmentDevice(), PhyMarXbot::attachmentDeviceController(), PhyJoint::dofs(), and PhyMarXbot::turret().
Referenced by PhyMarXbot::preUpdate().
Friends And Related Function Documentation
|
friend |
The PhyMarXbot class is friend to call the attachmentDeviceAboutToBeDestroyed() function.
Definition at line 544 of file motorcontrollers.h.
The documentation for this class was generated from the following files:
- worldsim/include/motorcontrollers.h
- worldsim/src/motorcontrollers.cpp