I initially thought that I had a hardware problem because a function from the Find a Hole Example was not doing what I expected.
My problem was fixed by changing a line in the control.py file found HERE. Or on the GoPiGo directory at GoPiGo/Software/Python/Examples/Find Hole/control.py
line 42: enc_tgt(0,1,pulse)
change to: enc_tgt(1,0,pulse)
--------------- Original post:
Hello,
I just built the GoPiGo and I believe I might have an issue. The right motor doesn’t stop while using “right_deg(30)” from the Find a Hole example.
Im using a raspberry 2. I enabled I2C.
sudo python
>>> from gopigo import *
>>> from control import *
>>> left_deg(30)
left motor turns 30 degrees.
>>> right_deg(30)
right motor turns endlessly.
>>> read_status()
[1, 0]
>>> read_enc_status()
1
I have not removed the paper from the encoder wheels. How can I verify if this is a hardware issue?
volts() currently returns 10.2
python enc_val_read.py
0, 0
0, 0
0, 0
Hey,
From the output above, there are 2 things that might be causing the problem. One, the voltage is very low. Are you using a 9-12V battery pack and is it charged and two, you have an older firmware on the GoPiGo. To update to a newer firmware, go to the folder here: https://github.com/DexterInd/GoPiGo/tree/master/Firmware on your GoPiGo repo, make the script executable: sudo chmod +x firmware_update.sh and run it sudo ./firmware_update.sh . Make sure that the motors are disconnected before you start. Run the same program again and post the output here.
Hello Karan, Just got home and performed the tasks you suggested.
I connected the pi’s micro usb to the laptop and also turned on the gopigo via the batteries.
Here is the output of the enconder test script:
Ver: 1.3
10.79 V
CHECKING ENCODER READINGS
0 0
Both motors moving Forward with LED On
after 5 sec 202 197
Both motors stopped with LED Off
None after stop cmd 210 204
None after 2 more sec 218 209
Both motors moving back with LED On
after 5 sec 411 410
Both motors stopped with LED Off
None after stop cmd 419 418
None after 2 more sec 426 423
Hey,
Looks like the encoders are working properly. I think 30 degree might be too small of angle to turn using the encoders. Can you try larger angles and see if that helps. Do the wheels just turn endlessly no matter what input you give? How does left_deg() compare to right_deg().
Im able to excecute left_deg(15); the wheel turns for about half a second and then stops.
With right_deg(30) though, the wheel never stops. I’ve waited about 8 to 20 seconds to see what it does. I have also swapped the encoders but nothing changes.
I’ll try to get some debug output from control.py when i get back home to see whats causing it to never stop.
Thanks for the help in confirming that the encoders haven’t gone bananas.