-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelex7825_robot_pi.cpp
More file actions
175 lines (139 loc) · 2.7 KB
/
Copy pathelex7825_robot_pi.cpp
File metadata and controls
175 lines (139 loc) · 2.7 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/**
* @function findContours_Demo.cpp
* @brief Demo code to find contours in an image
* @author OpenCV team
*/
#include <pigpio.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <opencv2/opencv.hpp>
// Add simple GUI elements
#define CVUI_DISABLE_COMPILATION_NOTICES
#define CVUI_IMPLEMENTATION
#include "cvui.h"
//Namespaces used for project
using namespace std; // standard lib
using namespace cv; // opencv
#include "Camera.h"
//Robot scripts
#include "robot_lab3.h"
#include "robot_lab4.h"
#include "robot_lab5.h"
#include "robot_lab6.h"
#include "robot_lab7.h"
void lab1()
{
CCamera _virtualcam;
_virtualcam.createChArUcoBoard();
}
void lab2()
{
CCamera _virtualcam;
_virtualcam.calibrate_board();
}
void lab3(int cam_id)
{
char exit_key = -1;
CRobot_3 robot;
//Initially create robot
robot.create();
//Continuously draw robot
while (exit_key != 'q')
{
robot.draw();
exit_key = waitKey(10);
}
}
void lab4(int cam_id)
{
char exit_key = -1;
CRobot_4 robot;
//Initially create robot
robot.create();
//Continuously draw robot
while (exit_key != 'q')
{
robot.draw();
exit_key = waitKey(10);
}
}
void lab5(int cam_id)
{
char exit_key = -1;
CRobot_5 robot;
while (exit_key != 'q')
{
//Continuously create robot
robot.create();
//Update settings
robot.update();
//Draw robot
robot.draw();
exit_key = waitKey(10);
}
}
void lab6(int cam_id)
{
char exit_key = -1;
CRobot_6 robot;
while (exit_key != 'q')
{
//Continuously create robot
robot.create();
//Update settings
robot.update();
//Draw robot
robot.draw();
exit_key = waitKey(10);
//Fkine or ikine
robot.calculate();
}
}
void lab7(int cam_id)
{
char exit_key = -1;
CRobot_7 robot;
while (exit_key != 'q')
{
//Continuously create robot
robot.create();
//Update settings
robot.update();
//Draw robot
robot.draw();
exit_key = waitKey(10);
//Fkine or ikine
robot.calculate();
}
}
int main(int argc, char* argv[])
{
int sel = -1;
int cam_id = 0;
while (sel != 0)
{
cout << "\n*****************************************************";
cout << "\n(3) Lab 3 - Virtual Camera";
cout << "\n(4) Lab 4 - Camera Calibration";
cout << "\n(5) Lab 5 - Forward Kinematics";
cout << "\n(6) Lab 6 - Inverse Kinematics";
cout << "\n(7) Lab 7 - Trajectories";
cout << "\n(0) Exit";
cout << "\n\n(1) Create Charuco board";
cout << "\n(2) Calibrate Camera";
cout << "\n>> ";
cin >> sel;
switch (sel)
{
case 1: lab1(); break;
case 2: lab2(); break;
case 3: lab3(cam_id); break;
case 4: lab4(cam_id); break;
case 5: lab5(cam_id); break;
case 6: lab6(cam_id); break;
case 7: lab7(cam_id); break;
}
}
return 1;
}