-
Notifications
You must be signed in to change notification settings - Fork 0
/
geometry.h
51 lines (40 loc) · 994 Bytes
/
geometry.h
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
/*
* config.h
*
* Created on: Jul 9, 2015
* Author: Jacob
*/
#ifndef GEOMETRY_H_
#define GEOMETRY_H_
#include "AllegroStepper.h"
#define CABLE 1
#define CARTESIAN 0
#define TWO_AXIS 0
#define THREE_AXIS 1
#define A_STEPS_PER_MM 8.488263
#define B_STEPS_PER_MM -8.488263
#define AB_DISTANCE 1220
#define A_MIN_LENGTH 250
#define B_MIN_LENGTH 250
#define A_MAX_LENGTH 965
#define B_MAX_LENGTH 965
class Geometry{
public:
Geometry(AllegroStepper *aMot, AllegroStepper *bMot);
void setOrigin(float aPos,float bPos);
bool gotoPos(float x,float y,float vel);
void hold();
void move(int aSteps, int bSteps, long us);
float getX();
float getY();
float getRealX();
float getRealY();
private:
float a_orig, b_orig, a_pos, b_pos, x_pos, y_pos, x_offset, y_offset;
AllegroStepper * a_mot;
AllegroStepper * b_mot;
bool isHomed;
};
float* xyToab(float x, float y, float d);
float* abToxy(float x, float b, float d);
#endif /* GEOMETRY_H_ */