基质喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
890 B

  1. //
  2. // Created by iflyt on 2025/3/3.
  3. //
  4. #ifndef MOTOR_MANAGER_H
  5. #define MOTOR_MANAGER_H
  6. #include "elc_motor.h"
  7. class MotorManager {
  8. private:
  9. static MotorManager* instance;
  10. MotorManager();
  11. MotorManager(const MotorManager&) = delete;
  12. MotorManager& operator=(const MotorManager&) = delete;
  13. public:
  14. ECLMotor motors[3];
  15. static MotorManager* ins();
  16. int32_t getMotorPosition(int motorIndex);
  17. void setMotorTargetPosition(int motorIndex, int32_t targetPosition);
  18. void setMotorSpeed(int motorIndex, int32_t speed);
  19. int32_t getMotorSpeed(int motorIndex);
  20. uint8_t getMotorMovingStatus(int motorIndex);
  21. int32_t getMotorEncoderPosition(int motorIndex);
  22. void setMotorEncoderPosition(int motorIndex, int32_t encoderPos);
  23. void setMotorMoving(int motorIndex, bool moving); // 新增设置电机是否运动的接口
  24. };
  25. #endif //MOTOR_MANAGER_H