Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 35236f0418
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 91 lines (61 sloc) 2.615 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
#ifndef _INDUSTRIAL_ROBOT
#define _INDUSTRIAL_ROBOT

#include "ofConstants.h"

#include "ofxVectorMath.h"
#include "ofxThread.h"

#include "ofxIndustrialRobotThread.h"

#include "ofxIndustrialRobotVisualizer.h"
#include "ofxIndustrialRobotDefines.h"


class ofxIndustrialRobot {
public:

    enum Input {
        Timeline,
        Slider,
Gravity,
ManualPosition
    };
    
ofxIndustrialRobot(ofBaseApp * app);
void drawVisualizer(int x, int y, int w, int h);

ofxIndustrialRobotThread thread;
ofxIndustrialRobotVisualizer * visualizer;
ofBaseApp * app;

bool addPositionCue(float speed, ofxVec3f target, ofxVec3f dir, bool cubicSpline = true, bool endPause=false, bool endInZeroSpeed=false,bool lock=true);
int timelineCuesLeft(bool lock=true);
bool setGravityTarget(ofxVec3f target, ofxVec3f dir, float force = 1.0, float maxSpeed = 0, ofxIndustrialRobotDefines::HandVariant variant = ofxIndustrialRobotDefines::Auto, bool lock=true);
bool isLegalTarget(ofxVec3f target, ofxVec3f dir, ofxIndustrialRobotDefines::HandVariant variant = ofxIndustrialRobotDefines::Auto, bool lock=true);
    
    void setInput(Input input);

ofxVec3f getCurrentTarget(bool lock=true);
ofxVec3f getCurrentDir(bool lock=true);

ofxVec3f getCurrentGravityTarget(bool lock=true);
ofxVec3f getCurrentGravityDir(bool lock=true);

float getHandLength(bool lock=true);
float getHandHeight(bool lock=true);

ofxVec3f getDistanceToPointv(ofxVec3f p,bool lock=true);
float getDistanceToPointf(ofxVec3f p,bool lock=true);

ofxVec3f getDistanceToGravityTargetv(bool lock=true);
float getDistanceToGravityTargetf(bool lock=true);

float getVariant(bool lock=true);
ofxIndustrialRobotDefines::HandVariant getVariantGoal(bool lock=true);


bool isRobotReady(float radius = 1.0,bool lock=true);
bool isRobotDirReady(bool lock=true);
bool isRobotDirReady(double margin, bool lock=true);

bool isRobotVariantReady(bool lock=true);
bool isRobotVariantReady(float margin, bool lock=true);
bool isRobotPositionReady(float radius = 1.0,bool lock=true);
bool isRobotFlagsReady();
bool getEmergencyStop();
bool getLocked();

//Locks the variant so it can't be changed
void lockVariant(bool lock,bool threadlock=true);
//Returns true if the robot would like to change the variant (also its locked)
bool willChangeVariant(bool lock=true);
void panic(string msg);

void gotoStartPosition();
    
    //The position the robot is in after a reset
    void gotoResetPosition();
    
    ofxIndustrialRobotSerial * getSerial();
    
    void resetRobot();
    
bool startReady;
bool startPhase2;

};


#endif
Something went wrong with that request. Please try again.