Permalink
Browse files

Added brandts code

  • Loading branch information...
1 parent 5e8e8de commit 1e255f4a0274fbdc962a77ae83fdb62ac843d9e4 @HalfdanJ HalfdanJ committed Jul 18, 2011
Showing with 306,013 additions and 0 deletions.
  1. +673 −0 brandts/ButtonMatrixMode.cpp
  2. +63 −0 brandts/ButtonMatrixMode.h
  3. +177 −0 brandts/DrawingMode.cpp
  4. +35 −0 brandts/DrawingMode.h
  5. +239 −0 brandts/FaceTrackerMode.cpp
  6. +37 −0 brandts/FaceTrackerMode.h
  7. +61 −0 brandts/IdleMode.cpp
  8. +17 −0 brandts/IdleMode.h
  9. +20 −0 brandts/Info.plist
  10. +127 −0 brandts/KeyboardMode.cpp
  11. +24 −0 brandts/KeyboardMode.h
  12. +75 −0 brandts/LightButtonMode.cpp
  13. +19 −0 brandts/LightButtonMode.h
  14. +17 −0 brandts/Mode.cpp
  15. +31 −0 brandts/Mode.h
  16. +440 −0 brandts/PaperTracker.cpp
  17. +140 −0 brandts/PaperTracker.h
  18. +112 −0 brandts/SoundInput.cpp
  19. +42 −0 brandts/SoundInput.h
  20. +26,161 −0 brandts/data/haarXML/haarcascade_frontalface_alt.xml
  21. +23,550 −0 brandts/data/haarXML/haarcascade_frontalface_alt2.xml
  22. +103,493 −0 brandts/data/haarXML/haarcascade_frontalface_alt_tree.xml
  23. +35,712 −0 brandts/data/haarXML/haarcascade_frontalface_default.xml
  24. +18,118 −0 brandts/data/haarXML/haarcascade_fullbody.xml
  25. +15,085 −0 brandts/data/haarXML/haarcascade_lowerbody.xml
  26. +31,930 −0 brandts/data/haarXML/haarcascade_profileface.xml
  27. +29,767 −0 brandts/data/haarXML/haarcascade_upperbody.xml
  28. +56 −0 brandts/data/irb60.xml
  29. BIN brandts/data/lock.png
  30. BIN brandts/data/unlock.png
  31. +465 −0 brandts/of1394VideoGrabber.cpp
  32. +122 −0 brandts/of1394VideoGrabber.h
  33. +579 −0 brandts/ofAppQtWindow.cpp
  34. +107 −0 brandts/ofAppQtWindow.h
  35. +41 −0 brandts/ofxTwitter.h
  36. BIN brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/bin/win32/FlyCapture2.dll
  37. +96 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/AVIRecorder.h
  38. +178 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/BusManager.h
  39. +981 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/Camera.h
  40. +148 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/Error.h
  41. +64 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/FlyCapture2.h
  42. +1,246 −0 .../ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/FlyCapture2Defs.h
  43. +125 −0 ...s/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/FlyCapture2GUI.h
  44. +57 −0 ...videograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/FlyCapture2Platform.h
  45. +492 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/Image.h
  46. +238 −0 .../ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/ImageStatistics.h
  47. +190 −0 ...dts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/TopologyNode.h
  48. +198 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/include/FlyCapture/Utilities.h
  49. BIN brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/FlyCapture/lib/win32/FlyCapture2.lib
  50. +245 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/camera.h
  51. +107 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/capture.h
  52. +456 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/control.h
  53. +215 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/conversions.h
  54. +57 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/dc1394.h
  55. +231 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/format7.h
  56. +167 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/iso.h
  57. +42 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/linux/capture.h
  58. +37 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/linux/control.h
  59. +255 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/log.h
  60. +229 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/register.h
  61. +166 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/types.h
  62. +105 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/utils.h
  63. +467 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/vendor/avt.h
  64. +95 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/vendor/basler.h
  65. +303 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/vendor/basler_sff.h
  66. +225 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/vendor/pixelink.h
  67. +256 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/include/dc1394/video.h
  68. BIN brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/lib/linux/libdc1394.a
  69. BIN brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/libs/dc1394/lib/osx/libdc1394.a
  70. +327 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/src/ofxVideoGrabberDc1394.cpp
  71. +88 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/src/ofxVideoGrabberDc1394.h
  72. +429 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/src/ofxVideoGrabberFlyCapture.cpp
  73. +98 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/src/ofxVideoGrabberFlyCapture.h
  74. +13 −0 brandts/ofxvideograbberptgrey/ofxVideoGrabberPtgrey/src/ofxVideoGrabberPtgrey.h
  75. +20 −0 brandts/openFrameworks-Info.plist
  76. +14 −0 brandts/openframeworksQT.pro
  77. +2,475 −0 brandts/openframeworksQT.xcodeproj/project.pbxproj
  78. +7 −0 brandts/openframeworksQT.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  79. +71 −0 brandts/openframeworksQT.xcodeproj/qt_makeqmake.mak
  80. +60 −0 brandts/openframeworksQT.xcodeproj/qt_preprocess.mak
  81. +198 −0 brandts/src/BasePlugin.cpp
  82. +65 −0 brandts/src/BasePlugin.h
  83. +141 −0 brandts/src/Controller.cpp
  84. +38 −0 brandts/src/Controller.h
  85. +33 −0 brandts/src/Data.cpp
  86. +29 −0 brandts/src/Data.h
  87. +36 −0 brandts/src/Defines.h
  88. +118 −0 brandts/src/DrawTestPattern.cpp
  89. +31 −0 brandts/src/DrawTestPattern.h
  90. +251 −0 brandts/src/FaceTracker.cpp
  91. +50 −0 brandts/src/FaceTracker.h
  92. +221 −0 brandts/src/Fiducials.cpp
  93. +38 −0 brandts/src/Fiducials.h
  94. +260 −0 brandts/src/GrabTheDrawing.cpp
  95. +62 −0 brandts/src/GrabTheDrawing.h
  96. +249 −0 brandts/src/InteractionDesign.cpp
  97. +71 −0 brandts/src/InteractionDesign.h
  98. +225 −0 brandts/src/Joystick.cpp
  99. +55 −0 brandts/src/Joystick.h
  100. +153 −0 brandts/src/MotionDetector.cpp
  101. +56 −0 brandts/src/MotionDetector.h
  102. +703 −0 brandts/src/Robot.cpp
  103. +90 −0 brandts/src/Robot.h
  104. +28 −0 brandts/src/RobotControllerItem.h
  105. +127 −0 brandts/src/VideoGrabber.cpp
  106. +42 −0 brandts/src/VideoGrabber.h
  107. +194 −0 brandts/src/glwidget.cpp
  108. +97 −0 brandts/src/glwidget.h
  109. +23 −0 brandts/src/main.cpp
  110. +171 −0 brandts/src/ofxCvHaarFinder/ofxCvHaarFinder.cpp
  111. +55 −0 brandts/src/ofxCvHaarFinder/ofxCvHaarFinder.h
  112. BIN brandts/src/ofxEasyGui/data/fonts/Helvetica Neue Bold.ttf
  113. +16 −0 brandts/src/ofxEasyGui/example/main.cpp
  114. +142 −0 brandts/src/ofxEasyGui/example/testApp.cpp
  115. +53 −0 brandts/src/ofxEasyGui/example/testApp.h
  116. +209 −0 brandts/src/ofxEasyGui/src/Button.cpp
  117. +38 −0 brandts/src/ofxEasyGui/src/Button.h
  118. +221 −0 brandts/src/ofxEasyGui/src/FileList.cpp
  119. +44 −0 brandts/src/ofxEasyGui/src/FileList.h
  120. +431 −0 brandts/src/ofxEasyGui/src/GuiHandler.cpp
  121. +78 −0 brandts/src/ofxEasyGui/src/GuiHandler.h
  122. +354 −0 brandts/src/ofxEasyGui/src/GuiPanel.cpp
  123. +81 −0 brandts/src/ofxEasyGui/src/GuiPanel.h
  124. +18 −0 brandts/src/ofxEasyGui/src/Meter.cpp
  125. +29 −0 brandts/src/ofxEasyGui/src/Meter.h
  126. +207 −0 brandts/src/ofxEasyGui/src/Radio.cpp
  127. +51 −0 brandts/src/ofxEasyGui/src/Radio.h
  128. +177 −0 brandts/src/ofxEasyGui/src/Slider.cpp
  129. +65 −0 brandts/src/ofxEasyGui/src/Slider.h
  130. +35 −0 brandts/src/ofxEasyGui/src/Spacer.h
  131. +104 −0 brandts/src/ofxEasyGui/src/TextField.cpp
  132. +40 −0 brandts/src/ofxEasyGui/src/TextField.h
  133. +240 −0 brandts/src/ofxEasyGui/src/UiObject.cpp
  134. +84 −0 brandts/src/ofxEasyGui/src/UiObject.h
  135. +14 −0 brandts/src/ofxEasyGui/src/ofxEasyGui.h
  136. +18 −0 brandts/src/src-1.moved-aside/PluginController.h
  137. +11 −0 brandts/src/src-2.moved-aside/RobotControllerItem.cpp
  138. +121 −0 brandts/src/testApp.cpp
  139. +54 −0 brandts/src/testApp.h
  140. +206 −0 brandts/src/window.cpp
  141. +98 −0 brandts/src/window.h
  142. +56 −0 simpleExample/bin/data/irb60.xml

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1,63 @@
+#pragma once
+#include "Mode.h"
+
+#include "VideoGrabber.h"
+
+class ButtonMatrixMode : public Mode{
+public:
+ ButtonMatrixMode(Robot * robot, myData * data);
+
+ void init();
+ void activate();
+ bool deactivate();
+ void step();
+ void securityCheck();
+
+
+ float pressedTimer;
+
+ bool foundMasterSafePos;
+ bool foundToSafePos;
+
+ int curButton;
+
+ QCheckBox *checkboxes[96];
+ QPushButton * storePosition[3];
+ QSlider * parSliders[3*3];
+
+ QPushButton * allOn;
+ QPushButton * allOff;
+
+ QPushButton * resetFlags;
+
+ float lightTurnedOn[96];
+
+ float* positionInformation[3*3*2];
+
+ ofxVec3f cornerPos(int n);
+ ofxVec3f cornerDir(int n);
+ ofxVec3f buttonPosition(int n);
+
+ void pictureReady(bool points[]);
+
+
+ ofxCvGrayscaleImage isLightOnImg;
+ QSlider * sliderLightOnThreshold1;
+ QSlider * sliderLightOnThreshold2;
+ bool isLightOn();
+
+ QGridLayout * gridLayout;
+
+ bool isPointInBoundingbox(ofxVec3f p, float depth);
+
+ ofxVec3f xdir();
+ ofxVec3f ydir();
+
+ ofxIndustrialRobotDefines::HandVariant v;
+ int lastButton;
+
+ bool confirmedPress;
+ int buttonRepeat;
+ VideoGrabber * vidGrabber;
+
+};
View
@@ -0,0 +1,177 @@
+/*
+ * LightButtonMode.cpp
+ * openframeworksQT
+ *
+ * Created by Jonas Jongejan on 27/07/09.
+ * Copyright 2009 HalfdanJ. All rights reserved.
+ *
+ */
+
+#include "DrawingMode.h"
+
+
+DrawingMode::DrawingMode(Robot * _robot, myData * _data){
+ name = "DrawingMode";
+ robot = _robot;
+ robotData = _data;
+ gotPicture = false;
+ timer = 0;
+ foundMasterSafePos = false;
+
+ init();
+
+ QVBoxLayout * tabLayout = new QVBoxLayout();
+ widget->setLayout(tabLayout);
+
+
+ QWidget * gridButton = new QWidget();
+ QGridLayout * gridButtonLayout = new QGridLayout();
+ gridButtonLayout->setAlignment(Qt::AlignTop);
+ gridButtonLayout->setAlignment(Qt::AlignCenter);
+ gridButton->setLayout(gridButtonLayout);
+ gridButton->setFixedHeight(50);
+ gridButton->setContentsMargins(0,0,0,0);
+
+ tabLayout->addWidget(gridButton);
+
+ lastCaptureTime = 0;
+ storePosition[0] = new QPushButton("grab_pos");
+
+ gridButtonLayout->addWidget(new QLabel("Store"), 0, 0);
+ for(int i=0;i<1;i++){
+ gridButtonLayout->addWidget(storePosition[i], 0, i+1);
+ }
+ for(int n=0;n<3*3*2;n++){
+ positionInformation[n] = new float(0);
+ }
+
+
+}
+
+
+
+void DrawingMode::init(){
+ controllerItem = robot->addRobotController("drawingMode", CONTROL_MODE_GRAVITY);
+}
+
+void DrawingMode::activate(){
+ robot->setRobotController(controllerItem);
+ rate = rate + 30;
+}
+bool DrawingMode::deactivate(){
+ if(controllerItem->locked){
+ return false;
+ }
+ return true;
+}
+
+void DrawingMode::step(){
+ rate +=0.03;
+
+
+ for(int n=0;n<1;n++){
+ if(storePosition[n]->isDown()){
+ QMessageBox msgBox;
+ msgBox.setText("You are about to change the coordinates of the buttons");
+ msgBox.setInformativeText("Are you sure you want to do it?");
+ msgBox.setStandardButtons(QMessageBox::Cancel | QMessageBox::Yes);
+ msgBox.setDefaultButton(QMessageBox::Cancel);
+ int reply = msgBox.exec();
+ if (reply == QMessageBox::Yes){
+ cout<<"Set"<<endl;
+
+ *positionInformation[n*6] = robot->industrialRobot->getCurrentTarget().x;
+ *positionInformation[n*6+1] = robot->industrialRobot->getCurrentTarget().y;
+ *positionInformation[n*6+2] = robot->industrialRobot->getCurrentTarget().z;
+ *positionInformation[n*6+3] = robot->industrialRobot->getCurrentDir().x;
+ *positionInformation[n*6+4] = robot->industrialRobot->getCurrentDir().y;
+ *positionInformation[n*6+5] = robot->industrialRobot->getCurrentDir().z;
+ storePosition[n]->setDown(false);
+ } else {
+ storePosition[n]->setDown(false);
+ }
+ }
+ }
+
+ if(isActive()){
+
+ if (!gotPicture)
+ {
+
+ if((robot->industrialRobot->getCurrentTarget()-getPos(0)).length() > 500){
+ if(!robot->industrialRobot->setGravityTarget(getPos(0), getPos(0).normalized()*ofxVec3f(1.0,0.0,1.0)-ofxVec3f(0.4,0.1,0), 0.1, 2.0, ofxIndustrialRobotDefines::Up)){
+ //cout<<(getPos(0).normalized()*ofxVec3f(1.0,0.0,1.0)).x<<" "<<(getPos(0).normalized()*ofxVec3f(1.0,0.0,1.0)).y<<" "<<(getPos(0).normalized()*ofxVec3f(1.0,0.0,1.0)).z<<endl;
+ //cout<<"Could not add drawing mode pre target"<<endl;
+ }
+ } else {
+ if(!robot->industrialRobot->setGravityTarget(getPos(0), getDir(0), 0.1, 1.0, ofxIndustrialRobotDefines::Up)){
+ cout<<"Could not add drawing mode target"<<endl;
+ } else {
+ if(robot->industrialRobot->isRobotReady(0.0001)){
+ timer ++;
+ if(timer > 30){
+ cout<<"drawing mode ready for taking photo"<<endl;
+ if(!gotPicture && grabTheDrawing->doGrab(false))
+ {
+ cout<<"Found picture"<<endl;
+ buttonMatrixMode->pictureReady(grabTheDrawing->convertToBool());
+ if(lastCaptureTime + 60000 < ofGetElapsedTimeMillis() || ofGetElapsedTimeMillis()+100 < lastCaptureTime){
+ ofImage img;
+ img.setImageType(GL_RGB);
+ img.setFromPixels(grabTheDrawing->interpretatedImg.getPixels(), grabTheDrawing->interpretatedImg.width, grabTheDrawing->interpretatedImg.height, false);
+ img.saveImage("/Brandts/picture small "+ofToString(ofGetDay(),0)+"."+ofToString(ofGetMonth(),0)+"."+ofToString(ofGetYear(),0)+" - "+ofToString(ofGetMinutes(),0)+"-"+ofToString(ofGetMinutes(),0)+"-"+ofToString(ofGetSeconds(),0)+".jpg");
+
+ ofImage img2;
+ img2.setImageType(GL_RGB);
+ img2.setFromPixels(grabTheDrawing->tmpGrayImg2.getPixels(), grabTheDrawing->tmpGrayImg2.width, grabTheDrawing->tmpGrayImg2.height, false);
+ img2.saveImage("/Brandts/picture "+ofToString(ofGetDay(),0)+"."+ofToString(ofGetMonth(),0)+"."+ofToString(ofGetYear(),0)+" - "+ofToString(ofGetMinutes(),0)+"-"+ofToString(ofGetMinutes(),0)+"-"+ofToString(ofGetSeconds(),0)+".jpg");
+
+
+
+ lastCaptureTime = ofGetElapsedTimeMillis();
+ }
+ gotPicture = true;
+ } else {
+ cout<<"No picture found"<<endl;
+ gotPicture = false;
+ }
+ rate = 0;
+ timer = 0;
+ }
+
+ }
+ }
+ }
+
+
+ }
+ }
+ else
+ {
+ if(motionDetector->isAreaActive(0, 5, 4,5, 0.35))
+ {
+ if(rate< 50 && rate > 30)
+ {
+ rate = 50;
+ }
+ rate +=0.08;
+
+ }
+ gotPicture = false;
+ }
+ if (rate > 70)
+ {
+ rate = 40;
+ }
+
+}
+
+ofxVec3f DrawingMode::getPos(int n){
+ return ofxVec3f(*positionInformation[n*6], *positionInformation[n*6+1], *positionInformation[n*6+2] );
+}
+ofxVec3f DrawingMode::getDir(int n){
+ // cout<<*positionInformation[n*6]+3<<endl;
+ //return ofxVec3f(-0,-0.3,1);
+ return ofxVec3f(*positionInformation[n*6+3], *positionInformation[n*6+4], *positionInformation[n*6+5] );
+}
+
View
@@ -0,0 +1,35 @@
+#pragma once
+#include "Mode.h"
+#include "GrabTheDrawing.h"
+#include "ButtonMatrixMode.h"
+
+#include "VideoGrabber.h"
+#include "MotionDetector.h"
+
+class DrawingMode : public Mode{
+public:
+ DrawingMode(Robot * robot, myData * data);
+
+ void init();
+ void activate();
+ bool deactivate();
+ void step();
+ ButtonMatrixMode * buttonMatrixMode;
+ float pressedTimer;
+
+ bool foundMasterSafePos;
+ MotionDetector * motionDetector;
+ QPushButton * storePosition[3];
+
+ bool gotPicture;
+ float* positionInformation[3*3*2];
+
+ GrabTheDrawing * grabTheDrawing;
+ ofxVec3f getPos(int n);
+ ofxVec3f getDir(int n);
+
+ int timer;
+ int lastCaptureTime;
+
+ VideoGrabber * vidGrabber;
+};
Oops, something went wrong.

0 comments on commit 1e255f4

Please sign in to comment.