add namespace

This commit is contained in:
Agnel Wang 2022-11-16 16:23:36 +08:00
parent bb796755ba
commit 3af65a299e
16 changed files with 37 additions and 14 deletions

View File

@ -1,5 +1,7 @@
#include "control/unitreeArm.h"
using namespace UNITREE_ARM;
class Z1ARM : public unitreeArm{
public:
Z1ARM():unitreeArm(true){};

View File

@ -1,5 +1,7 @@
#include "control/unitreeArm.h"
using namespace UNITREE_ARM;
int main() {
Vec6 posture[2];
unitreeArm arm(true);

View File

@ -1,5 +1,7 @@
#include "control/unitreeArm.h"
using namespace UNITREE_ARM;
class JointTraj{
public:
JointTraj(){};

View File

@ -1,5 +1,7 @@
#include "control/unitreeArm.h"
using namespace UNITREE_ARM;
class Z1ARM : public unitreeArm{
public:
Z1ARM():unitreeArm(true){

View File

@ -8,6 +8,7 @@
#include "utilities/loop.h"
#include "model/ArmModel.h"
namespace UNITREE_ARM {
struct CtrlComponents{
public:
CtrlComponents(double deltaT, bool hasUnitreeGripper);
@ -48,4 +49,5 @@ private:
UDPPort *_udp;
};
}
#endif

View File

@ -3,6 +3,8 @@
#include "control/ctrlComponents.h"
namespace UNITREE_ARM {
class unitreeArm{
public:
unitreeArm(bool hasUnitreeGripper);
@ -162,4 +164,5 @@ LowlevelState *lowstate;//same as _ctrlComp->lowstate
CtrlComponents *_ctrlComp;
};
}
#endif

View File

@ -5,6 +5,8 @@
#include <math.h>
#include "math/mathTypes.h"
namespace UNITREE_ARM {
template<typename T>
T max(T value){
return value;
@ -241,4 +243,5 @@ private:
double _zoomFactor;
std::string _valueName;
};
}
#endif

View File

@ -5,6 +5,7 @@
#include <vector>
#include <Eigen/Dense>
namespace UNITREE_ARM {
namespace typeTrans{
inline void addValue(std::vector<double> &vec, double value){
@ -71,5 +72,5 @@ inline void extractVector(std::vector<double> &vec, T &t, Args&... rest){
}
}
}
#endif // TYPETRANS_H

View File

@ -5,6 +5,7 @@
#include <vector>
#include <iostream>
namespace UNITREE_ARM {
struct LowlevelCmd{
private:
size_t _dof = 6;
@ -76,5 +77,5 @@ Vec6 getQ();
Vec6 getQd();
};
}
#endif //LOWLEVELCMD_H

View File

@ -6,6 +6,8 @@
#include "math/mathTypes.h"
#include "message/arm_common.h"
namespace UNITREE_ARM {
Vec6 PosturetoVec6(const Posture p);
Posture Vec6toPosture(const Vec6 p);
@ -46,4 +48,5 @@ public:
double getGripperTau() {return tau.at(tau.size()-1);}
};
}
#endif //LOWLEVELSTATE_HPP

View File

@ -5,6 +5,7 @@
#pragma pack(1)
namespace UNITREE_ARM {
// 4 Byte
enum class ArmFSMState{
INVALID,
@ -112,5 +113,5 @@ constexpr int JointCmd_LENGTH = (sizeof(JointCmd));
constexpr int JointState_LENGTH = (sizeof(JointState));
#pragma pack()
}
#endif // _UNITREE_ARM_ARM_MSG_H_

View File

@ -8,6 +8,7 @@
#include <vector>
#include "utilities/timer.h"
namespace UNITREE_ARM {
enum class BlockYN{
YES,
NO
@ -53,7 +54,7 @@ private:
size_t _sentLength;
fd_set _rSet;
};
}
#endif

View File

@ -5,8 +5,9 @@
#include "thirdparty/robotics.h"
#include "thirdparty/quadProgpp/QuadProg++.hh"
using namespace robo;
namespace UNITREE_ARM {
using namespace robo;
class ArmModel{
public:
ArmModel(Vec3 endPosLocal, double endEffectorMass, Vec3 endEffectorCom, Mat3 endEffectorInertia);
@ -146,5 +147,5 @@ private:
void setParam_V3_6();
double _theta2Bias;
};
}
#endif

View File

@ -12,6 +12,7 @@
#include <boost/bind.hpp>
#include "utilities/timer.h"
namespace UNITREE_ARM {
typedef boost::function<void ()> Callback;
class Loop {
@ -54,5 +55,5 @@ public:
private:
boost::function<void ()> _fp;
};
}
#endif // _UNITREE_ARM_LOOP_H_

View File

@ -7,21 +7,19 @@
#include <sys/time.h>
#include <sys/timerfd.h>
//时间戳 微秒级, 需要#include <sys/time.h>
namespace UNITREE_ARM {
inline long long getSystemTime(){
struct timeval t;
gettimeofday(&t, NULL);
return 1000000 * t.tv_sec + t.tv_usec;
}
//时间戳 秒级, 需要getSystemTime()
inline double getTimeSecond(){
double time = getSystemTime() * 0.000001;
return time;
}
/*
startTime开始等待waitTime微秒
使使AbsoluteTimer类
*/
inline void absoluteWait(long long startTime, long long waitTime){
if(getSystemTime() - startTime > waitTime){
std::cout << "[WARNING] The waitTime=" << waitTime << " of function absoluteWait is not enough!" << std::endl
@ -52,5 +50,5 @@ private:
double _nextWaitTime;
itimerspec _timerSpec;
};
}
#endif

Binary file not shown.