Skip to content

"Out of Range" Issue on JetRacer pro IA Kit for Road Following #643

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

Open
Eliott-0 opened this issue Jun 2, 2025 · 0 comments
Open

"Out of Range" Issue on JetRacer pro IA Kit for Road Following #643

Eliott-0 opened this issue Jun 2, 2025 · 0 comments

Comments

@Eliott-0
Copy link

Eliott-0 commented Jun 2, 2025

Hello everyone !

I am curently stuck by a simple error when I try to run the road following notebook on my JetRacer.
I created my dataset and trained my road following model. Then, I optimized the model and got my "road_following_model_trt.pth" file.

I first faced an I2C issue, because the program was on default and used 0x60 bus. But when i checked, I saw that my motors were on 0x40 and 0x42.
So i tried like this :
car = NvidiaRacecar(i2c_address1=0x42, i2c_address2=0x40)
but I got an I/O error on 0x42 address, so i used only the 0x40 like this :
car = NvidiaRacecar(i2c_address1=0x40, i2c_address2=0x40)

It solved temporally my problem, but now i'm stuck with and "Out of range" issue on my car.steering.
I tried to Clamp my value between [-1;1] but it doesnt worked.
Then, I tried to modify directly the library by modifying "adafruit_pca9685.py" file.
I changed this :
def duty_cycle(self, value):
if not 0 <= value <= 0xFFFF:
raise ValueError("Out of range")

    if value == 0xFFFF:
        self._pca.pwm_regs[self._index] = (0x1000, 0)
    else:
        # Shift our value by four because the PCA9685 is only 12 bits but our value is 16
        value = (value + 1) >> 4
        self._pca.pwm_regs[self._index] = (0, value)

for this :
def duty_cycle(self, value):
if not 0 <= value <= 0xFFFF:
print(f"DEBUG: duty_cycle value out of range: {value}, clamping")
value = max(0, min(value, 0xFFFF))

if value == 0xFFFF:
    self._pca.pwm_regs[self._index] = (0x1000, 0)
else:
    # Shift our value by four because the PCA9685 is only 12 bits but our value is 16
    value = (value + 1) >> 4
    self._pca.pwm_regs[self._index] = (0, value)

(chat gpt advice)
That didn't solved my problem either...

That's why I am asking you if someone is willing to help me ?
Maybe it happens because i used same I2C address for both of my servo and motor, but I couldn't find any other solutions.

Thant you very much for your help and for your time !
Have a nice day !
Eliott.

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