LARS
LARS (Light Augmented Reality System) is an open-source framework for light-based interaction and real-time tracking in multi-robot experiments. Inspired by ARK, LARS extends the augmented reality paradigm to robotic collectives by projecting dynamic visual cues and environments onto the arena, enabling new experimental possibilities for collective robotics research, education, and outreach. LARS features integrated tracking, light projection, and modular experiment control with a user-friendly Qt GUI.
Loading...
Searching...
No Matches
renderarea.h
1#ifndef RENDERAREA_H
2#define RENDERAREA_H
3
4#include <QWidget>
5#include <QPainter>
6#include <QTimer>
7
8
9#include "ui/worldmodel.h"
10
11#include "geom/voronoiGenerator.h"
12
13#define Pi 3.141592653589793238
14
15#define WORLD_SCALE 10
16#define DOUBLE_CENTER_X 476
17#define DOUBLE_CENTER_Y 319
18#define SINGLE_CENTER_X 370
19#define SINGLE_CENTER_Y 270
20
21#define ROBOT_R 9
22#define ROBOT_D 18
23
24#define BALL_R 4
25#define NODE 4
26
27#define ANGLE_TO_CHORD(a) 16*((a)*180/Pi+40), 16*280
28
29class RenderArea : public QWidget
30{
31 Q_OBJECT
32public:
33 explicit RenderArea(WorldModel *wm);
34private:
35
36// QVector<Kilobot *> _kiloList;
37 WorldModel* _wm;
38
39// QPainter painter;
40
41 QBrush *brush_field, *brush_insideRect, *brush_yrobot, *brush_yrobot_MT, *brush_brobot, *brush_test;
42 QBrush *brush_initPoints, *brush_initPoints2;
43 QTimer _timer; //, _noiseTimer;
44 int bias_X, bias_Y;
45
46 QPen *pen_insideRect, *pen_RobCust1, *pen_pnts2Draw, *pen_circ2Draw, *pen_network, *pen_voronoii, *pen_tracePnts;
47
48 QPixmap marker0, marker1, marker2, marker3;
49 QPixmap arenaImg, SCIoIImg, webPage, centroidImage, ballImage;
50 QRadialGradient *radGradient, *radGradientRob;
51 QRect *expArena;
52 int robRad;
53
54 cv::Mat heatMapTemp;
55 QImage heatMapQImage;
56
57 QRect bigFieldRect;
58 QPolygon bigFieldPoly;
59
60 QImage arenaImage;
61
62 bool refreshNoiseBool = false;
63
64 voronoiGenerator VoronoiiGen;
65 boost::polygon::voronoi_diagram<double> vd;
66
67 int centroid_width = 30;
68
69 int index_node_to_light_net = -1;
70
71 igraph_t graph;
72 igraph_vector_int_t edges;
73
74
75signals:
76
77public slots:
78 void refresh();
79// void toggleNoiseBool();
80 void paintEvent(QPaintEvent *);
81 void updatePainters();
83
84protected:
85 int getMostCentralNode(const igraph_t &graph);
86};
87
88#endif // RENDERAREA_H
void updatePainters()
Update painter objects (brushes, pens, gradients) to match current WorldModel state.
Definition renderarea.cpp:650
void paintEvent(QPaintEvent *)
Handles the paint event for the RenderArea widget.
Definition renderarea.cpp:199
RenderArea(WorldModel *wm)
Constructs a RenderArea widget for rendering graphical elements in the UI.
Definition renderarea.cpp:53
int getMostCentralNode(const igraph_t &graph)
Returns the index of the most central node in a graph (by degree centrality).
Definition renderarea.cpp:175
void updateGradientPainter()
Updates the gradient painter for the arena background, based on arena size and center.
Definition renderarea.cpp:673
void refresh()
Refresh the RenderArea display.
Definition renderarea.cpp:163
Definition worldmodel.h:41
Definition voronoiGenerator.h:21