xCPS
|
#include <PickPlace.h>
Public Member Functions | |
PickPlace () | |
void | Vacuum (bool state) |
void | MoveUp () |
void | MoveDown () |
void | Extend () |
void | Retract () |
bool | isUp () |
bool | isExt () |
bool | isRetract () |
void | initComm (CommSystem *communication) |
Protected Attributes | |
bool | _IsUp |
bool | _HorExt |
bool | _HorRetract |
CommSystem * | comm |
This is the class that controls the Pick & Place (P&P) of the xCPS machine. All of the directions are used, through the moveUp() and moveDown() methods, which move the P&P up and down, respectively, as well as the extend() and retract() ones, which horizontally extend and retract the P&P. Furthermore, the vacuum can be controlled using a boolean as an argument, allowing the P&P to grab onto and release blocks. Finally, there are three methods that return a boolean: isUp(), isExt() and isRetract(). These return the state of the P&P, namely whether it is up, extended or retract.
PickPlace::PickPlace | ( | ) |
Initializes the Pick & Place class. The booleans that show the current position/state of the system are initialized here, by checking the current sensor inputs.
void PickPlace::Extend | ( | ) |
Moves the Pick & Place (horizontally) outwards, placing it above the location of the index table. Also checks the sensor input to ensure that it has moved as desired. The 'Extend' bit is then written 0 again, to avoid interfering with possible retracting in the future.
bool PickPlace::isExt | ( | ) |
Checks if the Pick & Place is extended. If it turns out the class has just been initialized, this is done on the basis of sensor data. Otherwise, the boolean _HorExt is simply used. Returns true if the Pick & Place is indeed extended.
bool PickPlace::isRetract | ( | ) |
Checks if the Pick & Place is retracted. If it turns out the class has just been initialized, this is done on the basis of sensor data. Otherwise, the boolean _HorRetract is simply used. Returns true if the Pick & Place is indeed retracted.
bool PickPlace::isUp | ( | ) |
Checks if the Pick & Place is up. If it turns out the class has just been initialized, this is done on the basis of sensor data. Otherwise, the boolean _IsUp is simply used. Returns true if the Pick & Place is indeed up.
void PickPlace::MoveDown | ( | ) |
Moves the Pick & Place (vertically) down. Furthermore, checks the sensor input to confirm that the Pick&Place has reached the 'down' position. Then, the 'MoveDown' bit is written 0 again, to avoid interfering with possible moving up in the future.
void PickPlace::MoveUp | ( | ) |
Moves the Pick & Place (vertically) up. Furthermore, checks the sensor input to confirm that the Pick&Place has reached the 'up' position. Then, the 'MoveUp' bit is written 0 again, to avoid interfering with possible moving down in the future.
void PickPlace::Retract | ( | ) |
Moves the Pick & Place (horizontally) inwards, placing it above the location of the belt (Belt 3). Also checks the sensor input to ensure that it has moved as desired. The 'Retract' bit is then written 0 again, to avoid interfering with possible extending in the future.
void PickPlace::Vacuum | ( | bool | state | ) |
Turns the vacuum of the Pick & Place, which is used to 'grab' blocks, on or off, depending on the input boolean 'state'. Note that when (for example) calling vacuum(true), the vacuum will stay on until vacuum(false) is called.