4 #include <visp3/ustk_core/usConfig.h>
6 #if defined(VISP_HAVE_MODULE_USTK_GUI) && defined(VISP_HAVE_MODULE_USTK_GRABBER) && defined(VISP_HAVE_VIPER850)
8 #include <visp3/ustk_grabber/usNetworkGrabberPreScan2D.h>
9 #include <visp3/ustk_gui/usConfidenceMapController.h>
10 #include <visp3/ustk_gui/usImageDisplayWidgetRobotControl.h>
11 #include <visp3/ustk_gui/usRobotManualControlWidget.h>
12 #include <visp3/ustk_gui/usUltrasonixClientWidget.h>
13 #include <visp3/ustk_gui/usViper850WrapperVelocityControl.h>
15 #include <QApplication>
16 #include <QHBoxLayout>
17 #include <QMainWindow>
19 int main(
int argc,
char **argv)
22 QApplication app(argc, argv);
23 app.setApplicationName(QString(
"USTK display widget"));
31 usUltrasonixClientWidget *ultrasonixControlWidet =
new usUltrasonixClientWidget();
33 QWidget *centralWidget =
new QWidget();
34 QHBoxLayout *mainLayout =
new QHBoxLayout();
35 mainLayout->addWidget(ultrasonixControlWidet);
36 mainLayout->addWidget(widget, 2);
37 mainLayout->addWidget(robotControlPanel);
38 centralWidget->setLayout(mainLayout);
41 QThread *threadRobotControl =
new QThread();
43 viperControl.moveToThread(threadRobotControl);
44 threadRobotControl->start();
48 usConfidenceMapController *confidenceController =
new usConfidenceMapController();
49 QThread *confidenceThread =
new QThread();
50 confidenceController->moveToThread(confidenceThread);
51 confidenceThread->start();
54 QThread *grabbingThread =
new QThread();
56 qtGrabber->moveToThread(grabbingThread);
57 grabbingThread->start();
60 window.setCentralWidget(centralWidget);
61 window.resize(1280, 480);
65 QObject::connect(robotControlPanel, SIGNAL(changeVX(
int)), &viperControl, SLOT(setXVelocity(
int)));
66 QObject::connect(robotControlPanel, SIGNAL(changeVY(
int)), &viperControl, SLOT(setYVelocity(
int)));
67 QObject::connect(robotControlPanel, SIGNAL(changeVZ(
int)), &viperControl, SLOT(setZVelocity(
int)));
68 QObject::connect(robotControlPanel, SIGNAL(changeWX(
int)), &viperControl, SLOT(setXAngularVelocity(
int)));
69 QObject::connect(robotControlPanel, SIGNAL(changeWY(
int)), &viperControl, SLOT(setYAngularVelocity(
int)));
70 QObject::connect(robotControlPanel, SIGNAL(changeWZ(
int)), &viperControl, SLOT(setZAngularVelocity(
int)));
73 QObject::connect(widget, SIGNAL(moveLeft()), &viperControl, SLOT(moveLeft()));
74 QObject::connect(widget, SIGNAL(moveRight()), &viperControl, SLOT(moveRight()));
75 QObject::connect(widget, SIGNAL(stopMove()), &viperControl, SLOT(stopMoveLateral()));
77 QObject::connect(robotControlPanel, SIGNAL(initRobot()), &viperControl, SLOT(init()));
78 QObject::connect(robotControlPanel, SIGNAL(startRobot()), &viperControl, SLOT(run()));
79 QObject::connect(robotControlPanel, SIGNAL(stopRobot()), &viperControl, SLOT(stop()));
81 QObject::connect(robotControlPanel, SIGNAL(activateAutomaticForceControl()), &viperControl,
82 SLOT(startAutomaticForceControl()));
83 QObject::connect(robotControlPanel, SIGNAL(disableAutomaticForceControl()), &viperControl,
84 SLOT(stopAutomaticForceControl()));
87 QObject::connect(&viperControl, SIGNAL(robotError()), robotControlPanel, SLOT(robotErrorSlot()));
90 qRegisterMetaType<QHostAddress>(
"QHostAddress");
91 qRegisterMetaType<usNetworkGrabber::usInitHeaderSent>(
"usNetworkGrabber::usInitHeaderSent");
92 QObject::connect(ultrasonixControlWidet, SIGNAL(connectToServer(QHostAddress)), qtGrabber,
93 SLOT(connectToServer(QHostAddress)));
96 QObject::connect(ultrasonixControlWidet, SIGNAL(center3DProbeMotor()), qtGrabber, SLOT(center3DProbeMotor()));
97 QObject::connect(ultrasonixControlWidet, SIGNAL(runAcquisition()), qtGrabber, SLOT(runAcquisition()));
98 QObject::connect(ultrasonixControlWidet, SIGNAL(stopAcquisition()), qtGrabber, SLOT(stopAcquisition()));
101 qRegisterMetaType<usImagePreScan2D<unsigned char> >(
"usImagePreScan2D<unsigned char>");
108 QObject::connect(widget, SIGNAL(confidenceServoing(
bool)), confidenceController, SLOT(activateController(
bool)));
109 QObject::connect(confidenceController, SIGNAL(updateProbeOrientation(
int)), &viperControl,
110 SLOT(setZAngularVelocity(
int)));
111 QObject::connect(confidenceController, SIGNAL(confidenceBarycenterAngle(
double)), widget,
112 SLOT(updateConfidenceAngle(
double)));
118 grabbingThread->exit();
121 delete robotControlPanel;
122 delete centralWidget;
124 delete grabbingThread;
133 std::cout <<
"You should build ustk_gui and ustk_grabber, and have a viper850 robot to run this tutorial"
Specific class to grab pre-scan frames from the ultrasound station on the network.