diff --git a/README.md b/README.md index df6572d..8d990d3 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,5 @@ Addons used: ofxSpacebrew ofxLibwebsockets ofxUI -ofxXmlSettings \ No newline at end of file +ofxXmlSettings +ofxFTGL \ No newline at end of file diff --git a/of/Active Tripod/bin.zip b/of/Active Tripod/bin.zip new file mode 100644 index 0000000..b5418a5 Binary files /dev/null and b/of/Active Tripod/bin.zip differ diff --git a/of/Active Tripod/bin/Active_Tripod.lib b/of/Active Tripod/bin/Active_Tripod.lib index 920dcf1..c489dac 100644 Binary files a/of/Active Tripod/bin/Active_Tripod.lib and b/of/Active Tripod/bin/Active_Tripod.lib differ diff --git a/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml index 1ec4460..de94a55 100644 --- a/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml @@ -1,12 +1,12 @@ 2 Toggle Video Visibility - 1 + 0 2 Toggle Image Visibility - 0 + 1 4 @@ -46,22 +46,22 @@ 4 Red . - 40.263156891 + 20.970394135 4 Green . - 40.263156891 + 21.809211731 4 Blue . - 39.424343109 + 22.648025513 4 Alpha . - 207.187500000 + 255.000000000 4 diff --git a/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml index 74ec44d..1828f4f 100644 --- a/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml @@ -1,17 +1,17 @@ 4 Graph Item X Gap - 21.875000000 + 13.733552933 4 BarWidth - 17.000000000 + 8.157895088 4 Graph Height Max - 407.894744873 + 440.460510254 4 diff --git a/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml index 1a411e3..ab8a49f 100644 --- a/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml @@ -1,3 +1,13 @@ + + 2 + Toggle Draw Body + 1 + + + 2 + Toggle Draw Lines + 1 + 4 Graph Item X Gap @@ -31,12 +41,12 @@ 4 Data0 alpha - 155.180923462 + 186.217102051 4 Data1 red - 164.407897949 + 167.763153076 4 @@ -51,5 +61,5 @@ 4 Data1 alpha - 170.279602051 + 184.539474487 diff --git a/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml index 0b6dbf2..56534c8 100644 --- a/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml @@ -1,12 +1,12 @@ 2 Bar graph - 1 + 0 2 Solid Body graph - 0 + 1 2 diff --git a/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml index 6b837a7..3f3cba7 100644 --- a/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml @@ -31,7 +31,7 @@ 4 Value average amount - 3.006578922 + 20.000000000 4 diff --git a/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml index 1908c35..65a6ee7 100644 --- a/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml @@ -1,7 +1,7 @@ 2 Toggle Data Simulation - 0 + 1 4 diff --git a/of/Active Tripod/src/data/DataManager.cpp b/of/Active Tripod/src/data/DataManager.cpp index 8592abd..ca14807 100644 --- a/of/Active Tripod/src/data/DataManager.cpp +++ b/of/Active Tripod/src/data/DataManager.cpp @@ -30,7 +30,7 @@ void DataManager::setup() void DataManager::setupSpacebrew() { - string host = "54.200.6.109"; // Spacebrew::SPACEBREW_CLOUD; // "localhost"; + string host = "54.194.189.129"; // Spacebrew::SPACEBREW_CLOUD; // "localhost"; string name = "CRITICAL INFRASTRUCTURE"; string description = "Description goes here. Not sure why. Let me know if you see this and tell me if you need it"; diff --git a/of/Active Tripod/src/gui/GUI.cpp b/of/Active Tripod/src/gui/GUI.cpp index e86248d..935f6b2 100644 --- a/of/Active Tripod/src/gui/GUI.cpp +++ b/of/Active Tripod/src/gui/GUI.cpp @@ -103,6 +103,8 @@ void GUI::addBodyGraphDesignGUI() string title = "BODY GRAPH DESIGN"; ofxUICanvas* gui = getNewGUI(title); + gui->addToggle("Toggle Draw Body", &app->scene.bodyGraph.isDrawBody, toggleDim, toggleDim); + gui->addToggle("Toggle Draw Lines", &app->scene.bodyGraph.isDrawLines, toggleDim, toggleDim); gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.bodyGraph.graphItemXGap, length, dim); gui->addSlider("Line width", 1, 50, &app->scene.bodyGraph.lineWidth, length, dim); gui->addSlider("Graph Height Max", 100, 1000, &app->scene.bodyGraph.graphHeightMax, length, dim); @@ -180,7 +182,7 @@ void GUI::addHUDTextGUI() gui->addSlider("Line Length", 50, 500, &app->scene.lineLength, length, dim); gui->addSlider("Line Spacing", 0, 10, &app->scene.lineSpacing, length, dim); gui->addSlider("Text Size", 10, 100, &app->scene.textSize, length, dim); - gui->addSlider("Value average amount", 2, 20, &app->scene.averageAmount, length, dim); + gui->addSlider("Value average amount", 2, 150, &app->scene.averageAmount, length, dim); gui->addSpacer(length, 1); gui->addSlider("Red", 0, 255, &app->scene.textColour[0], length, dim); diff --git a/of/Active Tripod/src/testApp.cpp b/of/Active Tripod/src/testApp.cpp index 1fd0b2e..e673d18 100644 --- a/of/Active Tripod/src/testApp.cpp +++ b/of/Active Tripod/src/testApp.cpp @@ -2,13 +2,15 @@ // TODO // ==== -// - Add spacebrew text to text boxes -// - Add colour boxes to text +// - Make HUD BG hole size a percentage rather than pixels +// - Add option to resize video draw size (rather than making it fullscreen) and init size // - Make system to slow down data - The screen should show 15-20 minutes worth of data +// - add ability to remove the lines or body from body graph // - Make 3rd graph - separate fade // - Crosshairs in HUD // - Create graph animation system // - Create a single config file to be loaded from online location. It will contain IP address and host name +// - Add 'clear all data' button to UI // //-------------------------------------------------------------- void testApp::setup() diff --git a/of/Active Tripod/src/visual/Scene.cpp b/of/Active Tripod/src/visual/Scene.cpp index a816f0d..b27c014 100644 --- a/of/Active Tripod/src/visual/Scene.cpp +++ b/of/Active Tripod/src/visual/Scene.cpp @@ -99,27 +99,28 @@ void Scene::drawHUDCopy() vector *p0Data = &activeGraph->publisher0Data; vector *p1Data = &activeGraph->publisher1Data; - if (p0Data->size() > (int)averageAmount - 1) + int amountToAverage = MIN(p0Data->size(), averageAmount); + if (p0Data->size() > 2) { float average0 = 0; - for (int i = 0; i < (int)averageAmount; i++) + for (int i = 0; i < (int)amountToAverage; i++) average0 += p0Data->at(p0Data->size() - i - 1).value; - average0 /= (int)averageAmount; + average0 /= (int)amountToAverage; // (p0Data->back() + p0Data->at(p0Data->size() - 2) + p0Data->at(p0Data->size() - 2)) - blStr = ofToString(p0Data->back().value - p0Data->at(p0Data->size() - 2).value) + "\n" + - ofToString(p0Data->back().value) + "\n" + + blStr = "Increase: " + ofToString(p0Data->back().value - p0Data->at(p0Data->size() - 2).value) + "\n" + + "Current Value: " + ofToString(p0Data->back().value) + "\n" + "Running average: " + ofToString(average0); drawTextBox(blStr, "BOTTOM LEFT"); float average1 = 0; - for (int i = 0; i < (int)averageAmount; i++) + for (int i = 0; i < (int)amountToAverage; i++) average1 += p1Data->at(p1Data->size() - i - 1).value; - average1 /= (int)averageAmount; + average1 /= (int)amountToAverage; - brStr = ofToString(p1Data->back().value - p1Data->at(p1Data->size() - 2).value) + "m/s\n" + - ofToString(p1Data->back().value) + "\n" + + brStr = "Increase: " + ofToString(p1Data->back().value - p1Data->at(p1Data->size() - 2).value) + "\n" + + "Current Value: " + ofToString(p1Data->back().value) + "\n" + "Running average: " + ofToString(average1); drawTextBox(brStr, "BOTTOM RIGHT"); } diff --git a/of/Active Tripod/src/visual/graph/BodyGraph.cpp b/of/Active Tripod/src/visual/graph/BodyGraph.cpp index 716f8bc..7aa1527 100644 --- a/of/Active Tripod/src/visual/graph/BodyGraph.cpp +++ b/of/Active Tripod/src/visual/graph/BodyGraph.cpp @@ -38,52 +38,58 @@ void BodyGraph::draw() float outputMin = (ofGetHeight() * 0.5) - graphHeightMax; float outputMax = (ofGetHeight() * 0.5) + graphHeightMax; - // draw main part of graph (body) - ofMesh body; - body.setMode(OF_PRIMITIVE_TRIANGLE_STRIP); - for (int i = 0; i < publisher0Data.size() - 1; i++) + if (isDrawBody) { - body.addVertex(ofVec3f( - i * graphItemXGap + xOffset, - ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax), - 0)); - body.addVertex(ofVec3f( - i * graphItemXGap + xOffset, - ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax), - 0)); - - body.addColor(ofColor(col0[0],col0[1],col0[2], col0[3])); - body.addColor(ofColor(col1[0],col1[1],col1[2], col1[3])); - } - - body.drawFaces(); - - - // draw lines - ofPushStyle(); - ofPolyline poly0; - ofPolyline poly1; - for (int i = 0; i < publisher0Data.size() - 1; i++) - { - if (i < publisher0Data.size() - 1) + // draw main part of graph (xOffset) + ofMesh body; + body.setMode(OF_PRIMITIVE_TRIANGLE_STRIP); + for (int i = 0; i < publisher0Data.size() - 1; i++) { - ofSetLineWidth(lineWidth); - poly0.addVertex(ofPoint( - i * graphItemXGap + xOffset, - ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax))); - - - poly1.addVertex(ofPoint( - i * graphItemXGap + xOffset, - ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax))); + body.addVertex(ofVec3f( + i * graphItemXGap + xOffset, + ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax), + 0)); + body.addVertex(ofVec3f( + i * graphItemXGap + xOffset, + ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax), + 0)); + + body.addColor(ofColor(col0[0],col0[1],col0[2], col0[3])); + body.addColor(ofColor(col1[0],col1[1],col1[2], col1[3])); } + + body.drawFaces(); } - ofSetColor(col0[0],col0[1],col0[2], 255); - poly0.draw(); - ofSetColor(col1[0],col1[1],col1[2], 255); - poly1.draw(); - ofPopStyle(); + + if (isDrawLines) + { + // draw lines + ofPushStyle(); + ofPolyline poly0; + ofPolyline poly1; + for (int i = 0; i < publisher0Data.size() - 1; i++) + { + if (i < publisher0Data.size() - 1) + { + ofSetLineWidth(lineWidth); + poly0.addVertex(ofPoint( + i * graphItemXGap + xOffset, + ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax))); + + + poly1.addVertex(ofPoint( + i * graphItemXGap + xOffset, + ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax))); + } + } + + ofSetColor(col0[0],col0[1],col0[2], 255); + poly0.draw(); + ofSetColor(col1[0],col1[1],col1[2], 255); + poly1.draw(); + ofPopStyle(); + } } } diff --git a/of/Active Tripod/src/visual/graph/BodyGraph.h b/of/Active Tripod/src/visual/graph/BodyGraph.h index 30c0732..f59e781 100644 --- a/of/Active Tripod/src/visual/graph/BodyGraph.h +++ b/of/Active Tripod/src/visual/graph/BodyGraph.h @@ -14,4 +14,7 @@ public: float barWidth; float lineWidth; + + bool isDrawBody; + bool isDrawLines; }; \ No newline at end of file