z1_controller/include/interface/IOInterface.h

34 lines
1.2 KiB
C
Raw Normal View History

2022-07-20 11:11:38 +08:00
#ifndef IOINTERFACE_H
#define IOINTERFACE_H
#include "message/LowlevelCmd.h"
#include "message/LowlevelState.h"
#include "unitree_arm_sdk/cmdPanel.h"
#include "unitree_arm_sdk/keyboard.h"
#include <string>
2022-09-13 19:53:15 +08:00
#include "common/math/robotics.h"
2022-07-20 11:11:38 +08:00
class IOInterface{
public:
IOInterface(CmdPanel *cmdPanel):_cmdPanel(cmdPanel){}
virtual ~IOInterface(){delete _cmdPanel;};
virtual bool sendRecv(const LowlevelCmd *cmd, LowlevelState *state) = 0;
// void zeroCmdPanel(){_cmdPanel->setZero();}
std::string getString(std::string slogan){return _cmdPanel->getString(slogan);}
std::vector<double> stringToArray(std::string slogan){return _cmdPanel->stringToArray(slogan);}
std::vector<std::vector<double> > stringToMatrix(std::string slogan){return _cmdPanel->stringToMatrix(slogan);}
2022-09-13 19:53:15 +08:00
virtual bool calibration(){return false;};
2022-07-20 11:11:38 +08:00
SendCmd getSendCmd(){return _cmdPanel->getSendCmd();};
void getRecvState(RecvState recvState){ _cmdPanel->getRecvState(recvState);};
2022-09-13 19:53:15 +08:00
bool isDisConnect = false;// udp disconnection
bool _isDisConnect[7];// joint(motor) disconnection
2022-07-20 11:11:38 +08:00
protected:
2022-09-13 19:53:15 +08:00
uint16_t _isDisConnectCnt[7];
2022-07-20 11:11:38 +08:00
CmdPanel *_cmdPanel;
};
#endif //IOINTERFACE_H