se2ez
cspace_gui.cpp
Go to the documentation of this file.
1 /* Author: Zachary Kingston */
2 
3 #include <QFileDialog>
4 
5 #include <se2ez/core.h>
6 #include <se2ez/gui.h>
7 #include <se2ez/plan.h>
8 
9 #include <se2ez/gui/jointpanel.h>
10 #include <se2ez/gui/planpanel.h>
11 #include <se2ez/gui/cspacepanel.h>
12 
13 using namespace se2ez;
14 
15 int main(int argc, char **argv)
16 {
17  QApplication a(argc, argv);
18 
19  std::string filename;
20  if (argc < 2)
21  {
22  QString tmp =
23  QFileDialog::getOpenFileName(nullptr, "Open File", SE2EZ_YAML_DIRECTORY, "YAML (*.yml *.yaml)");
24  filename = tmp.toStdString();
25  }
26  else
27  filename = std::string(argv[1]);
28 
29  auto robot = io::loadRobot(filename);
30  if (!robot)
31  return -1;
32 
33  auto constraints = plan::loadConstraints(robot, filename);
34  gui::MainWindow gui;
35 
36  gui.addPanel(new gui::CSpacePanel(robot, "CSpace", constraints));
37  gui.addPanel(new gui::JointPanel(robot, "Robot"));
38 
39  gui.show();
40  return a.exec();
41 }
RobotPtr loadRobot(const std::string &filename)
Loads a robot from a YAML file.
Definition: yaml.cpp:303
The main widget that acts a container for other widgets (canvas, panels). It also delegates the drawi...
Definition: mainwindow.h:34
void addPanel(Panel *panel)
Adds a panel to the main GUI.
Definition: mainwindow.cpp:95
std::map< std::string, ompl::base::ConstraintPtr > loadConstraints(const RobotPtr &robot, const std::string &filename)
Definition: yaml.cpp:135
Main namespace.
Definition: collision.h:11
int main(int argc, char **argv)
Definition: cspace_gui.cpp:15