ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

New PCA9685 driver for ROS

I wrote a driver for the PCA9685 I2C PWM driver chip. This chip is intended to be used with LED applications but is also used in a number of servo and motor controller boards, including a few Adafruit and Waveshare boards among others.

A couple of notable features I added that I haven’t seen done in other similar packages:

  • The ability to update only certain channels in a ROS command, and not update all of them. This allows multiple ROS nodes to publish to the same command topic but take charge of different subsets of the 16 channels.
  • A timeout. If a channel isn’t updated within that time, it gets set to 0. This is useful to avoid servos burning out if your control logic crashes, and also as a heartbeat timeout in the case of motor controllers.
2 Likes

Hi dheera,
Thanks for sharing your package. I am new to ROS so I’m still confusing after reading your readme file. You’re using Int32MultiArray as the message type, but in your description, the subscriber take 16 values for each channel. How are those two related. If I want to write send command to this node, how do I define the values of label, size, stride, data_offset, and data respectively to specify the channel?
Thanks much,
Zhouqiao

Hi Zhouqiao,
The code currently only reads the data field and expects 16 values. It doesn’t actually read label/stride/data_offset, so it’ll work without setting those, but it’s probably most “correct” to just define it as a one-dimensional array of 16 values. i.e.

dim[0].label = “command”
dim[0].size = 16
dim[0].stride = 16

Thanks, works perfect.