UMRT Arm Firmware Library
UMRT Arm Firmware Library Documentation

This library offers functionality common to multiple of the projects supporting the University of Manitoba Robotics Team's robotic arm.This includes:

  • Communication between the arm's high-level and low-level computer
  • A small application for testing the low-level computer communication link
  • An abstraction for controlling the arm's stepper motors

Arduino Communication Test Script

A small program to test communication between the high-level and low-level computer has been implemented in both Python and C++. The test sequence is:

  1. Send the string "test" to the low-level controller, nothing is expected to happen
  2. Send the string "hello world" as an ECHO command, it should be received back and printed as a string
  3. Send some numbers as ECHO commands, they should be received back and printed as numbers
  4. Send some numbers as ECHO commands, they should be received back and printed as raw data vectors
  5. Cycle through each motor:
    1. Spin forward at 2 RPM for 5 seconds
    2. Spin backward at 1 RPM in other direction for 5 seconds
    3. Stop
    4. Query the speed, which should respond with 0
    5. Query the position
    6. Step forward 20 steps at 10 RPM
    7. Query the position, should be 20 steps further than before
    8. Step backward 10 steps at 5 RPM
    9. Query the position, should be 10 steps closer than before
    10. Seek to position -10 at 30 RPM
    11. Query the position, should be -10
    12. Seek back to position 0 at 10 RPM
    13. Query the position, should be 0

The Python implementation, CommunicationMaster.py, was the communication system's proof-of-concept. It is entirely self-contained, and serves as the minimum working example of how to control Prairie Pioneer's arm motors from a high-level computer.

The C++ implementation, arduino_communication_test.hpp, fully tests the C++ interface for controlling Prairie Pioneer's arm motors. It uses openFrameworksArduino's Firmata implementation to create an ArduinoStepperController, and uses the event system to verify that the correct responses (and therefore correct callbacks) are fired when the low-level controller responds.

MKS Test Script

Similarly to Arduino Communication Test Script, a small program to test communication between the high-level computer and MKS SERVO57D/42D stepper controllers has been implemented in both Python and C++. The test sequence is:

  1. Cycle through each motor:
    1. Spin forward at 2 RPM for 5 seconds
    2. Spin backward at 1 RPM in other direction for 5 seconds
    3. Stop
    4. Query the position
    5. Step forward 20 steps at 10 RPM
    6. Query the position, should be 20 steps further than before
    7. Step backward 10 steps at 5 RPM
    8. Query the position, should be 10 steps closer than before
    9. Seek to position -10 at 30 RPM
    10. Query the position, should be -10
    11. Seek back to position 0 at 10 RPM
    12. Query the position, should be 0

The Python implementation, MksTest.py, was the stepper controller interface's proof-of-concept. It serves as the minimum working example of how to control Project Perry's arm motors from a high-level computer. All possible CAN commands to the controllers are described in MKS_COMMANDS.hpp.

The C++ implementation, mks_test.hpp, fully tests the C++ interface for controlling Project Perry's arm motors. It uses the fork of socketcan-plus-plus, conveniently packaged and maintained in ros2_socketcan to communicate with the stepper controllers over a SocketCAN interface. As with the Arduino system, this script also uses the event system to verify that the correct responses (and therefore correct callbacks) are fired when the low-level controller responds. The script must have the motor IDs to test provided through the --motors argument. See --help for available options.

Below is the expected output from this test program:

Mks setup!
(Queried) Motor 0x1: GetPos: position=0
(Requested) Motor 0x1: SetSpeed: success=true
(Requested) Motor 0x1: SetSpeed: success=true
(Requested) Motor 0x1: SetSpeed: success=true
(Requested) Motor 0x1: SetSpeed: success=false
(Queried) Motor 0x1: GetPos: position=16
(Requested) Motor 0x1: SendStep: success=MOVING
(Queried) Motor 0x1: GetPos: position=36
(Requested) Motor 0x1: SendStep: success=MOVING
(Requested) Motor 0x1: SendStep: success=COMPLETED
(Queried) Motor 0x1: GetPos: position=26
(Requested) Motor 0x1: SeekPos: success=MOVING
(Queried) Motor 0x1: GetPos: position=-10
(Requested) Motor 0x1: SeekPos: success=MOVING
(Queried) Motor 0x1: GetPos: position=0
(Requested) Motor 0x1: SeekPos: success=COMPLETED
@ MOVING
The motor is moving.
Definition: mks_enums.hpp:26
@ COMPLETED
The motor has reached the target position.
Definition: mks_enums.hpp:29

The Doxygen tagfile for this documentation is available here.