killed some refactoring bugs

This commit is contained in:
2018-06-04 10:37:03 +02:00
parent 194f6cda9d
commit 16aa1422e4
3 changed files with 7 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ class BallFollower(object):
self.counter = 0 self.counter = 0
def update(self): def update(self):
print('in update loop')
try: try:
(x, y), radius = self.finder.find_colored_ball( (x, y), radius = self.finder.find_colored_ball(
self.video_top.get_frame() self.video_top.get_frame()

View File

@@ -45,12 +45,13 @@ class BallFinder(object):
((x, y), radius) = cv2.minEnclosingCircle(c) ((x, y), radius) = cv2.minEnclosingCircle(c)
if radius < self.min_radius: if radius < self.min_radius:
print('Nothin there')
self.history.appendleft(None) self.history.appendleft(None)
return None return None
M = cv2.moments(c) M = cv2.moments(c)
center = (int(M["m10"] / M["m00"]),int(M["m01"] // M["m00"])) center = (int(M["m10"] / M["m00"]),int(M["m01"] // M["m00"]))
self.history.appendleft(center, int(radius)) self.history.appendleft((center, int(radius)))
return center, int(radius) return center, int(radius)
def visualize(self, frame): def visualize(self, frame):

View File

@@ -8,7 +8,7 @@ class NaoMover(object):
self.mp = ALProxy('ALMotion', nao_ip, nao_port) self.mp = ALProxy('ALMotion', nao_ip, nao_port)
self.pp = ALProxy('ALRobotPosture', nao_ip, nao_port) self.pp = ALProxy('ALRobotPosture', nao_ip, nao_port)
ap = ALProxy("ALAutonomousLife", nao_ip, nao_port) ap = ALProxy("ALAutonomousLife", nao_ip, nao_port)
if ap.getState()!="disabled": if ap.getState() != "disabled":
ap.setState('disabled') ap.setState('disabled')
self.set_head_stiffness() self.set_head_stiffness()
self.set_hand_stiffness() self.set_hand_stiffness()
@@ -67,14 +67,14 @@ class NaoMover(object):
self.mp.setStiffnesses("RKneePitch", stiffness) self.mp.setStiffnesses("RKneePitch", stiffness)
def get_head_angles(self): def get_head_angles(self):
return self.mp.getAngles(('HeadYaw', 'HeadPitch'), useSensors=False) return self.mp.getAngles(('HeadYaw', 'HeadPitch'), False)
def change_head_angles(self, d_yaw, d_pitch, speed): def change_head_angles(self, d_yaw, d_pitch, speed):
self.mp.changeAngles(('HeadYaw', 'HeadPitch'), self.mp.changeAngles(('HeadYaw', 'HeadPitch'),
(d_yaw, d_pitch), speed) (d_yaw, d_pitch), speed)
def set_head_angles(self, yaw, pitch, speed): def set_head_angles(self, yaw, pitch, speed):
self.mp.setHeadAngles(('HeadYaw', 'HeadPitch'), self.mp.setAngles(('HeadYaw', 'HeadPitch'),
(yaw, pitch), speed) (yaw, pitch), speed)
def move_to(self, front, side, rotation, wait=False): def move_to(self, front, side, rotation, wait=False):