HLR  0.0.1
Public Types | Public Member Functions | List of all members
HLR::Kinematics::RobotController Class Reference

This class contains the main logic of the robotic arm. It handles the calculation of robotic path and handles moving the robot arm using the driver. More...

#include <RobotController.hpp>

Collaboration diagram for HLR::Kinematics::RobotController:

Public Types

enum  Event {
  Event::move_to_ready, Event::pick_up_cup, Event::move_stop, Event::move_continue,
  Event::move_cancel, Event::arm_move_complete, Event::terminate
}
 Internal event class. These events are send to the worker thread and handled accordingly. More...
 

Public Member Functions

 RobotController (RobotDriverHandler &driver)
 Constructor. More...
 
virtual ~RobotController ()
 Destructor.
 
 RobotController (const RobotController &rc)=delete
 Copy constructor, deleted. More...
 
 RobotController (RobotController &&rc)=delete
 Move constructor, deleted. More...
 
RobotControlleroperator= (const RobotController &rc)=delete
 Copy assignment operator, deleted. More...
 
RobotControlleroperator= (RobotController &&rc)=delete
 Move assignment operator, deleted. More...
 
RobotControllerState get_state () const
 Get the controller state. More...
 
void pick_up_cup (std::uint32_t id)
 Pick up the cup specfied by id. The specifed error callback is fired if anything goes wrong during the move operation. More...
 
void move_stop ()
 Stop the current action. This pauses the current robot arm. More...
 
void move_continue ()
 Continue the action of the robotarm when it is stopped. More...
 
void move_cancel ()
 Cancel the action of the robotarm this reverses any action the robotarm was doing. More...
 
void remove_object (const EnvironmentObject &obj)
 Remove the object with the specified if from the internal environment. More...
 
void add_object (EnvironmentObject &&obj)
 Add object to the internal environment. More...
 
void set_error_callback (const std::function< void(ArmError)> &cb)
 Set the callback that is called when the robotarm cannot accomplish the path. This can happen When there is no possible path to the target. Or the emergency stop was called due to safety concerns. Once this callback is fired the arm will be in the stopped state and can be reenabled by using move_continue. More...
 

Detailed Description

This class contains the main logic of the robotic arm. It handles the calculation of robotic path and handles moving the robot arm using the driver.

Member Enumeration Documentation

Internal event class. These events are send to the worker thread and handled accordingly.

Enumerator
move_to_ready 

Move the arm to the ready position.

pick_up_cup 

Robot arm should pick up a cup.

move_stop 

Current action should be stopped. This means robot arm will stop.

move_continue 

The previously stopped action should be resumed.

move_cancel 

The current action should be cancelled. This will move the arm.

arm_move_complete 

Signals the driver completed a move.

terminate 

The controller has to terminate.

Constructor & Destructor Documentation

HLR::Kinematics::RobotController::RobotController ( RobotDriverHandler driver)

Constructor.

Parameters
driverThe driver to inject.
HLR::Kinematics::RobotController::RobotController ( const RobotController rc)
delete

Copy constructor, deleted.

Parameters
rc
HLR::Kinematics::RobotController::RobotController ( RobotController &&  rc)
delete

Move constructor, deleted.

Parameters
rc

Member Function Documentation

void HLR::Kinematics::RobotController::add_object ( EnvironmentObject &&  obj)

Add object to the internal environment.

Parameters
objThe object to add.
RobotControllerState HLR::Kinematics::RobotController::get_state ( ) const

Get the controller state.

Returns
The current state.
void HLR::Kinematics::RobotController::move_cancel ( )

Cancel the action of the robotarm this reverses any action the robotarm was doing.

Exceptions
std::logic_errorIf the robotarm is not currently performing a move and isn't stopped.
void HLR::Kinematics::RobotController::move_continue ( )

Continue the action of the robotarm when it is stopped.

Exceptions
std::logic_errorIf the robot is not currently stopped.
void HLR::Kinematics::RobotController::move_stop ( )

Stop the current action. This pauses the current robot arm.

Exceptions
std::logic_errorIf the robot is not currently moving.
RobotController& HLR::Kinematics::RobotController::operator= ( const RobotController rc)
delete

Copy assignment operator, deleted.

Parameters
rc
Returns
RobotController& HLR::Kinematics::RobotController::operator= ( RobotController &&  rc)
delete

Move assignment operator, deleted.

Parameters
rc
Returns
void HLR::Kinematics::RobotController::pick_up_cup ( std::uint32_t  id)

Pick up the cup specfied by id. The specifed error callback is fired if anything goes wrong during the move operation.

Exceptions
std::invalid_argumentIf the cup is not found.
std::logic_errorIf the robot is currently allready performing an action.
Parameters
idThe id of the cup to pick up.
void HLR::Kinematics::RobotController::remove_object ( const EnvironmentObject obj)

Remove the object with the specified if from the internal environment.

Parameters
objThe object to remove.
void HLR::Kinematics::RobotController::set_error_callback ( const std::function< void(ArmError)> &  cb)

Set the callback that is called when the robotarm cannot accomplish the path. This can happen When there is no possible path to the target. Or the emergency stop was called due to safety concerns. Once this callback is fired the arm will be in the stopped state and can be reenabled by using move_continue.

Parameters
cbThe callback that will be called on error.

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