Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

picar servo-install hangs #52

Open
axi0m opened this issue Nov 17, 2020 · 2 comments
Open

picar servo-install hangs #52

axi0m opened this issue Nov 17, 2020 · 2 comments

Comments

@axi0m
Copy link

axi0m commented Nov 17, 2020

It seems that the version of picar I have sits in an infinite loop.

File: /usr/local/lib/python3.5/dist-packages/SunFounder_PiCar-1.0.1-py3.5.egg/picar/__init__.py

def servo_install():
    import time
    delay = 1.0/180
    if len(sys.argv) >= 3:
        print("servo-install takes no value")
        usage()
    print("Servo now is set to 90 degree.")
    servo0 = Servo.Servo(0, bus_number=1)
    servo1 = Servo.Servo(1, bus_number=1)
    servo2 = Servo.Servo(2, bus_number=1)
    for i in range(90, -1, -1):
        servo0.write(i)
        servo1.write(i)
        servo2.write(i)
        time.sleep(delay)
    time.sleep(0.1)
    for i in range(0, 181, 1):
        servo0.write(i)
        servo1.write(i)
        servo2.write(i)
        time.sleep(delay)
    time.sleep(0.1)
    for i in range(180, 89, -1):
        servo0.write(i)
        servo1.write(i)
        servo2.write(i)
        time.sleep(delay)
    time.sleep(0.1)
    servo0.write(90)
    servo1.write(90)
    servo2.write(90)
    while True:
        time.sleep(1)

Notice the while True loop. Thus when I run the command picar servo-install it just sits there forever, I don't think I need to keep the python programming running after I've run the command successfully?

Thanks!

@axi0m
Copy link
Author

axi0m commented Nov 17, 2020

Build Info

pi@raspberrypi:~/SunFounder_PiCar-V/remote_control $ python --version
Python 2.7.13
pi@raspberrypi:~/SunFounder_PiCar-V/remote_control $ python3 --version
Python 3.5.3
pi@raspberrypi:~/SunFounder_PiCar-V/remote_control $ cat /etc/debian_version
9.13
pi@raspberrypi:~/SunFounder_PiCar-V/remote_control $ uname -a
Linux raspberrypi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

@hannesa2
Copy link
Contributor

hannesa2 commented Jan 6, 2021

I made a pull request for this sunfounder/SunFounder_PiCar#10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants