View: 78|Reply: 4

Picar-B Auto Avoidance Youtube video

[Copy link]

1

Threads

4

Posts

21

Credits

Newbie

Rank: 1

Credits
21
Post time 2020-7-25 05:38:27 | Show all posts |Read mode
Hi There

I watched the YouTube video on the automatic obstacle avoidance. I decided to reproduce the code that was shown in the video.

I had a couple of hiccups, as follows.

1. I had to install the Adafruit_PCA9685 module as the program couldn't find it when I ran it.

2. I have received an 'Index out of range' error relating to line 60, which is scanList[0]. I notice that line 50 has scanList[], so I assume that I am receiving this error because the list is currently empty? Any ideas on how to resolve please? I have temporarily changed line 50 to read 'scanList[0, 1, 2]. This allows execution further through the code, but not sure if it's right or not.

3. I receive the following error when running the program again.

[0.51, 1, 2]
Traceback (most recent call last):
  File "automatic.py", line 105, in <module>
    move.motor_left(1, 0, 80)
  File "/home/pi/test/move.py", line 74, in motor_left
    GPIO.output(Motor_B_Pin1, GPIO.LOW)
RuntimeError: The GPIO channel has not been set up as an OUTPUT


Any ideas would be gratefully received - thanks!


Reply

Use magic Report

1

Threads

4

Posts

21

Credits

Newbie

Rank: 1

Credits
21
 Author| Post time 2020-7-27 03:35:24 | Show all posts
Hi There

Any help with this please Adeept?

I'd really like to get this going asap. There appears to be a problem with the code, even though it looked like it worked perfectly in your video!

Thanks.
Reply

Use magic Report

1

Threads

43

Posts

124

Credits

Registered member

Rank: 2

Credits
124
Post time 2020-7-30 17:17:27 | Show all posts
You need to add GPIO.setup(Motor_B_Pin1, GPIO.OUT) before the GPIO.output(Motor_B_Pin1, GPIO.LOW) function.
Reply

Use magic Report

1

Threads

4

Posts

21

Credits

Newbie

Rank: 1

Credits
21
 Author| Post time 2020-8-3 05:55:52 | Show all posts
Hi there.

Thanks for your reply. However, the entry you suggest is already in the code in the motor initialisation section. If the code needs to be placed elsewhere too then please advise. Even better still, could you supply a fully working version of the code please?

Thanks.
Reply

Use magic Report

1

Threads

4

Posts

21

Credits

Newbie

Rank: 1

Credits
21
 Author| Post time 2020-8-6 04:22:23 | Show all posts
Any other ideas please??
Reply

Use magic Report

You have to log in before you can reply Login | Sign Up

Points Rules