This should be very simple for many of you guys, but since I didn't create the faceTracking service, I am swimming far from offshore to reach the coast.

So, here is what I'm trying to do:

def relax():
    global MoveBodyRandom
    MoveBodyRandom=0
    global MoveHeadRandom
    if  i01.headTracking.faceDetect():
        i01.eyesTracking.faceDetect()
        i01.headTracking.startLKTracking()
        i01.eyesTracking.startLKTracking()

        MoveHeadRandom=0

    if  i01.headTracking.stopTracking():
        i01.eyesTracking.stopTracking()

        MoveHeadRandom=1
        i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
        i01.setHandSpeed("right", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
        i01.setArmSpeed("right", 0.75, 0.85, 0.65, 0.85)
        i01.setArmSpeed("left", 0.95, 0.65, 0.75, 0.75)
        i01.setHeadSpeed(0.85, 0.85)
        i01.setTorsoSpeed(0.75, 0.55, 1.0)
        #i01.moveHead(79,100)
        i01.moveArm("left",5,84,28,14)
        i01.moveArm("right",5,82,28,16)
        i01.moveHand("left",92,33,37,71,66,25)
        i01.moveHand("right",81,66,82,60,105,113)
        i01.moveTorso(95,90,90)

What is in red is not correct, and that is what I need help for. I'm pretty sure there is other things missing like try: or pass: but I hope you guys will help for that!!

The basic idea is to bypass the MoveHeadRandom if head Tracking is ON.

And if it is not ON but OFF the MoveHeadRandom can start.

hairygael

7 years 5 months ago

So let's try with this:

def relax():
  global MoveHeadRandom
  if  i01.headTracking = True
      i01.eyesTracking = True
      MoveHeadRandom=0

   else  i01.headTracking = False
             i01.eyesTracking = False
             MoveHeadRandom=1    
             MoveHeadTimer.startClock()
             i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
             i01.setHandSpeed("right", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
             i01.setArmSpeed("right", 0.75, 0.85, 0.65, 0.85)
             i01.setArmSpeed("left", 0.95, 0.65, 0.75, 0.75)
             i01.setHeadSpeed(0.85, 0.85)
             i01.setTorsoSpeed(0.75, 0.55, 1.0)
            #i01.moveHead(79,100)
             i01.moveArm("left",5,84,28,14)
             i01.moveArm("right",5,82,28,16)
             i01.moveHand("left",92,33,37,71,66,25)
             i01.moveHand("right",81,66,82,60,105,113)
             i01.moveTorso(95,90,90)
 

GroG

7 years 5 months ago

I suspect this might work...

 

 if (i01.eyesTracking.getOpenCV().capturing == true) or (i01.headTracking.getOpenCV().capturing == true){
        MoveHeadRandom = False

} else { 

      MoveHeadRandom = False

 

I'm getting a column issue here:

def relax():
  global MoveHeadRandom
  if (i01.eyesTracking.getOpenCV().capturing == true) or (i01.headTracking.getOpenCV().capturing == true){
        MoveHeadRandom = 0

  }else{ MoveHeadRandom = 1
       MoveHeadTimer.startClock()
       i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
       i01.setHandSpeed("right", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
       i01.setArmSpeed("right", 0.75, 0.85, 0.65, 0.85)
       i01.setArmSpeed("left", 0.95, 0.65, 0.75, 0.75)
       i01.setHeadSpeed(0.85, 0.85)
       i01.setTorsoSpeed(0.75, 0.55, 1.0)
       #i01.moveHead(79,100)
       i01.moveArm("left",5,84,28,14)
       i01.moveArm("right",5,82,28,16)
       i01.moveHand("left",92,33,37,71,66,25)
       i01.moveHand("right",81,66,82,60,105,113)
       i01.moveTorso(95,90,90)
 

GAH ! - switching between Java and Python makes my brain sloppy..
careful on your indentation .... since we are in Python-land

Also there really is just one OpenCV - both face & eyes use the same one - the brackets are from Java land

if (i01.eyesTracking.getOpenCV().capturing == true) 
       MoveHeadRandom = 0
else
       MoveHeadRandom = 0