MiRo-Training
The aim of the project is to develop a software architecture for interacting with Miro using vocal and gestural commands.
|
The class BallDetection implements the detection of the circles in the cameras and the robot behavior to keep the circles in sight. More...
Public Member Functions | |
def | __init__ |
def | callback_camera_right |
Callback that receive the message that contains the information of the circles detected in the Right camera. More... | |
def | callback_camera_left |
Callback that receive the message that contains the information of the circles detected in the Left camera. More... | |
def | compared_detection |
Function that evaluate the detection of the ball and publish a message of type platform_control in order to keep the ball always in sight. More... | |
Public Attributes | |
rate | |
Node rate. | |
detect_right | |
Initialization of the CircleArrayStamped variable in the Right callback. | |
detect_left | |
Initialization of the CircleArrayStamped variable in the Left callback. | |
ball_right | |
Flag for Red Ball detected in Right camera. | |
ball_left | |
Flag for Red Ball detected in Leftcamera. | |
ball | |
Flag for Red Ball detected in Both cameras. | |
count_right | |
Number of positive detection on Right camera. | |
count_left | |
Number of positive detection on Left camera. | |
count_no_right | |
Number of negative detection on Right camera. | |
count_no_left | |
Number of negative detection on Left camera. | |
count_ball | |
Number of positive detection on Both cameras. | |
sub_camera_right | |
Subscriber to the topic /right/hough_circles/circles a message of type CircleArrayStamped that cointains the information about the circles detected in the Right camera. More... | |
sub_camera_left | |
Subscriber to the topic /right/hough_circles/circles a message of type CircleArrayStamped that cointains the information about the circles detected in the Left camera. More... | |
pub_follow_ball | |
Publisher to the topic /miro_play a message of type platform_control which corresponds to the "Play" action. More... | |
The class BallDetection implements the detection of the circles in the cameras and the robot behavior to keep the circles in sight.
def play.BallDetection.callback_camera_left | ( | self, | |
ball | |||
) |
Callback that receive the message that contains the information of the circles detected in the Left camera.
If the ball is detected for more than 3 times the flag self.ball_right is set to True.
If the ball is not detected for more than 3 times the flag self.ball_right is set to False.
def play.BallDetection.callback_camera_right | ( | self, | |
ball | |||
) |
Callback that receive the message that contains the information of the circles detected in the Right camera.
If the ball is detected for more than 3 times the flag self.ball_right is set to True.
If the ball is not detected for more than 3 times the flag self.ball_right is set to False.
def play.BallDetection.compared_detection | ( | self | ) |
Function that evaluate the detection of the ball and publish a message of type platform_control in order to keep the ball always in sight.
If the ball is detected in the Right camera, the robot will rotate towards right until the ball is detected also by the Left camera.
If the ball is detected in the Left camera, the robot will rotate towards left until the ball is detected also by the Right camera.
If the ball is detected in both cameras, the robot will go forward to reach the ball.
play.BallDetection.pub_follow_ball |
play.BallDetection.sub_camera_left |
play.BallDetection.sub_camera_right |