xCPS
|
#include <Turner.h>
Public Member Functions | |
Turner () | |
void | moveUp () |
void | turn_enable () |
void | turn_disable () |
void | grab () |
void | release () |
void | moveDown () |
bool | isUp () |
bool | isDown () |
void | initComm (CommSystem *comm) |
Protected Attributes | |
bool | _IsUp |
bool | _IsDown |
CommSystem * | comm |
Class that handles the Turner component of the xCPS machine. The turner itself has the moveUp(), moveDown() and turn_enable()/turn_disable() methods, to move the turner up and down, and to flip the turner over (enable()) and back (disable). On top of that, blocks can be grabbed using grab(), and released using release(). Finally, there are two booleans return methods to check if the turner is up (isUp()) or is down (isDown()).
Turner::Turner | ( | ) |
Intializes the turner. Both the 'up' and 'down' booleans are set to false at the start, since it is not possible to call a sensor read in the constructor of the xCPS class (where this will be called). This should be taken into account when checking any of the positions.
void Turner::grab | ( | ) |
Enables the gripper of the turner. Additionally, sensor data is checked afterwards to ensure that the gripper has properly closed. The gripper will stay closed until release() is called.
void Turner::initComm | ( | CommSystem * | communication | ) |
bool Turner::isDown | ( | ) |
Returns the 'answer' to the question: is the Turner down? (If yes, it will return true, otherwise it will return false)
bool Turner::isUp | ( | ) |
Returns the 'answer' to the question: is the Turner up? (If yes, it will return true, otherwise it will return false)
void Turner::moveDown | ( | ) |
Moves turner down. Afterwards, checks the sensor input to check when the turner has reached the 'down' position. Then, the 'move down' bit will be set back to 0 to avoid interference with possible future moving up.
void Turner::moveUp | ( | ) |
Moves turner up. Afterwards, checks the sensor input to check when the turner has reached the 'up' position. Then, the 'move up' bit will be set back to 0 to avoid interference with possible future moving down.
void Turner::release | ( | ) |
Releases the gripper of the turner. Additionally, sensor data is checked afterwards to ensure that the gripper has properly opened.
void Turner::turn_disable | ( | ) |
Turns the turner back (180 degrees) from the 'turned' state to its original position. Note that there is no sensor data available to check if the turner has been flipped. Therefore, a usleep command of about 150 ms is advised to prevent moving the turner before flipping has completed.
void Turner::turn_enable | ( | ) |
Turns the turner 180 degrees. Since the turner can only rotate back from this position, turn_disable should be called to turn it back. Note that there is no sensor data available to check if the turner has been flipped. Therefore, a usleep command of about 150 ms is advised to prevent moving the turner before flipping has completed.