Hi, I’ve got two Inventor HAT Minis connected to four N20 motors via JST SH cables. I’ve changed the I2C address on one to 0x16
and disabled the User and I2C pins on the second to avoid GPIO conflicts. All four motors work as expected in both example scripts and my own code when setting their speed.
When using an example script like velocity_control.py
with an encoder and PID controller (that’s just using the one default HAT), the motors move but no ticks seem to register on the encoders. Printing a Capture result is all zeros. Adding a print statement to the __take_reading()
method in ioexpander/encoder.py
returns zeros for raw_count
, raw_change
, and self.local_count
.
So while the motor is moving my print outputs look like this:
__take_reading: raw count: 0; change: 0; local_count: 0
capture: Capture(count=0, delta=0, frequency=0.0, revolutions=0.0, degrees=0.0, radians=0.0, revolutions_delta=0.0, degrees_delta=0.0, radians_delta=0.0, revolutions_per_second=0.0, revolutions_per_minute=0.0, degrees_per_second=0.0, radians_per_second=0.0)
It would seem the encoders are configured correctly as per their defaults, as I’m printing the pins from inside the constructor:
__init__() channel: 1; pin A: 3; pin B: 4
__init__() channel: 2; pin A: 26; pin B: 1
This occurs for either the A or B motor. I’ve been digging around on this for quite some time now and can’t figure out what’s going on.
Any idea what might be going wrong?