se2ez
experience.cpp
Go to the documentation of this file.
1 /* Author: Constantinos Chamzas */
2 #include <se2ez/core.h>
3 #include <se2ez/gui.h>
4 #include <se2ez/gui/jointpanel.h>
5 #include <se2ez/gui/scenepanel.h>
6 #include <se2ez/gui/planpanel.h>
7 
8 using namespace se2ez;
9 
10 int main(int argc, char **argv)
11 {
12  if (argc < 2)
13  {
14  std::cout << "Please give 2 filenames to load!" << std::endl;
15  return -1;
16  }
17 
18  auto robot = io::loadRobot(std::string(argv[1]));
19  auto robot2 = io::loadRobot(std::string(argv[1]));
20  auto env = io::loadRobot(std::string(argv[2]));
21 
22  if (!robot || !env || !robot2)
23  return -1;
24 
25  std::cout << robot->printTree() << std::endl;
26 
27  QApplication a(argc, argv);
28  gui::MainWindow gui;
29 
30  // This robot is connected with the planning panel
31  auto panel1 = new gui::JointPanel(robot, "Rob1");
32 
33  // This robot is independent from the planning panel
34  auto panel2 = new gui::JointPanel(robot, "Rob2");
35 
36  // This simply contains the pairs of circles
37  auto panel3 = new gui::JointPanel(env, "Circ1");
38  auto panel4 = new gui::JointPanel(env, "Circ2");
39 
40  // TODO make a copy robot function
41  auto scene = std::make_shared<Scene>(robot2);
42  auto panel5 = new gui::ScenePanel(scene, "Scene");
43 
44  auto panel6 = new gui::PlanPanel(scene->getSceneRobot(), "Plan");
45 
46  // This must be called if you want to see a robot
47  gui.addPanel(panel1);
48  gui.addPanel(panel2);
49  gui.addPanel(panel3);
50  gui.addPanel(panel4);
51  gui.addPanel(panel5);
52  gui.addPanel(panel6);
53 
54  gui.show();
55 
56  return a.exec();
57 }
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
T endl(T... args)
void addPanel(Panel *panel)
Adds a panel to the main GUI.
Definition: mainwindow.cpp:95
int main(int argc, char **argv)
Definition: experience.cpp:10
Main namespace.
Definition: collision.h:11