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.
 
 
 
 
 
 

118 lines
2.7 KiB

#ifndef _SVRDATA_H_
#define _SVRDATA_H_
#include <new>
#include <iostream>
#include <pthread.h>
#include <queue>
#include "Singleton.h"
#include "Trajectroy.h"
#include "vec.h"
#include "friComm.h"
#include "friremote.h"
#define JOINT_NUMBER (LBR_MNJ)
typedef Vec<float, JOINT_NUMBER> VecJoint;
typedef Vec<float, FRI_CART_VEC> VecTorque;
typedef Mat<float, 4> MatCarthesian;
class SvrData: public Singleton
{
private:
struct {
VecJoint jointPos;
MatCarthesian cartPos;
VecTorque forceAndTorque;
float jacobian[FRI_CART_VEC * JOINT_NUMBER];
} messured;
struct {
VecJoint jointPos;
MatCarthesian cartPos;
} commanded;
struct {
struct {
VecJoint velocity;
VecJoint accelaration;
VecJoint torque;
VecJoint range;
} max;
float currentVelocity;
float currentAcceleration;
} robot;
struct {
float sampleTimeMs;
bool cancel;
std::queue< Trajectory<JOINT_NUMBER>* > list;
}trajectory;
friRemote* friInst;
pthread_mutex_t dataLock;
/// private constructor, because the database is a singleton
SvrData();
static bool instanceFlag;
static SvrData* single;
void updateMessurementData(
VecJoint newJointPos,
MatCarthesian newCartPos,
VecTorque newForceAndTorque
);
public:
~SvrData(void);
static SvrData* getInstance();
friRemote* getFriRemote();
void updateMessurement();
void lock();
void unlock();
VecJoint getMeasuredJointPos();
MatCarthesian getMeasuredCartPos();
int getMessuredJacobian(float* data, size_t size);
VecTorque getMessuredForceTorque();
VecJoint getMessuredJointPos();
MatCarthesian getMessuredCartPos();
VecJoint getCommandedJointPos();
void setCommandedJointPos(VecJoint newJointPos);
MatCarthesian getCommandedCartPos();
void setCommandedCartPos(MatCarthesian newCartPos);
VecJoint getMaxTorque();
VecJoint getMaxVelocity();
VecJoint getMaxAcceleration();
VecJoint getMaxRange();
bool checkJointRange(VecJoint vectorToCheck);
float getRobotVelocity();
int setRobotVelocity(float newVelocity);
float getRobotAcceleration();
int setRobotAcceleration(float newVelocity);
unsigned int getJoints();
// trajectory functions
float getSampleTimeMs();
int setSampleTimeMs(float newSampleTime);
bool getTrajectoryCancel();
class Trajectory<JOINT_NUMBER>* popTrajectory();
int pushTrajectory(class Trajectory<JOINT_NUMBER>* newFrajectory);
bool cancelCurrentTrajectory();
void trajectoryCancelDone();
};
#endif