diff --git a/gazebo_sim/launch/gazebo_sim.launch b/gazebo_sim/launch/gazebo_sim.launch
index cb606b8..64b5ae2 100644
--- a/gazebo_sim/launch/gazebo_sim.launch
+++ b/gazebo_sim/launch/gazebo_sim.launch
@@ -5,5 +5,5 @@
-
-
\ No newline at end of file
+
+
diff --git a/qt_pi/CMakeLists.txt b/qt_pi/CMakeLists.txt
index 89b083e..d858d67 100644
--- a/qt_pi/CMakeLists.txt
+++ b/qt_pi/CMakeLists.txt
@@ -48,15 +48,21 @@ include_directories(include
add_library(ble_connect include/ble_connect/ble_connect.h src/ble_connect.c)
target_link_libraries(ble_connect ${GATTLIB_LIBRARIES} ${GATTLIB_LDFLAGS} ${GLIB_LDFLAGS} pthread ${Mcrypt_LIBS})
-#ble_connect_test executable generation
-add_executable(ble_connect_test tests/ble_test.cpp)
-target_link_libraries(ble_connect_test ble_connect)
-
-
#speller library generation
add_library(speller ${SRCS} ${FORMS_HPP} ${MOC_HPP} ${RCC} ${HPP})
target_link_libraries(speller Qt5::Widgets Qt5::Core Qt5::OpenGL Qt5::Gui ${catkin_LIBRARIES} ble_connect)
+
+#ble_connect_test executable generation
+add_executable(ble_connect_test tests/ble_test.cpp)
+target_link_libraries(ble_connect_test ble_connect)
+
+#QImage view test executable generation
+add_executable(map_load_test tests/map_load_test.cpp)
+target_link_libraries(map_load_test speller)
+
+
+
#main executable generation
add_executable(speller_ui src/main.cpp)
target_link_libraries(speller_ui speller)
diff --git a/qt_pi/include/ble_connect/ble_connect.h b/qt_pi/include/ble_connect/ble_connect.h
index c5cccbc..d200262 100644
--- a/qt_pi/include/ble_connect/ble_connect.h
+++ b/qt_pi/include/ble_connect/ble_connect.h
@@ -23,7 +23,7 @@ extern int insight_destroy();
extern int insight_get_status();
extern int insight_start_notif();
extern int insight_stop_notif();
-extern void insight_write_to_buffer(int len, struct insight_data *buf);
+extern int insight_write_to_buffer(int len, struct insight_data *buf);
extern int insight_buffer_status();
extern int insight_stop_write_to_buffer();
extern int insight_version();
diff --git a/qt_pi/include/mapview/mapview.h b/qt_pi/include/mapview/mapview.h
index 87821d7..3ee4752 100644
--- a/qt_pi/include/mapview/mapview.h
+++ b/qt_pi/include/mapview/mapview.h
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -37,33 +38,31 @@ protected:
void teardownGL();
void printContextInformation();
-signals:
- void update_GUI();
- void keyPress(QKeyEvent *key);
-
private:
QOpenGLBuffer m_vertex;
QOpenGLVertexArrayObject m_object;
QOpenGLShaderProgram *m_program;
+ QOpenGLBuffer map_vertex;
+ QOpenGLVertexArrayObject map_object;
+ QOpenGLShaderProgram *map_program;
+ QOpenGLTexture *map_texture;
+
volatile int sleep_control = 1;
volatile int blinking;
+ int map_redraw;
std::thread *t;
void run();
void keyPressEvent(QKeyEvent *key) override;
- // QTimer *t1;
- // QTimer *t2;
- // QTimer *t3;
- // QTimer *t4;
- // int blinking = 0;
- // int state = 0;
- // private slots:
- // void t1Slot();
- // void t2Slot();
- // void t3Slot();
- // void t4Slot();
+
+signals:
+ void update_GUI();
+ void keyPress(QKeyEvent *key);
+ void map_loaded();
+private slots:
+ void load_texture(int, Vertex *texture, QImage map_img);
};
#endif
diff --git a/qt_pi/include/mapview/vertex.h b/qt_pi/include/mapview/vertex.h
index 9530a26..7b5f2dd 100644
--- a/qt_pi/include/mapview/vertex.h
+++ b/qt_pi/include/mapview/vertex.h
@@ -1,31 +1,40 @@
#ifndef VERTEX_H
#define VERTEX_H
+#include
#include
+#include
class Vertex {
public:
// Constructors
Q_DECL_CONSTEXPR Vertex();
Q_DECL_CONSTEXPR explicit Vertex(const QVector3D &position);
- Q_DECL_CONSTEXPR Vertex(const QVector3D &position, const QVector3D &color);
+ Q_DECL_CONSTEXPR Vertex(const QVector3D &position, const QVector4D &color);
+ Q_DECL_CONSTEXPR Vertex(const QVector3D &position, const QVector4D &color,
+ const QVector2D &texCoord);
// Accessors / Mutators
Q_DECL_CONSTEXPR const QVector3D &position() const;
- Q_DECL_CONSTEXPR const QVector3D &color() const;
+ Q_DECL_CONSTEXPR const QVector4D &color() const;
+ Q_DECL_CONSTEXPR const QVector2D &texCoord() const;
void setPosition(const QVector3D &position);
- void setColor(const QVector3D &color);
+ void setColor(const QVector4D &color);
+ void setTexCoord(const QVector2D &texCoord);
// OpenGL Helpers
static const int PositionTupleSize = 3;
- static const int ColorTupleSize = 3;
+ static const int ColorTupleSize = 4;
+ static const int TexCoordTupleSize = 2;
static Q_DECL_CONSTEXPR int positionOffset();
static Q_DECL_CONSTEXPR int colorOffset();
+ static Q_DECL_CONSTEXPR int texCoordOffset();
static Q_DECL_CONSTEXPR int stride();
private:
QVector3D m_position;
- QVector3D m_color;
+ QVector4D m_color;
+ QVector2D m_texCoord;
};
/*******************************************************************************
@@ -40,21 +49,30 @@ Q_DECL_CONSTEXPR inline Vertex::Vertex() {}
Q_DECL_CONSTEXPR inline Vertex::Vertex(const QVector3D &position)
: m_position(position) {}
Q_DECL_CONSTEXPR inline Vertex::Vertex(const QVector3D &position,
- const QVector3D &color)
+ const QVector4D &color)
: m_position(position), m_color(color) {}
+Q_DECL_CONSTEXPR inline Vertex::Vertex(const QVector3D &position,
+ const QVector4D &color,
+ const QVector2D &texCoord)
+ : m_position(position), m_color(color), m_texCoord(texCoord) {}
// Accessors / Mutators
Q_DECL_CONSTEXPR inline const QVector3D &Vertex::position() const {
return m_position;
}
-Q_DECL_CONSTEXPR inline const QVector3D &Vertex::color() const {
+Q_DECL_CONSTEXPR inline const QVector4D &Vertex::color() const {
return m_color;
}
+Q_DECL_CONSTEXPR inline const QVector2D &Vertex::texCoord() const {
+ return m_texCoord;
+}
void inline Vertex::setPosition(const QVector3D &position) {
m_position = position;
}
-void inline Vertex::setColor(const QVector3D &color) { m_color = color; }
-
+void inline Vertex::setColor(const QVector4D &color) { m_color = color; }
+void inline Vertex::setTexCoord(const QVector2D &texCoord) {
+ m_texCoord = texCoord;
+}
// OpenGL Helpers
Q_DECL_CONSTEXPR inline int Vertex::positionOffset() {
return offsetof(Vertex, m_position);
@@ -62,6 +80,9 @@ Q_DECL_CONSTEXPR inline int Vertex::positionOffset() {
Q_DECL_CONSTEXPR inline int Vertex::colorOffset() {
return offsetof(Vertex, m_color);
}
+Q_DECL_CONSTEXPR inline int Vertex::texCoordOffset() {
+ return offsetof(Vertex, m_texCoord);
+}
Q_DECL_CONSTEXPR inline int Vertex::stride() { return sizeof(Vertex); }
#endif // VERTEX_H
diff --git a/qt_pi/include/speller/speller.h b/qt_pi/include/speller/speller.h
index 5d90381..906f936 100644
--- a/qt_pi/include/speller/speller.h
+++ b/qt_pi/include/speller/speller.h
@@ -1,6 +1,7 @@
#ifndef SPELLER
#define SPELLER
+#include "QLabel"
#include "ble_connect/ble_connect.h"
#include "mapview/mapview.h"
#include
@@ -10,6 +11,9 @@
#include
#include
#include