billmania / roboquest_addons

Add-on functionality for the RoboQuest application, not part of the base system
0 stars 0 forks source link

Add support for user I2C devices #5

Open billmania opened 2 days ago

billmania commented 2 days ago

Depends upon both rq_core Issue 79 and rq_core Issue 85.

In order to use vendor-supplied libraries and modules which communicate directly with an I2C bus, add a node to the rq_addons image.

Using the solution provided here will require a user change to the roboquest_core ROS parameters, via /opt/persist/i2c/i2c.yaml, and a hardware wiring change, moving the motor controller to I2C bus 1 from bus 6. As soon as the motor controller is moved to I2C1, the /control_hat service attribute "set_motors" no longer controls the electrical power to the motor. The motor controller will be enabled when the HAT is powered. This change occurs because "set_motors" is controlling power to the VCC pin on I2C6, not to the motor controller directly.

billmania commented 1 day ago

Current example I²C devices:

To test the VL53L0X on a Raspberry Pi 4B

The default device ID is 0x29.

  1. install Raspberry Pi OS 64 bit for RaspPi4B
  2. install python3-pip and python3-venv
  3. use raspi-config to enable both I2C and serial console
  4. enable onboard I2C bus 6
  5. python -m venv ./i2c_venv
  6. source i2c_venv/bin/activate
  7. pip install smbus2
  8. copy https://github.com/Gadgetoid/VL53L0X-python/blob/master/python/VL53L0X_example.py