-
Notifications
You must be signed in to change notification settings - Fork 0
/
Anna.ino
77 lines (65 loc) · 1.71 KB
/
Anna.ino
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
#include <PID_v1.h>
#include <Encoder.h>
#include "robot.h"
#include "joint.h"
Robot *robot;
struct robotMove{
int shoulder;
int elbow;
int wrist;
};
robotMove moves[6];
int counter;
void setup()
{
Serial.begin(9600);
Serial.println("Starting");
robot = new Robot();
robot->setup();
//robot->moveArmloomSke(2000);
//robot->moveArmloomSkf(0);
moves[0].shoulder = -3296;
moves[0].elbow = -1650;
moves[0].wrist = 1145;
moves[1].shoulder = -3296;
moves[1].elbow = -1650;
moves[1].wrist = -2355;
moves[2].shoulder = -3296;
moves[2].elbow = 2318;
moves[2].wrist = 702;
moves[3].shoulder = 1660;
moves[3].elbow = -2311;
moves[3].wrist = 702;
moves[4].shoulder = 4626;
moves[4].elbow = -78;
moves[4].wrist = -1681;
moves[5].shoulder = 0;
moves[5].elbow = 0;
moves[5].wrist = 0;
counter=0;
robot->shoulder->setSetpoint(moves[0].shoulder);
robot->elbow->setSetpoint(moves[0].elbow);
robot->wrist->setSetpoint(moves[0].wrist);
robot->knee->setSetpoint(-1000);
}
void loop(){
if(robot->inPosition())
{
robotMove todo = moves[counter++%6];
robot->shoulder->setSetpoint(todo.shoulder);
robot->elbow->setSetpoint(todo.elbow);
robot->wrist->setSetpoint(todo.wrist);
}
//Serial.print("shoulder: ");
//Serial.print(robot->shoulder->getPosition());
//Serial.print(" elbow: ");
//Serial.print(robot->elbow->getPosition());
//Serial.print(" wrist: ");
//Serial.print(robot->wrist->getPosition());
//Serial.println();
//Serial.println();
//Serial.println(robot->shoulder->getPosition());
//Serial.println(robot->inPosition());
//Serial.println(robot->knee->getPosition());
robot->operate();
}