Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added templates to rc

  • Loading branch information...
commit 17e11b902858a71adf77a4e7e226e9e130a8986a 1 parent f384e87
@bmcdorman bmcdorman authored
Showing with 347 additions and 2 deletions.
  1. +7 −2 CMakeLists.txt
  2. BIN  rc/templates/C Files/Blank.png
  3. 0  rc/templates/C Files/Blank.template
  4. BIN  rc/templates/C Files/C.png
  5. 0  rc/templates/C Files/C.template
  6. BIN  rc/templates/C Files/Header.png
  7. +9 −0 rc/templates/C Files/Header.template
  8. BIN  rc/templates/C++ Files/Blank.png
  9. 0  rc/templates/C++ Files/Blank.template
  10. BIN  rc/templates/C++ Files/C++.png
  11. +13 −0 rc/templates/C++ Files/C++.template
  12. BIN  rc/templates/C++ Files/Header.png
  13. +9 −0 rc/templates/C++ Files/Header.template
  14. 0  rc/templates/Common Lisp Files/Blank.template
  15. BIN  rc/templates/Java Files/Blank.png
  16. 0  rc/templates/Java Files/Blank.template
  17. BIN  rc/templates/Java Files/Examples/Buttons.png
  18. +36 −0 rc/templates/Java Files/Examples/Buttons.template
  19. BIN  rc/templates/Java Files/Examples/Camera.png
  20. +19 −0 rc/templates/Java Files/Examples/Camera.template
  21. BIN  rc/templates/Java Files/Examples/Create Distance Sensor.png
  22. +42 −0 rc/templates/Java Files/Examples/Create Distance Sensor.template
  23. BIN  rc/templates/Java Files/Examples/ET Calibrator.png
  24. +68 −0 rc/templates/Java Files/Examples/ET Calibrator.template
  25. BIN  rc/templates/Java Files/Examples/Framebuffer.png
  26. +55 −0 rc/templates/Java Files/Examples/Framebuffer.template
  27. BIN  rc/templates/Java Files/Examples/Hello World.png
  28. +5 −0 rc/templates/Java Files/Examples/Hello World.template
  29. BIN  rc/templates/Java Files/Examples/Motor Drive Train.png
  30. +24 −0 rc/templates/Java Files/Examples/Motor Drive Train.template
  31. BIN  rc/templates/Java Files/Examples/Motored Camera.png
  32. +30 −0 rc/templates/Java Files/Examples/Motored Camera.template
  33. BIN  rc/templates/Java Files/Examples/Simple Motors.png
  34. +18 −0 rc/templates/Java Files/Examples/Simple Motors.template
  35. BIN  rc/templates/Java Files/Java.png
  36. +5 −0 rc/templates/Java Files/Java.template
  37. BIN  rc/templates/Python Files/Blank.png
  38. +2 −0  rc/templates/Python Files/Blank.template
  39. BIN  rc/templates/Python Files/Hello World.png
  40. +5 −0 rc/templates/Python Files/Hello World.template
View
9 CMakeLists.txt
@@ -1,6 +1,6 @@
PROJECT(KISS)
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
FIND_PACKAGE(Qt4 REQUIRED)
@@ -99,7 +99,12 @@ IF(APPLE)
DEPENDS KISS Info.plist MacDeployQt)
SET(OSX_INSTALL_NAMES_SCRIPT "${KISS_SOURCE_DIR}/scripts/osx_install_names.sh")
-ENDIF()
+
+ install(DIRECTORY ${RC}/templates DESTINATION ${KISS_SOURCE_DIR}/deploy/KISS.app/Contents)
+
+ELSE(APPLE)
+ install(DIRECTORY ${RC}/templates DESTINATION ${KISS_SOURCE_DIR}/deploy)
+ENDIF(APPLE)
# Accessory Programs
View
BIN  rc/templates/C Files/Blank.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  rc/templates/C Files/Blank.template
No changes.
View
BIN  rc/templates/C Files/C.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  rc/templates/C Files/C.template
No changes.
View
BIN  rc/templates/C Files/Header.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 rc/templates/C Files/Header.template
@@ -0,0 +1,9 @@
+KISS_LEXER h
+END_KISS_META
+
+#ifndef __KISS_FILE_H__
+#define __KISS_FILE_H__
+
+
+
+#endif
View
BIN  rc/templates/C++ Files/Blank.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  rc/templates/C++ Files/Blank.template
No changes.
View
BIN  rc/templates/C++ Files/C++.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
13 rc/templates/C++ Files/C++.template
@@ -0,0 +1,13 @@
+KISS_LEXER cpp
+END_KISS_META
+// Created on KISS_DATE
+
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+ cout << "Hello, World!" << endl;
+ return 0;
+}
View
BIN  rc/templates/C++ Files/Header.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 rc/templates/C++ Files/Header.template
@@ -0,0 +1,9 @@
+KISS_LEXER h
+END_KISS_META
+
+#ifndef __KISS_FILE_H__
+#define __KISS_FILE_H__
+
+
+
+#endif
View
0  rc/templates/Common Lisp Files/Blank.template
No changes.
View
BIN  rc/templates/Java Files/Blank.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  rc/templates/Java Files/Blank.template
No changes.
View
BIN  rc/templates/Java Files/Examples/Buttons.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
36 rc/templates/Java Files/Examples/Buttons.template
@@ -0,0 +1,36 @@
+//package cbccore.tests;
+
+import cbccore.Device;
+import cbccore.events.Event;
+import cbccore.events.EventManager;
+import cbccore.events.EventListenerAdapter;
+//import cbccore.motors.listeners.StopMotors;
+import cbccore.sensors.buttons.ButtonEmitter;
+
+class Main {
+ public void run() {
+ EventManager manager = EventManager.get();
+ ButtonEmitter.get().start();
+
+ EventListenerAdapter AButtonPressedHandler = new EventListenerAdapter() {
+ @Override
+ public void event(Event type) {
+ System.out.println("The A Button Was Pressed!");
+ }
+ };
+
+ EventListenerAdapter AButtonReleasedHandler = new EventListenerAdapter() {
+ @Override
+ public void event(Event type) {
+ System.out.println("The A Button Was Released!");
+ }
+ };
+
+ manager.connect(ButtonEmitter.AButtonPressed, AButtonPressedHandler);
+ manager.connect(ButtonEmitter.AButtonReleased, AButtonReleasedHandler);
+ }
+
+ public static void main(String[] args) {
+ new Main().run();
+ }
+}
View
BIN  rc/templates/Java Files/Examples/Camera.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
19 rc/templates/Java Files/Examples/Camera.template
@@ -0,0 +1,19 @@
+import cbccore.movement.*;
+import cbccore.sensors.vision.*;
+
+class Main {
+ public static void main(String [] args) {
+ Camera c = new Camera();
+
+ for(int i = 0; i < 4; ++i) {
+ BlobList bList = new BlobList(c, i);
+ System.out.println("--------------\nI see " + bList.size() + " blobs on channel " + i);
+
+ //individual blobs
+ for(Blob k : bList) {
+ System.out.println("I see a blob with " + k.getConfindence() +
+ "% confidence at position (" + k.getX() + ", " + k.getY() + ").\n\n");
+ }
+ }
+ }
+}
View
BIN  rc/templates/Java Files/Examples/Create Distance Sensor.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
42 rc/templates/Java Files/Examples/Create Distance Sensor.template
@@ -0,0 +1,42 @@
+import cbccore.sensors.*;
+import cbccore.sensors.analog.*;
+import cbccore.sensors.buttons.*;
+import cbccore.movement.DriveTrain;
+import cbccore.movement.CreateDriveTrain;
+import cbccore.events.*;
+import java.util.Arrays;
+import java.util.ArrayList;
+
+class Main {
+ public static void main(String [] args) {
+ System.out.println("Please press the Black Hardware Button to start.");
+
+ EventManager.get().connect(ButtonEmitter.BlackButtonReleased, new StartListener(0));
+ ButtonEmitter.get().start();
+ }
+
+ //****************************
+ //*** Begin actual program ***
+ public static class StartListener implements IEventListener {
+
+ ETSensor distSensor;
+ DriveTrain dt;
+
+ public StartListener(int port) {
+ distSensor = new ETSensor(port);
+ dt = new CreateDriveTrain(1., false);
+ }
+
+ public void event(Event e) {
+ EventManager.get().disconnect(ButtonEmitter.BlackButtonReleased, this);
+ ButtonEmitter.get().exit();
+
+ double dist = distSensor.getCm(50, 10);
+ System.out.println("Distance is: " + dist + "cm");
+ System.out.println("Moving to 5cm away");
+ dt.moveCm(-dist*.5+5., dt.getMaxCmps()*.5);
+ dist = distSensor.getCm(50, 10);
+ dt.moveCm(-dist+5., dt.getMaxCmps()*.5);
+ }
+ }
+}
View
BIN  rc/templates/Java Files/Examples/ET Calibrator.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
68 rc/templates/Java Files/Examples/ET Calibrator.template
@@ -0,0 +1,68 @@
+import cbccore.sensors.analog.Analog;
+import cbccore.sensors.buttons.BlackButton;
+
+class Main {
+ public static void main(String[] args) {
+ double[] distances = {10., 20., 30., 40., 50., 60., 70., 80., 90., 100.};
+ double[] analogvals = new double[10];
+
+ System.out.println("using analog port 0");
+ Analog distSensor = new Analog(0);
+ distSensor.setFloating(true);
+
+ BlackButton button = new BlackButton();
+
+ for(int i = 0; i < distances.length; ++i) {
+ System.out.println("move block "+distances[i]+"cm away");
+ System.out.println("then press black button");
+
+ //really dirty code, do not follow my example
+ while(!button.getValue()) { try { Thread.sleep(50); } catch(Exception e) {} }
+ while(button.getValue()) { try { Thread.sleep(50); } catch(Exception e) {} }
+
+ int sum = 0;
+
+ for(int w = 0; w < 50; ++w) {
+ sum += distSensor.getValueHigh();
+ try { Thread.sleep(10); } catch(Exception e) {}
+ }
+ analogvals[i] = sum/50.;
+ }
+
+ double bestDeviation = Double.POSITIVE_INFINITY;
+ double bestPow = -1.;
+ double bestK = -1.;
+ double bestB = -1.;
+
+ for(double i = 0.01; i < 3; i += 0.01) {
+ double k = 0.;
+ for(int w = 0; w < analogvals.length; ++w) {
+ k += distances[w]*Math.pow(analogvals[w], i);
+ }
+ k /= (double)analogvals.length;
+
+ double b = 0.;
+ for(int w = 0; w < analogvals.length; ++w) {
+ b += distances[w]-k/Math.pow(analogvals[w], i);
+ }
+ b /= (double)analogvals.length;
+
+ double deviation = 0.;
+ for(int w = 0; w < analogvals.length; ++w) {
+ deviation += Math.abs(distances[w]-k/Math.pow(analogvals[w], i)+b);
+ }
+
+ if(deviation < bestDeviation) {
+ bestDeviation = deviation;
+ bestPow = i;
+ bestK = k;
+ bestB = b;
+ }
+ }
+
+ System.out.println("bestPow: "+ bestPow);
+ System.out.println("bestK: "+ bestK);
+ System.out.println("bestB: "+ bestB);
+ System.out.println("with deviation: "+ bestDeviation/distances.length);
+ }
+}
View
BIN  rc/templates/Java Files/Examples/Framebuffer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
55 rc/templates/Java Files/Examples/Framebuffer.template
@@ -0,0 +1,55 @@
+import java.io.File;
+import java.io.IOException;
+
+import cbccore.display.*;
+import cbccore.sensors.buttons.AbstractButton;
+import cbccore.sensors.buttons.BlackButton;
+
+class Main {
+ public static void main(String[] args) throws InterruptedException, IOException {
+ Framebuffer fb0 = Display.getFramebuffer();
+ Pixmap g = new Pixmap(5, 80, Pixel.greenPixel);
+ Pixmap r = new Pixmap(5, 80, Pixel.redPixel);
+ Pixmap b = new Pixmap(5, 80, Pixel.bluePixel);
+ Pixmap filler = new Pixmap(2, 240, new Pixel(0, 0, 0));
+ AbstractButton button = new BlackButton();
+ int x = 160 - r.getWidth() / 2;
+ int y = 120 - r.getHeight() / 2;
+ int dir = 0;
+ Drawer drawer = new Drawer(fb0);
+ int rotatingLineSize = 240;
+ Pixmap rotatingLineFiller = new Pixmap(rotatingLineSize, rotatingLineSize, new Pixel(0, 0, 0));
+ float angle = 0.f;
+
+ while(button.isNotPushed()) {
+ if(dir == 0) {
+ x+=2;
+ if(x + 5 >= 315) {
+ dir = 1;
+ }
+ } else {
+ x-=2;
+ if(x <= 2) {
+ dir = 0;
+ }
+ }
+
+ fb0.fastBlit(dir == 0 ? x - 2 : x + 5, 0, filler);
+ fb0.fastBlit((320>>1)-(rotatingLineSize>>1), (240>>1)-(rotatingLineSize>>1),rotatingLineFiller);
+ float sinOfAngle = (float)Math.sin(angle);
+ float cosOfAngle = (float)Math.cos(angle);
+ drawer.drawLine((int)(-cosOfAngle*(rotatingLineSize>>1)+(320>>1)),
+ (int)(-sinOfAngle*(rotatingLineSize>>1)+(240>>1)),
+ (int)(cosOfAngle*(rotatingLineSize>>1)+(320>>1)),
+ (int)(sinOfAngle*(rotatingLineSize>>1)+(240>>1)),
+ Pixel.whitePixel
+ );
+ angle += .1f;
+ fb0.fastBlit(x, 0, r);
+ fb0.fastBlit(x, 80, g);
+ fb0.fastBlit(x, 160, b);
+
+ fb0.sync();
+ }
+ }
+}
View
BIN  rc/templates/Java Files/Examples/Hello World.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
5 rc/templates/Java Files/Examples/Hello World.template
@@ -0,0 +1,5 @@
+class Main {
+ public static void main(String[] args) {
+ System.out.println("Welcome to CBCJVM");
+ }
+}
View
BIN  rc/templates/Java Files/Examples/Motor Drive Train.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
24 rc/templates/Java Files/Examples/Motor Drive Train.template
@@ -0,0 +1,24 @@
+import cbccore.movement.*;
+import cbccore.easing.*;
+
+class Main {
+ public static void main(String [] args) {
+ MotorDriveTrain dt = new MotorDriveTrain(new Wheel(0, 15.5744, 1.), new Wheel(1, 15.5744, 1.), 11.);
+
+ try {
+ dt.moveCm(-300., dt.getMaxCmps(), 100,
+ EasingEquation.EASE_IN_OUT, EasingEquation.EASE_IN_OUT,
+ DriveTrain.PERCENT_DISTANCE, DriveTrain.DISABLED, 1./3.,
+ QuadEasingEquation.getInstance()
+ );
+
+ dt.moveCm(100., dt.getMaxCmps());
+
+ System.out.println("moved forward!");
+
+ dt.rotateDegrees(180., dt.getMaxDegreesPerSec());
+ } catch(Exception e) {
+ e.printStackTrace(System.out);
+ }
+ }
+}
View
BIN  rc/templates/Java Files/Examples/Motored Camera.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
30 rc/templates/Java Files/Examples/Motored Camera.template
@@ -0,0 +1,30 @@
+import cbccore.movement.*;
+import cbccore.vision.*;
+
+class Main {
+ public static void main(String [] args) {
+ MotorDriveTrain dt = new MotorDriveTrain(new Wheel(0, 15.5744, 1.), new Wheel(1, 15.5744, 1.), 11.);
+ Camera c = new Camera();
+ Blob mostProbable = null;
+ int bestConfidence = 0;
+ BlobList bList = new BlobList(c, 0);
+ System.out.println(bList.size() + ", " + c.getAvailableBlobLength(0));
+ for(Object i : bList) {
+ if(((Blob)i).getConfindence() > bestConfidence) {
+ bestConfidence = ((Blob)i).getConfindence();
+ mostProbable = ((Blob)i);
+ }
+ }
+
+ int destination = 100;
+
+ while(true) {
+ while(!mostProbable.update()) { c.update(); }
+ if(Math.sqrt(mostProbable.getSize()) > 100) {
+ dt.moveAtCmps(-dt.maxCmps()*Math.abs((double)mostProbable.getSize()-destination)/320.);
+ } else {
+ dt.moveAtCmps(dt.maxCmps()*Math.abs((double)mostProbable.getSize()-destination)/320.);
+ }
+ }
+ }
+}
View
BIN  rc/templates/Java Files/Examples/Simple Motors.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
18 rc/templates/Java Files/Examples/Simple Motors.template
@@ -0,0 +1,18 @@
+import cbccore.motors.Motor;
+
+class Main {
+ public static void main(String [] args) {
+ Motor m = new Motor(0);
+ m.moveAtVelocity(100);
+ m = new Motor(1);
+ m.moveAtVelocity(200);
+ m = new Motor(2);
+ m.moveAtVelocity(300);
+ m = new Motor(3);
+ m.moveAtVelocity(400);
+ try { Thread.sleep(2000l); } catch (Exception e) {}
+ Motor.allOff();
+ m.moveRelativePosition(500, 5000);
+ m.waitForDone();
+ }
+}
View
BIN  rc/templates/Java Files/Java.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
5 rc/templates/Java Files/Java.template
@@ -0,0 +1,5 @@
+class Main {
+ public static void main(String[] args) {
+ System.out.println("Welcome to CBCJVM");
+ }
+}
View
BIN  rc/templates/Python Files/Blank.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  rc/templates/Python Files/Blank.template
@@ -0,0 +1,2 @@
+KISS_LEXER py
+END_KISS_META
View
BIN  rc/templates/Python Files/Hello World.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
5 rc/templates/Python Files/Hello World.template
@@ -0,0 +1,5 @@
+KISS_LEXER py
+END_KISS_META
+# Created on KISS_DATE
+
+print "Hello, World!"
Please sign in to comment.
Something went wrong with that request. Please try again.