xCPS
Public Member Functions | Protected Attributes | List of all members
Arm Class Reference

#include <Arm.h>

Collaboration diagram for Arm:
Collaboration graph

Public Member Functions

 Arm (int armnumber)
 
void move (char axis, int position)
 
void enableArm ()
 
void grab ()
 
void release ()
 
void initComm (CommSystem &communication)
 
bool isReady ()
 

Protected Attributes

int _number
 
bool _ready
 
CommSystemcomm
 

Detailed Description

Author
Max Houwing
Date
November 23rd, 2015

This class offers functionality to control the arms of xCPS machine. There are 2 arms: Arm 1 (Left arm when looking from the computer side) and Arm 2 (Right arm). The protocol of these arms requires the arms to be enable first, by setting the control and power (or output) bit of the arms. This can be achieved using the enableArm() method (or arm_enable() in the class xCPS). Enabling the arm is also done in the init method of the xCPS class, so doing so manually is not strictly necessary. Moving the arm can be done using the move() (or arm_move() in the xCPS) method, which requires an axis as input, as well as an (integer) position. Furthermore, the grippers of the arms can be operating using the grab() (or arm_grab) and release() (or arm_release) methods, which grab and release a block, respectively.

Warning
Arm is not ready for movement until enableArm() is called (happens in the xCPS.init() method!)

Constructor & Destructor Documentation

Arm::Arm ( int  armnumber)

Initializes the arm. Since even on the same arm different cards and masks are used, no predefined masks are used. These are instead contained in if/else statements in the move() method. Furthermore, just initializing the arm won't be enough to turn it to 'ready'. Also enableArm() need to be called (however, this is done in the xCPS class init() method!).

Member Function Documentation

void Arm::enableArm ( )

Enables the arm, by moving it to its homing position. Please ensure that the arms are already somewhere near their home position to avoid errors! Note that the bits for the X-axes and the other 2 two axes have a (name) difference: Output bit/Power bit. As far as known, these bit have exactly the same function, so the name difference is not quite clear.

void Arm::grab ( )

Enables the gripper of the arm, allowing the arm to grab on to blocks. Note that the gripper will stay enabled (closed) until release() is called.

void Arm::initComm ( CommSystem communication)

Initializes the commmunication between the Arm and the xCPS system. This function is called in the init() function of the xCPS class, and should otherwise only be used if the usage is known!

bool Arm::isReady ( )

Returns the readiness of the arm for movement. This bool can be used as an indicator for whether a (movement) action is still going on, but should mainly be used to check whether the arms have been enabled.

void Arm::move ( char  axis,
int  position 
)

Move the arm along the specified axis to the specified position. These positions are pre-defined integers, and will overwrite any previous positions instead of adding to them. The axes that can be used are 'x', 'y' and 'z'.

void Arm::release ( )

Disables the gripper of the arm, releasing any block that it might be holding on to.


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