2022-11-11 18:17:07 +08:00
|
|
|
#ifndef LOWLEVELSTATE_HPP
|
|
|
|
#define LOWLEVELSTATE_HPP
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
2022-12-01 17:30:05 +08:00
|
|
|
#include "unitree_arm_sdk/math/mathTypes.h"
|
|
|
|
#include "unitree_arm_sdk/message/arm_common.h"
|
2022-11-11 18:17:07 +08:00
|
|
|
|
2022-11-16 16:23:36 +08:00
|
|
|
namespace UNITREE_ARM {
|
|
|
|
|
2022-11-11 18:17:07 +08:00
|
|
|
Vec6 PosturetoVec6(const Posture p);
|
|
|
|
Posture Vec6toPosture(const Vec6 p);
|
|
|
|
|
|
|
|
struct LowlevelState{
|
|
|
|
private:
|
|
|
|
size_t _dof = 6;
|
|
|
|
public:
|
|
|
|
LowlevelState();
|
|
|
|
~LowlevelState(){};
|
|
|
|
|
|
|
|
Vec6 endPosture;
|
|
|
|
std::vector<double> q;
|
|
|
|
std::vector<double> dq;
|
|
|
|
std::vector<double> ddq;
|
|
|
|
std::vector<double> tau;
|
|
|
|
|
|
|
|
std::vector<int> temperature;
|
2022-11-15 16:05:20 +08:00
|
|
|
/* 0x01 : phase current is too large
|
|
|
|
* 0x02 : phase leakage
|
|
|
|
* 0x04 : motor winding overheat or temperature is too large
|
|
|
|
* 0x20 : parameters jump
|
|
|
|
* 0x40 : Ignore
|
|
|
|
*/
|
2022-11-11 18:17:07 +08:00
|
|
|
std::vector<uint8_t> errorstate;
|
2022-11-15 16:05:20 +08:00
|
|
|
/*
|
|
|
|
* 0: OK
|
|
|
|
* 1: communication between lower computer and motor disconnect once
|
|
|
|
* 2: communication between lower computer and motor has CRC erro once
|
|
|
|
*/
|
2022-11-11 18:17:07 +08:00
|
|
|
std::vector<uint8_t> isMotorConnected;
|
|
|
|
|
|
|
|
Vec6 getQ();
|
|
|
|
Vec6 getQd();
|
|
|
|
Vec6 getQdd();
|
|
|
|
Vec6 getTau();
|
|
|
|
double getGripperQ() {return q.at(q.size()-1);}
|
|
|
|
double getGripperQd() {return dq.at(q.size()-1);}
|
|
|
|
double getGripperTau() {return tau.at(tau.size()-1);}
|
|
|
|
};
|
|
|
|
|
2022-11-16 16:23:36 +08:00
|
|
|
}
|
2022-11-11 18:17:07 +08:00
|
|
|
#endif //LOWLEVELSTATE_HPP
|