Before the command is sent, it is required to establish the connection with the robot and set the robot to status ready (ready to receive commands). Finally after the command execution the robot must be set to idle status. Then each command execution requires 4 steps listed below.
- Establish connection with the robot.
- Set the robot to ready status.
- Execute the command.
- Set the robot to idle status.
Take a look how to implement this, with Java 8 using lambdas.
The method 'executes' acts as template method, and you can see how the RobotCommand object is instantiated locally. Then using the method 'accept', the created RobotCommand is passed to the lambda context.
You can find the complete code here
No comments:
Post a Comment