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

#include <Turner.h>

Collaboration diagram for Turner:
Collaboration graph

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
 
CommSystemcomm
 

Detailed Description

Author
Max Houwing
Date
November 23rd, 2015

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()).

Warning
There is no sensor to check whether the turner has indeed turned 180 degrees after calling turn_enable(), so sleeps are advised to prevent moving before a turn has been completed. The same holds for grabbing blocks!

Constructor & Destructor Documentation

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.

Member Function Documentation

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)

Initializes the commmunication between the Turner 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 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.


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