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
34 lines
890 B
//
|
|
// Created by iflyt on 2025/3/3.
|
|
//
|
|
|
|
#ifndef MOTOR_MANAGER_H
|
|
#define MOTOR_MANAGER_H
|
|
|
|
#include "elc_motor.h"
|
|
|
|
class MotorManager {
|
|
private:
|
|
static MotorManager* instance;
|
|
|
|
|
|
MotorManager();
|
|
MotorManager(const MotorManager&) = delete;
|
|
MotorManager& operator=(const MotorManager&) = delete;
|
|
|
|
public:
|
|
ECLMotor motors[3];
|
|
|
|
static MotorManager* ins();
|
|
|
|
int32_t getMotorPosition(int motorIndex);
|
|
void setMotorTargetPosition(int motorIndex, int32_t targetPosition);
|
|
void setMotorSpeed(int motorIndex, int32_t speed);
|
|
int32_t getMotorSpeed(int motorIndex);
|
|
uint8_t getMotorMovingStatus(int motorIndex);
|
|
int32_t getMotorEncoderPosition(int motorIndex);
|
|
void setMotorEncoderPosition(int motorIndex, int32_t encoderPos);
|
|
void setMotorMoving(int motorIndex, bool moving); // 新增设置电机是否运动的接口
|
|
};
|
|
|
|
#endif //MOTOR_MANAGER_H
|