"timeRemaining is not defined" error

335 views Asked by At

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.

1

There are 1 answers

5
Martin Konecny On BEST ANSWER

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.