本文整理汇总了C++中Translator::deltaToReal方法的典型用法代码示例。如果您正苦于以下问题:C++ Translator::deltaToReal方法的具体用法?C++ Translator::deltaToReal怎么用?C++ Translator::deltaToReal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translator
的用法示例。
在下文中一共展示了Translator::deltaToReal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
// Ensure corrent number of arguments provided
if (argc != ARG_COUNT) {
cout << "Incorrect argument count" << endl;
return -1;
}
// Handle shutdown
signal(SIGINT, sigint_handler);
// Delta Robot
DeltaRobot delta(serial, 1, 2, 3, 4);
delta.ctrlWindow();
bool torque = true;
// RGBD Camera
if (!camera.connect(1)) {
cout << "Failed to connect to camera" << endl;
return -3;
}
filter.ctrlWindow();
// Detector
Detector detect(detectorTraining);
detect.ctrlWindow();
// Bandaid orientation
Bandaid bandaid(camera.getFX(), camera.getFY());
// TODO: Clean
vector<Rect> rects;
Pathing path(&camera, translate);
while (state != Shutdown) {
// Get camera frame
camera.getFrames();
rgb = camera.getRGB();
depth = camera.getDepth();
grey = camera.getGrey();
// Filter out end effector
// if (!filter.started()) {
// filter.start(rgb, depth);
// }
// Vector2i effectorPos2D = camera.to2D(
// translate.deltaToCamera(delta.getPos()));
// filter.clean(rgb, depth, effectorPos2D);
// Update pathing depth map
Vector3f effectorPos3D = translate.deltaToReal(delta.getPos());
if (effectorPos3D[1] > 200) {
path.setDepth(depth);
}
imshow("path", path.depth);
path.setPosition(effectorPos3D);
Mat mask = Mat::zeros(depth.size(), CV_8UC1);
bool found = false;
// Display current images
switch (state) {
case Idle:
imshow("main", rgb);
imshow("depth", depth / 4500.0f);
setMouseCallback("main", onMouse, 0 );
setMouseCallback("depth", onMouse, 0 );
break;
case HandDetect:
// Detect hand
found = detect.detectHand(depth, mask);
if (found) {
Mat red(rgb.rows, rgb.cols, CV_8UC4);
red.setTo(Scalar(0, 0, 255));
red.copyTo(rgb, mask);
}
imshow("main", rgb);
imshow("depth", depth / 4500.0f);
break;
case Shutdown:
// Nothing
break;
}
Vector3f pos, end;
Vector2i point, point2;
float angle;
char input[32];
vector<Vector3i> t;
vector<Vector3f> f, f2;
vector<uint8_t> send;
switch (waitKey(1) & 0xFF) {
case 'h': // Hide the end effector
delta.setPosition(Vector3f(0, -180, -600));
break;
case 'f': // Find hand
if (state == HandDetect) {
state = Idle;
} else {
//.........这里部分代码省略.........