-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDArm.hpp
55 lines (42 loc) · 1.16 KB
/
DArm.hpp
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
/*
* DArm.hpp
*
* Created on: 24 apr. 2018
* Author: joeri
*/
#ifndef DARM_HPP_
#define DARM_HPP_
#include <math.h>
#include "Arduino.h"
#include "AccelStepper/AccelStepper.h"
struct Point{
double x;
double y;
};
struct PointTuple{
Point a;
Point b;
};
class DArm{
public:
Point A; // coordinates of left motor axle
Point B; // coordinates of right motor axle
double lengthN; // length of nearest part of arm
double lengthF; // length of furthest part of arm
double stepAngle; // angle of one motor step
AccelStepper MotorA; // object managing motor movement
AccelStepper MotorB;
//constructor
// lenthN: length of nearest part of arm, lengthF: length of furthest part of arm
// A: x,y of left motor, B: x,y of right motor
DArm(double lengthN, double lengthF, Point A, Point B);
// convert point to a set of angles
Point Convert(Point point);
// calculate intersecting points of circle radius Ar, centered at A,
// and circle radius Br, centered at B
PointTuple CalcIntersects(Point A, double Ar, Point B, double Br);
// move pen to coordinates point
void MoveTo(Point point);
void printPoint(Point p);
};
#endif /* DARM_HPP_ */