se2ez
scene.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>
7 #include <se2ez/gui/planpanel.h>
8 
9 using namespace se2ez;
10 
11 int main(int argc, char **argv)
12 {
13  if (argc < 2)
14  {
15  std::cout << " Use [robot] [env1] ..." << std::endl;
16  return -1;
17  }
18 
19  std::vector<RobotPtr> roboList;
20  for (int i = 1; i < argc; i++)
21  roboList.emplace_back(io::loadRobot(std::string(argv[i])));
22 
23  auto robot = roboList[0];
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  gui.addPanel(new gui::JointPanel(robot, "Rob1"));
32  gui.addPanel(new gui::JointPanel(robot, "Rob2"));
33 
34  // Add the rest of the robots in the scene
35  for (int i = 1; i < argc - 1; i++)
36  {
37  auto name = "Env" + std::to_string(i);
38  gui.addPanel(new gui::JointPanel(roboList[i], name));
39  }
40 
41  auto scene = std::make_shared<Scene>(robot);
42  gui.addPanel(new gui::ScenePanel(scene, "Scene"));
43  gui.addPanel(new gui::PlanPanel(scene->getSceneRobot(), "Plan"));
44 
45  // This must be called if you want to see a robot
46  gui.show();
47  return a.exec();
48 }
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 to_string(T... args)
T endl(T... args)
void addPanel(Panel *panel)
Adds a panel to the main GUI.
Definition: mainwindow.cpp:95
Main namespace.
Definition: collision.h:11
int main(int argc, char **argv)
Definition: scene.cpp:11
T emplace_back(T... args)