Skip to content

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

@Eliott-0

Description

@Eliott-0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions