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

Picarx.set_grayscale_reference is not working #95

Open
mit-koyano opened this issue Jul 5, 2023 · 0 comments
Open

Picarx.set_grayscale_reference is not working #95

mit-koyano opened this issue Jul 5, 2023 · 0 comments

Comments

@mit-koyano
Copy link

mit-koyano commented Jul 5, 2023

The self.get_grayscale_reference, which is assigned by Picarx.set_grayscale_reference, is not being referred to within the class. Shouldn't it be sync with the reference of self.grayscale (i.e., the Grayscale_Module class)?

picar-x/picarx/picarx.py

Lines 191 to 192 in 425522e

def set_grayscale_reference(self, value):
self.get_grayscale_reference = value

This seems puzzling even when looking at example/minecart_plus.py. At the beginning of minecart_plus.py, the following comment and code exist:

'''
Line Following program for Picar-X:
Pay attention to modify the reference value of the grayscale module
according to the practical usage scenarios.Use the following:
px.grayscale.reference = 1400
or
px.set_grayscale_reference(1400)
'''
from picarx import Picarx
from time import sleep
px = Picarx()
# px = Picarx(grayscale_pins=['A0', 'A1', 'A2'])
px.set_grayscale_reference(1400)
# px.grayscale.reference = 1400

However, as px.set_grayscale_reference seems meaningless, the subsequent px.get_line_status always returns 'forward' and does not function properly.

gm_val_list = px.get_grayscale_data()
gm_state = px.get_line_status(gm_val_list)
print("gm_val_list: %s, %s"%(gm_val_list, gm_state))

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

1 participant