My Line Follower doesn't work

gopigo3
linefollower

#1

Hi @RobertLucian Robert,

I connected a Line Follower sensor to I2C port on my GoPiGo3, but the code seems not work (return -1).
I have just updated GoPiGo3 firmware by fixed my Distance Senor issue.

This is my code for Line Follower sensor:

# initialize an EasyGoPiGo3 object
gpg3_obj = easy.EasyGoPiGo3()

# and then initialize the LineFollower object
line_follower = gpg3_obj.init_line_follower()

# use it however you want it
line_status = line_follower.read_raw_sensors()
print(line_status)

And the output is as:

>>> ================================ RESTART ================================
>>> 
[-1, -1, -1, -1, -1]
>>> 

Thanks,
Jason


#2

Hi @junwan2000,

Can you run i2cdetect -y 1 with your Line Follower Sensor attached to your GoPiGo3 and then make a screenshot of what you’re getting?

Also please run the following script and tell us what is the output of it.

import easygopigo3 as easy

print("line follower dependency installed: {}".format(easy.is_line_follower_accessible))

Thank you!


#3

Hi Robert,

Here are the results:

  1. The output from i2cdetect -y 1, please refer attached picture.

image

  1. The output of the script
import easygopigo3 as easy
print("line follower dependency installed: {}".format(easy.is_line_follower_accessible))`

>>> ================================ RESTART ================================
>>> 
line follower dependency installed: True
>>>

#4

Hi @junwan2000,

Please read the Warning note on the following page:
http://gopigo3.readthedocs.io/en/latest/api-basic.html#easygopigo3.LineFollower.read

It says that if a [-1, -1, -1, -1, -1] list of these values is returned, then it may be caused by the lack of calibration values.

Please use the following 2 methods for calibrating the sensor accordingly (also read the documentation):

Thank you!


#5

Thanks Robert for the suggestion!

This is the result from run white color calibration:
(289, 356, 432, 59, 48)

While the result from run black color calibration:
(987, 1010, 1004, 996, 986)

However, the return from read() is still
[-1, -1, -1, -1, -1]

Thanks,
Jason


#6

Hi Robert,

Is there any update about my line follower? From my last test, the result from color calibration seems work(with valid values returned)…

Thanks,
Jason


#7

Hi @junwan2000,

I’ve tested the line follower and all 3 methods work (the read, get_white_calibration & get_black_calibration).

What I haven’t asked you yet is to:

Can you please try these 2 suggestions and then tell us if it works for you?

Thank you!


#8

This is Read_Info.py prints out:

>>> ================================ RESTART ================================
>>> 
Manufacturer    :  Dexter Industries
Board           :  GoPiGo3
Serial Number   :  FFF050A9514E3437324A2020FF010D1D
Hardware version:  3.1.3
Firmware version:  0.3.2
Battery voltage :  12.061
5v voltage      :  5.047
>>>

#9

Hi @junwan2000,

I’ve investigated more onto this issue and I think I know what is the problem.
It seems like the line follower is dependent on some dependencies that are installed along with the GoPiGo.

So, what you have to do is update the GoPiGo too. Here’s the command:

sudo curl -kL dexterindustries.com/update_gopigo | bash

After you do this, please try calibrating the sensor again and then read the values. I’m curious to see if this solves your issue.

By the way, you seem to be having an older firmware on the GoPiGo3. The newest firmware version is 0.3.4 and yours is 0.3.2. I might suggest you update it - this doesn’t present a problem for the current issue, but I thought it might be worth to mention it.

Thank you!