0

I'm taking a robotics course and I imported the Myro library in Calico. timeRemaining is supposed to be a predefined function in the Myro library but it keeps saying it's undefined.

There's an online handbook for Myro functions and even this does not work:

while timeRemaining(5):
print "running..."

This is the exact error

NameError: name 'timeRemaining' is not defined

I'm even copying code directly from the book and it's saying timeRemaining isn't defined. The code from the book is supposed to work.

Other predefined functions like turnLeft, forward(speed, time), etc. work, but timeRemaining does not.

Here's code right from the Calico book Learning Computing With Robots

def main():
    # Run the robot for 60 seconds
    while timeRemaining(60):
        L, C, R = getLight()
        # motors run proportional to light
        motors(normalize(L), normalize(R))
stop()

When I try to run main() it does not work. It says timeRemaining is undefined. I can't figure out what's wrong.

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
user3577397
  • 453
  • 3
  • 12
  • 27

1 Answers1

0

What version of myro are you using?

Taking a look here, I can see timeRemaining defined in __init__.py, which is imported when you run from myro import *. Some of the older versions do not have this function, so make sure you are running the latest version first.

Martin Konecny
  • 57,827
  • 19
  • 139
  • 159
  • I am running the latest version for mac. I believe it's 3.1 – user3577397 Oct 12 '14 at 03:43
  • Also, when I do the 'senses' function it says my light is 65000, but in the book it says it should max at 5000 – user3577397 Oct 12 '14 at 03:52
  • Konercny, my teacher gave me this link. The latest version for Macs is 3.1. Are you suggesting I download an older version? http://myro.roboteducation.org/~dblank/download/?C=N;O=D;P=*-mac*.zip – user3577397 Oct 12 '14 at 03:54
  • Oh.. I have the latest version of Calico, but not the latest version of Myro it seems. How do I install it, just click the .py file? – user3577397 Oct 12 '14 at 03:55
  • It appears I have 2.8 as that is what was recommended on the website. I don't know how to put the 2.9 into the python path on Macs. – user3577397 Oct 12 '14 at 04:08