Hello sir,
I encountered a problem with initializing Robot() while following “basic_motion” provided by https://github.som/NVIDIA-AI-IOT/jetbot/git.
The following is the error in initializing the robot from “basic_motion” robot=Robot() code.
OSError Traceback (most recent call last)
in
----> 1 robot = Robot()
/usr/local/lib/python3.6/dist-packages/jetbot-0.3.0-py3.6.egg/jetbot/robot.py in init(self, *args, **kwargs)
37 def init(self, *args, **kwargs):
38 super(Robot, self).init(*args, **kwargs)
—> 39 self.motor_driver = Adafruit_MotorHAT(i2c_bus=self.i2c_bus)
40 self.left_motor = Motor(self.motor_driver, channel=self.left_motor_channel, alpha=self.left_motor_alpha)
41 self.right_motor = Motor(self.motor_driver, channel=self.right_motor_channel, alpha=self.right_motor_alpha)
/usr/local/lib/python3.6/dist-packages/Adafruit_MotorHAT/Adafruit_MotorHAT_Motors.py in init(self, addr, freq, i2c, i2c_bus)
235 self.motors = [ Adafruit_DCMotor(self, m) for m in range(4) ]
236 self.steppers = [ Adafruit_StepperMotor(self, 1), Adafruit_StepperMotor(self, 2) ]
→ 237 self._pwm = PWM(addr, debug=False, i2c=i2c, i2c_bus=i2c_bus)
238 self._pwm.setPWMFreq(self._frequency)
239
/usr/local/lib/python3.6/dist-packages/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py in init(self, address, debug, i2c, i2c_bus)
57 self.i2c = get_i2c_device(address, i2c, i2c_bus)
58 logger.debug(“Reseting PCA9685 MODE1 (without SLEEP) and MODE2”)
—> 59 self.setAllPWM(0, 0)
60 self.i2c.write8(self.__MODE2, self.__OUTDRV)
61 self.i2c.write8(self.__MODE1, self.__ALLCALL)
/usr/local/lib/python3.6/dist-packages/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py in setAllPWM(self, on, off)
93 def setAllPWM(self, on, off):
94 “Sets a all PWM channels”
—> 95 self.i2c.write8(self.__ALL_LED_ON_L, on & 0xFF)
96 self.i2c.write8(self.__ALL_LED_ON_H, on >> 8)
97 self.i2c.write8(self.__ALL_LED_OFF_L, off & 0xFF)
/usr/local/lib/python3.6/dist-packages/Adafruit_GPIO/I2C.py in write8(self, register, value)
114 “”“Write an 8-bit value to the specified register.”“”
115 value = value & 0xFF
→ 116 self._bus.write_byte_data(self._address, register, value)
117 self._logger.debug(“Wrote 0x%02X to register 0x%02X”,
118 value, register)
/usr/local/lib/python3.6/dist-packages/Adafruit_PureIO/smbus.py in write_byte_data(self, addr, cmd, val)
254 # Send the data to the device.
255 self._select_device(addr)
→ 256 self._device.write(data)
257
258 def write_word_data(self, addr, cmd, val):
OSError: [Errno 121] Remote I/O error
To solve this problem, I modified the init section of the Adafruit_MotorHAT class by replacing the “addr” value with 0x60 instead of 0x40.
Then, the above error disappeared, but another problem occured that only the left motor moved and the right motor did not work.
jetbot@jetbot-desktop:~$ i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – 3c – – –
40: – 41 – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: 60 – – – – – – – – – – – – – – –
70: 70 – – – – – – –
i2cdetect -y -r 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: 50 – – – – – – 57 – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –
i2cdetect -y -r 4
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – UU – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – UU – – – – – – –
70: – – – – – – – –
jetbot@jetbot-desktop:~$ i2cdetect -y -r 6
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: UU – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: UU – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –
and
jetbot@jetbot-desktop:~$ sudo i2cdetect -l
[sudo] password for jetbot:
i2c-3 i2c 7000c700.i2c I2C adapter
i2c-1 i2c 7000c400.i2c I2C adapter
i2c-8 i2c i2c-6-mux (chan_id 1) I2C adapter
i2c-6 i2c Tegra I2C adapter I2C adapter
i2c-4 i2c 7000d000.i2c I2C adapter
i2c-2 i2c 7000c500.i2c I2C adapter
i2c-0 i2c 7000c000.i2c I2C adapter
i2c-7 i2c i2c-6-mux (chan_id 0) I2C adapter
i2c-5 i2c 7000d100.i2c
I’m not good at dealing with hardware including i2c, so i would like to ask for your help. Any advice would be appreciated .Thank you :)