first
This commit is contained in:
50
VinceMotorControllerUsb.h
Normal file
50
VinceMotorControllerUsb.h
Normal file
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QtSerialPort/QSerialPort>
|
||||
#include <QDebug>
|
||||
#include <iostream>
|
||||
|
||||
#include "JsonOperate.h"
|
||||
#include "MotorControllerBase.h"
|
||||
|
||||
#define MOTOR_SYNC (0xFF)//֡ͷ
|
||||
#define MOTOR_ETX (0xFE)//֡β
|
||||
|
||||
#define MOTOR_disconnection -1000000//<2F>ٶȵ<D9B6><C8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶ<CDA8>쳣
|
||||
|
||||
class VinceMotorControllerUsb :
|
||||
public MotorControllerBase, QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VinceMotorControllerUsb(QString serialPort, QString paramJson, QObject* parent = nullptr);
|
||||
~VinceMotorControllerUsb();
|
||||
|
||||
void init(QString jsonPath);
|
||||
int sendCommand2Motor(QString cmd);
|
||||
bool isConnected();
|
||||
void enable();
|
||||
|
||||
void move2Pos(double pos);
|
||||
void move(bool towardOrigin);//true<75><65>Զ<EFBFBD><D4B6>ԭ<EFBFBD>㣬false<73><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
||||
void stopMove();
|
||||
void setSpeed(double speed);
|
||||
double getSpeed();
|
||||
double getCurrentLoc();
|
||||
void zeroStart();
|
||||
|
||||
int getSpeedLocation(double& speed, double& locatioin);
|
||||
|
||||
State getState();
|
||||
int recvData(QByteArray& dataRecv);
|
||||
IrisMotorErrorCode parseBytedata(QByteArray buf, State& backdatt);
|
||||
IrisMotorErrorCode extractOneValidFrame(QByteArray& buffer);
|
||||
IrisMotorErrorCode parseOneValidFrame(QByteArray& buffer, State& result);
|
||||
|
||||
private:
|
||||
QSerialPort* m_pSerialPort;
|
||||
|
||||
double m_iSpeed;
|
||||
};
|
||||
Reference in New Issue
Block a user