se2ez
cspacepanel.h
Go to the documentation of this file.
1 /* Author: Zachary Kingston */
2 
3 #ifndef SE2EZ_GUI_CSPACEPANEL_
4 #define SE2EZ_GUI_CSPACEPANEL_
5 
6 #include <QWidget>
7 #include <QCheckBox>
8 #include <QPainter>
9 #include <QLabel>
10 #include <QImage>
11 
12 #include <se2ez/gui/panel.h>
13 #include <se2ez/gui/jointpanel.h>
14 #include <se2ez/gui/planpanel.h>
15 #include <se2ez/gui/renderarea.h>
16 
17 #include <se2ez/plan/constraint.h>
18 
20 #include <se2ez/core/cspace.h>
21 
22 namespace Ui
23 {
24  class CSpacePanel;
25 }
26 
27 namespace se2ez
28 {
29  /** \cond IGNORE */
30  SE2EZ_CLASS_FORWARD(State)
31  SE2EZ_CLASS_FORWARD(Robot)
32  /** \endcond */
33 
34  namespace gui
35  {
36  class CSpacePanel : public Panel
37  {
38  Q_OBJECT
39 
40  public:
41  CSpacePanel(RobotPtr robot, std::string name,
43  QWidget *parent = 0);
44  ~CSpacePanel();
45 
46  void draw(QPainter &painter, RenderArea *canvas) override;
47  bool click(QMouseEvent *event, double x, double y, int sx, int sy) override;
48  void update(boost::posix_time::ptime last, boost::posix_time::ptime current) override;
49 
50  public slots:
51  void updateRobot();
52  void updateGrid();
53  void updateImage(bool force = false);
54  void updatePanel();
55 
56  void updatePlan();
57  void updatePlanData();
58  void updatePlanState();
59  void updateAnimate();
60  void updatePlanPanel();
61 
62  void updateCallback();
63  void saveImage();
64  void update();
65 
66  signals:
67  void stateChanged();
68 
69 
70  private slots:
71  void projectState();
72 
73  private:
74  CSpaceGrid::Mode getMode() const;
75 
76  void drawGraph(QPainter &painter, CSpaceGridPtr &grid, bool offset);
77  void drawPlan(QPainter &painter, CSpaceGridPtr &grid, bool offset, bool bold);
78  void drawState(QPainter &painter, CSpaceGridPtr &grid, bool offset, bool interface = true);
79 
80  void computeWheel();
81  bool lockedProjection();
82 
83  const unsigned int xPoint_{4};
84  const unsigned int yPoint_{4};
85  const unsigned int xOffset_{5};
86  const unsigned int yOffset_{5};
87  const unsigned int xBorder_{2};
88  const unsigned int yBorder_{2};
89  const unsigned int xSize_{150};
90  const unsigned int ySize_{150};
91  unsigned int xCurSize_{150};
92  unsigned int yCurSize_{150};
93  const unsigned int yText_{12};
94  const unsigned int HiRes_{3};
95  const unsigned int wheelSize_{51};
96 
97  Ui::CSpacePanel *ui_;
98 
99  RobotPtr robot_{nullptr};
100  StatePtr state_{nullptr};
101  StatePtr tempState_{nullptr};
102  CSpaceGridPtr grid_{nullptr};
103 
105 
109 
110  QImage image_;
111  QImage wheel_;
112  JointPanel *jp_{nullptr};
113  PlanPanel *pp_{nullptr};
114  QMetaObject::Connection jpc_;
115  QMetaObject::Connection ppc_;
116  QMetaObject::Connection pdc_;
117  bool imageGen_{false};
119 
120  ompl::base::PlannerDataPtr pd_{nullptr};
121 
123  ompl::base::ConstraintPtr constraint_{nullptr};
125 
126  std::thread *save_{nullptr};
127  };
128  } // namespace gui
129 } // namespace se2ez
130 
131 #endif
A shared pointer wrapper for se2ez::State.
std::set< std::string > pnames_
Definition: cspacepanel.h:107
Definition: cspacepanel.h:22
Mode
Drawing mode for the grid.
Definition: cspace.h:63
QMetaObject::Connection jpc_
Definition: cspacepanel.h:114
std::vector< StatePtr > path_
Definition: cspacepanel.h:118
std::set< std::string > panelnames_
Definition: cspacepanel.h:108
A shared pointer wrapper for se2ez::CSpaceGrid.
A shared pointer wrapper for se2ez::Robot.
QMetaObject::Connection pdc_
Definition: cspacepanel.h:116
std::set< std::string > jnames_
Definition: cspacepanel.h:106
The canvas widget. It contains all the drawing functions as well as all the general settings for draw...
Definition: renderarea.h:48
Main namespace.
Definition: collision.h:11
QMetaObject::Connection ppc_
Definition: cspacepanel.h:115
#define SE2EZ_CLASS_FORWARD(C)
Definition: class_forward.h:9
Ui::CSpacePanel * ui_
Definition: cspacepanel.h:97
std::map< std::string, ompl::base::ConstraintPtr > constraints_
Definition: cspacepanel.h:122