@@ -18,36 +18,37 @@ int main() {
18
18
// D5R::D5Robot robot(port.c_str());
19
19
D5R::D5Robot robot;
20
20
21
- // try {
22
- // robot.InitNator();
23
- // } catch (D5R::RobotException &e) {
24
- // std::cout << e.what() << std::endl;
25
- // }
26
-
27
- // try {
28
- // robot.InitRMD(port.c_str());
29
- // } catch (D5R::RobotException &e) {
30
- // std::cout << e.what() << std::endl;
31
- // }
32
-
33
21
try {
34
- robot.InitRMD (port. c_str () );
22
+ robot.InitNator ( );
35
23
} catch (D5R::RobotException &e) {
36
24
std::cout << e.what () << std::endl;
37
25
}
38
26
39
27
try {
40
- robot.InitCamera ( );
28
+ robot.InitRMD (port. c_str () );
41
29
} catch (D5R::RobotException &e) {
42
30
std::cout << e.what () << std::endl;
43
31
}
32
+
44
33
// try {
45
- // robot.InitCamera ();
34
+ // robot.InitTopCamera ();
46
35
// } catch (D5R::RobotException &e) {
47
36
// std::cout << e.what() << std::endl;
48
37
// }
49
38
50
- // robot.JointsMoveAbsolute({300, 4000000, 5000000, -10000000, 0});
39
+ try {
40
+ robot.InitBotCamera ();
41
+ } catch (D5R::RobotException &e) {
42
+ std::cout << e.what () << std::endl;
43
+ }
44
+
45
+ // robot.JointsMoveAbsolute({0, 0, 10000000, 0, 0});
46
+ // robot.Stop();
47
+ // robot.topRMDMotor->GoAngleAbsolute(-17700);
48
+ // robot.topRMDMotor->SetZero();
49
+ // robot.Stop();
50
+ // robot.Stop();
51
+ // robot.SetZero();
51
52
// robot.JointsMoveAbsolute({300, -3650000, 1800000, -10000000, 0}); // 别动
52
53
53
54
// robot.Stop();
@@ -80,22 +81,40 @@ int main() {
80
81
// cv::waitKey(0);
81
82
82
83
// 测试相机
83
- cv::Mat img ;
84
+ cv::Mat img_top ;
84
85
std::string winname = " test" ;
85
86
cv::namedWindow (winname, cv::WINDOW_NORMAL);
86
87
cv::resizeWindow (winname, cv::Size (1295 , 1024 ));
87
88
int count = 0 ;
88
- while (robot.topCamera ->Read (img)) {
89
+ // while (robot.topCamera->Read(img_top)) {
90
+
91
+ // cv::imshow(winname, img_top);
92
+ // if (cv::waitKey(1) == 27) {
93
+ // break;
94
+ // }
95
+ // if (cv::waitKey(1) == 32) {
96
+ // // robot.topCamera.GetMapParam(img_top);
97
+ // std::string filename =
98
+ // "../image/11_24/topC_clamp_rang_" + std::to_string(count++) + ".png";
99
+ // cv::imwrite(filename, img_top);
100
+ // // std::cout << count++ << std::endl;
101
+ // continue;
102
+ // }
103
+ // }
104
+ // cv::waitKey(0);
105
+ cv::Mat img_bot;
106
+ count = 0 ;
107
+ while (robot.botCamera ->Read (img_bot)) {
89
108
90
- cv::imshow (winname, img );
109
+ cv::imshow (winname, img_bot );
91
110
if (cv::waitKey (1 ) == 27 ) {
92
111
break ;
93
112
}
94
113
if (cv::waitKey (1 ) == 32 ) {
95
- // robot.topCamera.GetMapParam(img );
114
+ // robot.topCamera.GetMapParam(img_bot );
96
115
std::string filename =
97
116
" ../image/11_24/topC_clamp_rang_" + std::to_string (count++) + " .png" ;
98
- cv::imwrite (filename, img );
117
+ cv::imwrite (filename, img_bot );
99
118
// std::cout << count++ << std::endl;
100
119
continue ;
101
120
}
0 commit comments