bitsy-ai / rpi-object-tracking

Object tracking tutorial using TensorFlow / TensorFlow Lite, Raspberry Pi, Pi Camera, and a Pimoroni Pan-Tilt Hat.
https://medium.com/@grepLeigh/real-time-object-tracking-with-tensorflow-raspberry-pi-and-pan-tilt-hat-2aeaef47e134
MIT License
185 stars 68 forks source link

Failed to write byte Error #55

Open JiyooonPark opened 3 years ago

JiyooonPark commented 3 years ago

I followed all the instructions but keep on getting this error. Can someone help me?

(.venv) pi@raspberrypi:~ $ rpi-deep-pantilt test pantilt

-- output 

(.venv) pi@raspberrypi:~ $ rpi-deep-pantilt test pantilt
INFO:root:Starting Pan-Tilt HAT test!
INFO:root:Pan-Tilt HAT should follow a smooth sine wave
Traceback (most recent call last):
  File "/home/pi/.venv/bin/rpi-deep-pantilt", line 8, in <module>
    sys.exit(main())
  File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/cli.py", line 153, in main
    cli()
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/cli.py", line 141, in pantilt
    return pantilt_test()
  File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/control/hardware_test.py", line 38,
    pantilthat.pan(a)
  File "/home/pi/.venv/lib/python3.7/site-packages/pantilthat/pantilt.py", line 466, in servo_one
    self.setup()
  File "/home/pi/.venv/lib/python3.7/site-packages/pantilthat/pantilt.py", line 80, in setup
    self._set_config()
  File "/home/pi/.venv/lib/python3.7/site-packages/pantilthat/pantilt.py", line 118, in _set_config
    self._i2c_write_byte(self.REG_CONFIG, config)
  File "/home/pi/.venv/lib/python3.7/site-packages/pantilthat/pantilt.py", line 209, in _i2c_write_byte
    raise IOError("Failed to write byte")
OSError: Failed to write byte

it says OSError: Failed to write byte does anyone know how to fix this?

Martin2kid commented 3 years ago

jiyoon,

Are you using Pimorini pan-tilt hat? If you are, you might want to check Sym-link smbus to your virtual environment

Example (should be linked to your venv folder & installed python version package folder) $ cd ~/.virtualenvs/py3cv4/lib/python3.5/site-packages/ $ ln -s /usr/lib/python3/dist-packages/smbus.cpython-35m-arm-linux-gnueabihf.so smbus.so

If you are not, I'd recommend you to check I2c address of Pan-tilt device & modify accordingly, will probably need rpi-deep-pantilt code change too.

Please see this article relate to Pimorini Pan & Tilt install detail here; https://www.pyimagesearch.com/2019/04/01/pan-tilt-face-tracking-with-a-raspberry-pi-and-opencv/

Leigh also posted excellent newsletter relating to Tensor-flow & Pi with different HW comparison here; https://www.bitsy.ai/3-ways-to-install-tensorflow-on-raspberry-pi/

Hope that works or help you in anyway...

Sreehar commented 2 years ago

I followed all the instructions but keep on getting this error. Can someone help me?

(.venv) pi@raspberrypi:~ $ rpi-deep-pantilt test pantilt

-- output 

(.venv) pi@raspberrypi:~ $ rpi-deep-pantilt test pantilt
INFO:root:Starting Pan-Tilt HAT test!
INFO:root:Pan-Tilt HAT should follow a smooth sine wave
Traceback (most recent call last):
  File "/home/pi/.venv/bin/rpi-deep-pantilt", line 8, in <module>
    sys.exit(main())
  File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/cli.py", line 153, in main
    cli()
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/.venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/cli.py", line 141, in pantilt
    return pantilt_test()
  File "/home/pi/.venv/lib/python3.7/site-packages/rpi_deep_pantilt/control/hardware_test.py", line 38,
    pantilthat.pan(a)
  File "/home/pi/.venv/lib/python3.7/site-packages/pantilthat/pantilt.py", line 466, in servo_one
    self.setup()
  File "/home/pi/.venv/lib/python3.7/site-packages/pantilthat/pantilt.py", line 80, in setup
    self._set_config()
  File "/home/pi/.venv/lib/python3.7/site-packages/pantilthat/pantilt.py", line 118, in _set_config
    self._i2c_write_byte(self.REG_CONFIG, config)
  File "/home/pi/.venv/lib/python3.7/site-packages/pantilthat/pantilt.py", line 209, in _i2c_write_byte
    raise IOError("Failed to write byte")
OSError: Failed to write byte

it says OSError: Failed to write byte does anyone know how to fix this?

Did you fix the issue ? If you did, how was it done? I get the same thing as error . Traceback (most recent call last): File "/home/pi/track/facetracker.py", line 37, in pan(cam_pan-90) File "/usr/lib/python3/dist-packages/pantilthat/pantilt.py", line 466, in servo_one self.setup() File "/usr/lib/python3/dist-packages/pantilthat/pantilt.py", line 80, in setup self._set_config() File "/usr/lib/python3/dist-packages/pantilthat/pantilt.py", line 118, in _set_config self._i2c_write_byte(self.REG_CONFIG, config) File "/usr/lib/python3/dist-packages/pantilthat/pantilt.py", line 209, in _i2c_write_byte raise IOError("Failed to write byte") OSError: Failed to write byte