Skip to content

Add Motor API for multiple synchronous motor control#38

Open
luisss3 wants to merge 31 commits intoMcMasterExoskeleton:mainfrom
luisss3:motor_api
Open

Add Motor API for multiple synchronous motor control#38
luisss3 wants to merge 31 commits intoMcMasterExoskeleton:mainfrom
luisss3:motor_api

Conversation

@luisss3
Copy link
Contributor

@luisss3 luisss3 commented May 1, 2025

Summary

This PR introduces a high-level C++ Motor API for interacting with PRS/SRS R2 Series motors over Modbus RTU. The API abstracts low-level register communication and provides easy-to-use methods such as setTorque(), setSpeed(), and getActualPosition().

Features

  • Initialization and connection handling via initializeMotor()
  • Clean interface to control:
    • Torque (setTorque, getActualTorque)
    • Speed (setTargetVelocity, getActualVelocity)
    • Position (setPosition, getActualPosition)
    • Operation mode
  • Safety support: stopMotor() and disconnectMotor()
  • Low-level 16-bit and 32-bit register access
  • Error handling for Modbus communication
  • Unit tests via GoogleTest (see motor_api_test.cpp)

Notes

  • Based on EZmotion's PRS/SRS R2 Series documentation
  • Slave ID and baudrate, are customizable

Testing

All functionality has been tested on a 48V 200W motor via usb adaptor using GoogleTest. Tests cover initialization, control commands, and safety shutdowns. Multiple motors test suite to be included.


Yug-Vashisth and others added 23 commits March 18, 2025 19:25
…d to the function I created (InitializeMotor)
- Some of the function signatures in the C++ file didn't match the
  definition in the header file
- Cleaned up a couple of warnings by intializing variables to 0
Fixed semantic bugs in motor API
@luisss3 luisss3 added embedded Embedded code issues motor/output Part of the series of issues regarding output/motor control labels May 1, 2025
@luisss3 luisss3 requested review from DylanG5 and umarkhan135 May 1, 2025 04:00
@luisss3 luisss3 self-assigned this May 1, 2025
Copy link
Contributor Author

@luisss3 luisss3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted unnecessary files from PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

embedded Embedded code issues motor/output Part of the series of issues regarding output/motor control

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants