Update: transbot.py: make use of numeric representation capability in perception, initially for location, color next
@@ -70,7 +70,7 @@ def pick_with_feedback(pickobj=None):
if y_real_temp < closer_to_gripper: #visual feedback
forward()
elif y_real_temp > closer_to_gripper:
- left()
+ #left()
forward()
forward()
forward()
@@ -177,11 +177,8 @@ def TransbotPerceiveAt(obj, trans, rot):
def TransbotPerceiveVisual(obj, screenX, screenY, trans, rot):
direction = "center" #640 -> 320 center
TransbotPerceiveAt(obj, trans, rot) #TODO improve
- if screenX < robotVisualMiddle-centerSize:
- direction = "left"
- elif screenX > robotVisualMiddle+centerSize:
- direction = "right"
- NAR.AddInput("<%s --> [%s]>. :|:" % (obj, direction))
+ locationToFreq = 1.0 - 0.1 * (screenX / 640)
+ NAR.AddInput(("<%s --> [left]>. :|: " % obj) + "%" + str(locationToFreq) + "%")
Configuration = """
*reset
@@ -230,7 +227,11 @@ def process(line):
if y_real_temp == -1 or y_real_temp < y_too_far_to_grab or x_real_temp > robotVisualMiddle-centerSize or collision != "free": #right side blocked by arm
NAR.AddInput("<obstacle --> [" + collision + "]>. :|:")
elif y_real_temp != -1 and y_real_temp >= y_too_far_to_grab:
- TransbotPerceiveVisual(obj, x_real_temp, y_real_temp, trans, rot)
+ for detection in detections:
+ (obj, x, y, w, h, c) = detection
+ x_real = x+w/2
+ y_real = y+h #down side of bb
+ TransbotPerceiveVisual(obj, x_real, y_real, trans, rot)
cv.imshow('frame', frame)
if line.endswith("! :|:"):
executions = NAR.AddInput(line)["executions"] #account for mental op
