Skip to content

Conversation

Burke-Daniel
Copy link
Member

This PR creates a class to handle interfacing with the stepper motors, given commands from the raspberry pi over the can bus. Using the Adafruit stepper motor hat library, as well as the mcp2515 can interfacing class, the interface is able to parse a can message from the bus, and perform one of three different tasks based on the id of the incoming message:

  1. Initialization command - initializes one of the two steppers that can be connected to the hat, given that it has not already been initialized. The interface then sends a response message back to the pi over the can bus, to confirm that initialization has occurred. The data payload for this message includes the address of the stepper (either 1 or 2), and the step size is the number of steps per revolution that the stepper is capable of

  2. Stepper speed command - Sets the speed at which the stepper actuates, this is an rpm value. The data payload includes the stepper's address (1 or 2), and the rpm value. The interface sends a stepper speed response back to the pi to confirm successful configuration.

  3. Stepper step command - Actuates the stepper. The data payload includes the number of steps, the direction (forward (1) or backward (2)), and the step type (see details about what this means here. The stepper command is blocking, and will not return until actuation is complete. When it is complete, the interface will send a step response message back to the pi to confirm actuation was successful.

  4. Heartbeat message - Will be sent to the pi to confirm that can communications have been sustained. The message will be sent once per application loop, and the interface on the pi will be aware that when an actuation command is sent, the heartbeat message will be delayed.

Stuff that still needs to be done:

  • At least some function comments, maybe a README (could probably just contain the contents from above)
  • Testing - after getting the motor shield soldered, will test using CANAble and pi stepper interface (if written by then)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant