KodlabPenn / kodlab_mjbots_sdk

Repo for kodlab SDK for use with mjbots ecosystem
Other
8 stars 7 forks source link

Get data from power distribution board #82

Open ShaneRozenLevy opened 1 year ago

ShaneRozenLevy commented 1 year ago

Most of our robots have a power distribution board on them, yet we don't have the c++ code to communicate with it. This issue details how we might go about it.

At a high level I propose an implementation that looks something between how we handle imu data and how we communicate with the moteus

  1. Lets rename pi3hat_moteus_interface to something better.
  2. The actual interface for the user to talk to the power dist board should be in the mjbots_hardware_interface
  3. Modify pi3hat_moteus_interface::Data to include data for the power dist board
  4. Write moteus_protocol for the power dist board
  5. Use the power dist board protocol to add to the data in https://github.com/KodlabPenn/kodlab_mjbots_sdk/blob/cf98754c7d37da965f0d9e08797c1441197c3d4c/include/kodlab_mjbots_sdk/pi3hat_moteus_interface.h#L210
  6. The pi3hat.cpp should handle the low level communication
  7. This for loop should be modified to check the can bus to determine if the can packet was for a moteus or the power dist board. Down the line if we add more can peripherals we might need to improve this check
  8. Communication between the Pi3Hat thread and behavior thread should happen in the mjbots_hardware_interface::ProcessReply() and mjbots_hardware_interface::SendCommand()
ShaneRozenLevy commented 1 year ago

@jdcaporale @ethanmusser Took a stab at what adding support for the power dist board would look like. Thoughts?

jdcaporale commented 1 year ago

Good start thous. Looks like a good place to start. A lot of this lowest level work has similar names in different namespaces/classes, so keep that in mind when you try to follow the thread of logic. Id/bus should be used to distinguish Peripherals from actuators, not sure where or how exactly it knows what to look for. Maybe check a vector of soon-to-be-built MJBotsCANPeripherals?