modified live_recognition_with_head and added first implementation live_recognition_with_head_with_body

This commit is contained in:
Jonas
2018-06-01 16:25:35 +02:00
parent d0800ca0ab
commit ec90e8fda8
2 changed files with 285 additions and 7 deletions

View File

@@ -28,7 +28,8 @@ min_radius = 5
resized_width = None # Maybe we need it maybe don't (None if don't)
current_value = 0
global counter
counter=0
def get_angle():
robotIP="192.168.0.11"
@@ -58,12 +59,12 @@ def set_angle_new(x,y):
#print("y_diff="+str(y_diff))
videoProxy=ALProxy('ALVideoDevice', robotIP, PORT)
ball_angles=videoProxy.getAngularPositionFromImagePosition(1,[x/320,y/240])
ball_angles=videoProxy.getAngularPositionFromImagePosition(cam_id,[x/320,y/240])
#print(ball_angles)
ball_angle_x=ball_angles[0]
ball_angle_y=ball_angles[1]
print("ball_angle_x="+str(ball_angle_x))
print("ball_angle_y="+str(ball_angle_y))
#print("ball_angle_x="+str(ball_angle_x))
#print("ball_angle_y="+str(ball_angle_y))
#ball_angle_x_diff=ball_angle_x+
#ball_angle_y_diff=ball_angle_y-99
@@ -74,9 +75,11 @@ def set_angle_new(x,y):
#[-169.53343200683594, 99.27782440185547] (x_mid,y_mid)
#if abs(ball_angle_x)>0.2 and abs(ball_angle_y)>0.01:
#angles=[ball_angle_x,0]
#angles=[0.25*ball_angle_x,0.25*ball_angle_y]
angles=[0.25*ball_angle_x,0.25*ball_angle_y]
if abs(ball_angle_x)>0.1 or abs(ball_angle_y)>0.1:
motionProxy.changeAngles(names, angles, fractionMaxSpeed)
#motionProxy.setAngles(names,angles,fractionMaxSpeed)
elif abs(ball_angle_x)<0.1 and abs(ball_angle_y)<0.1:
#tts = ALProxy("ALTextToSpeech", "192.168.0.11", 9559)
@@ -85,9 +88,14 @@ def set_angle_new(x,y):
#tts.setVoice("Kenny22Enhanced")
#tts.say("Ball found")
print("Ball found")
print(get_angle())
global counter
counter=counter+1
#print(counter)
#print("Ball found")
if counter==5:
global counter
counter=0
print(get_angle())