summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter de Kok <p.j.s.d.kok@gmail.com>2015-05-20 18:59:03 +0200
committerPeter de Kok <p.j.s.d.kok@gmail.com>2015-05-20 18:59:03 +0200
commit44c4909a3046a2533d8f60e837c2ad82554d8c8d (patch)
tree3bdee5979fcd9c06de0247a3b3e98f3935c7f7e9
parent2b6d102363cea9c70b1826389da8903f79a1c933 (diff)
downloadcode-44c4909a3046a2533d8f60e837c2ad82554d8c8d.tar.gz
Commit 3
m---------RPi_skeleton/RPi_skeleton0
-rw-r--r--RPi_skeleton/RPi_skeleton.xcodeproj/project.pbxproj242
-rw-r--r--RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/contents.xcworkspacedata7
-rw-r--r--RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/xcshareddata/RPi_skeleton.xccheckout41
-rw-r--r--RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/xcuserdata/peterdekok.xcuserdatad/UserInterfaceState.xcuserstatebin0 -> 12605 bytes
-rw-r--r--RPi_skeleton/RPi_skeleton.xcodeproj/xcuserdata/peterdekok.xcuserdatad/xcschemes/RPi_skeleton.xcscheme88
-rw-r--r--RPi_skeleton/RPi_skeleton.xcodeproj/xcuserdata/peterdekok.xcuserdatad/xcschemes/xcschememanagement.plist22
-rw-r--r--Venus_Skeleton/Venus_Skeleton.ino112
8 files changed, 488 insertions, 24 deletions
diff --git a/RPi_skeleton/RPi_skeleton b/RPi_skeleton/RPi_skeleton
new file mode 160000
+Subproject b0b67e7cf8715520fd40cdc51af66c17a4ba54a
diff --git a/RPi_skeleton/RPi_skeleton.xcodeproj/project.pbxproj b/RPi_skeleton/RPi_skeleton.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..8e970da
--- /dev/null
+++ b/RPi_skeleton/RPi_skeleton.xcodeproj/project.pbxproj
@@ -0,0 +1,242 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ C88771491B0CC48A003DDDD4 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = C88771481B0CC48A003DDDD4 /* main.c */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ C88771431B0CC48A003DDDD4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ C88771451B0CC48A003DDDD4 /* RPi_skeleton */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = RPi_skeleton; sourceTree = BUILT_PRODUCTS_DIR; };
+ C88771481B0CC48A003DDDD4 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ C88771421B0CC48A003DDDD4 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ C887713C1B0CC48A003DDDD4 = {
+ isa = PBXGroup;
+ children = (
+ C88771471B0CC48A003DDDD4 /* RPi_skeleton */,
+ C88771461B0CC48A003DDDD4 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ C88771461B0CC48A003DDDD4 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ C88771451B0CC48A003DDDD4 /* RPi_skeleton */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ C88771471B0CC48A003DDDD4 /* RPi_skeleton */ = {
+ isa = PBXGroup;
+ children = (
+ C88771481B0CC48A003DDDD4 /* main.c */,
+ );
+ path = RPi_skeleton;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ C88771441B0CC48A003DDDD4 /* RPi_skeleton */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = C887714C1B0CC48A003DDDD4 /* Build configuration list for PBXNativeTarget "RPi_skeleton" */;
+ buildPhases = (
+ C88771411B0CC48A003DDDD4 /* Sources */,
+ C88771421B0CC48A003DDDD4 /* Frameworks */,
+ C88771431B0CC48A003DDDD4 /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = RPi_skeleton;
+ productName = RPi_skeleton;
+ productReference = C88771451B0CC48A003DDDD4 /* RPi_skeleton */;
+ productType = "com.apple.product-type.tool";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ C887713D1B0CC48A003DDDD4 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0640;
+ ORGANIZATIONNAME = "Peter de Kok";
+ TargetAttributes = {
+ C88771441B0CC48A003DDDD4 = {
+ CreatedOnToolsVersion = 6.4;
+ };
+ };
+ };
+ buildConfigurationList = C88771401B0CC48A003DDDD4 /* Build configuration list for PBXProject "RPi_skeleton" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = C887713C1B0CC48A003DDDD4;
+ productRefGroup = C88771461B0CC48A003DDDD4 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ C88771441B0CC48A003DDDD4 /* RPi_skeleton */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ C88771411B0CC48A003DDDD4 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C88771491B0CC48A003DDDD4 /* main.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ C887714A1B0CC48A003DDDD4 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.10;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ C887714B1B0CC48A003DDDD4 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.10;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ C887714D1B0CC48A003DDDD4 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ C887714E1B0CC48A003DDDD4 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ C88771401B0CC48A003DDDD4 /* Build configuration list for PBXProject "RPi_skeleton" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C887714A1B0CC48A003DDDD4 /* Debug */,
+ C887714B1B0CC48A003DDDD4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C887714C1B0CC48A003DDDD4 /* Build configuration list for PBXNativeTarget "RPi_skeleton" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C887714D1B0CC48A003DDDD4 /* Debug */,
+ C887714E1B0CC48A003DDDD4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = C887713D1B0CC48A003DDDD4 /* Project object */;
+}
diff --git a/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..9269460
--- /dev/null
+++ b/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:RPi_skeleton.xcodeproj">
+ </FileRef>
+</Workspace>
diff --git a/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/xcshareddata/RPi_skeleton.xccheckout b/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/xcshareddata/RPi_skeleton.xccheckout
new file mode 100644
index 0000000..531f8aa
--- /dev/null
+++ b/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/xcshareddata/RPi_skeleton.xccheckout
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IDESourceControlProjectFavoriteDictionaryKey</key>
+ <false/>
+ <key>IDESourceControlProjectIdentifier</key>
+ <string>51C5F246-5DBB-42DB-85DC-78C2653CA244</string>
+ <key>IDESourceControlProjectName</key>
+ <string>project</string>
+ <key>IDESourceControlProjectOriginsDictionary</key>
+ <dict>
+ <key>EC86EAF72C84463005E3A82B4C6719F0BEB98076</key>
+ <string>git.lekensteyn.nl:tue/5XIB0-Venus/code.git</string>
+ </dict>
+ <key>IDESourceControlProjectPath</key>
+ <string>RPi_skeleton/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace</string>
+ <key>IDESourceControlProjectRelativeInstallPathDictionary</key>
+ <dict>
+ <key>EC86EAF72C84463005E3A82B4C6719F0BEB98076</key>
+ <string>../../../..</string>
+ </dict>
+ <key>IDESourceControlProjectURL</key>
+ <string>git.lekensteyn.nl:tue/5XIB0-Venus/code.git</string>
+ <key>IDESourceControlProjectVersion</key>
+ <integer>111</integer>
+ <key>IDESourceControlProjectWCCIdentifier</key>
+ <string>EC86EAF72C84463005E3A82B4C6719F0BEB98076</string>
+ <key>IDESourceControlProjectWCConfigurations</key>
+ <array>
+ <dict>
+ <key>IDESourceControlRepositoryExtensionIdentifierKey</key>
+ <string>public.vcs.git</string>
+ <key>IDESourceControlWCCIdentifierKey</key>
+ <string>EC86EAF72C84463005E3A82B4C6719F0BEB98076</string>
+ <key>IDESourceControlWCCName</key>
+ <string>code</string>
+ </dict>
+ </array>
+</dict>
+</plist>
diff --git a/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/xcuserdata/peterdekok.xcuserdatad/UserInterfaceState.xcuserstate b/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/xcuserdata/peterdekok.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..09ca94e
--- /dev/null
+++ b/RPi_skeleton/RPi_skeleton.xcodeproj/project.xcworkspace/xcuserdata/peterdekok.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/RPi_skeleton/RPi_skeleton.xcodeproj/xcuserdata/peterdekok.xcuserdatad/xcschemes/RPi_skeleton.xcscheme b/RPi_skeleton/RPi_skeleton.xcodeproj/xcuserdata/peterdekok.xcuserdatad/xcschemes/RPi_skeleton.xcscheme
new file mode 100644
index 0000000..8faf2ed
--- /dev/null
+++ b/RPi_skeleton/RPi_skeleton.xcodeproj/xcuserdata/peterdekok.xcuserdatad/xcschemes/RPi_skeleton.xcscheme
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0640"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C88771441B0CC48A003DDDD4"
+ BuildableName = "RPi_skeleton"
+ BlueprintName = "RPi_skeleton"
+ ReferencedContainer = "container:RPi_skeleton.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C88771441B0CC48A003DDDD4"
+ BuildableName = "RPi_skeleton"
+ BlueprintName = "RPi_skeleton"
+ ReferencedContainer = "container:RPi_skeleton.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C88771441B0CC48A003DDDD4"
+ BuildableName = "RPi_skeleton"
+ BlueprintName = "RPi_skeleton"
+ ReferencedContainer = "container:RPi_skeleton.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C88771441B0CC48A003DDDD4"
+ BuildableName = "RPi_skeleton"
+ BlueprintName = "RPi_skeleton"
+ ReferencedContainer = "container:RPi_skeleton.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/RPi_skeleton/RPi_skeleton.xcodeproj/xcuserdata/peterdekok.xcuserdatad/xcschemes/xcschememanagement.plist b/RPi_skeleton/RPi_skeleton.xcodeproj/xcuserdata/peterdekok.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..e7675ed
--- /dev/null
+++ b/RPi_skeleton/RPi_skeleton.xcodeproj/xcuserdata/peterdekok.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>SchemeUserState</key>
+ <dict>
+ <key>RPi_skeleton.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>C88771441B0CC48A003DDDD4</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/Venus_Skeleton/Venus_Skeleton.ino b/Venus_Skeleton/Venus_Skeleton.ino
index 04bb5d3..f4cc57b 100644
--- a/Venus_Skeleton/Venus_Skeleton.ino
+++ b/Venus_Skeleton/Venus_Skeleton.ino
@@ -1,23 +1,50 @@
// TODO
//
// - limit sendData to x per second
+//
+// - insert into calibration files
+// const int calObstacleTurretMaxDist = 50;
+// const int calObstacleTurretMinDist = 10;
+// const int calIRLeftThreshold = 2;
+// const int calIRRightThreshold = 2;
+// #define OPERATION_MAX_CHANGE_TIME = 20000;
+//
+// - Make sure ENUM piDataType is correct and synced
+// - Change interpretData to resemble correct ENUM data
+//
+// **********************
+// ** Calibration file **
+// **********************
-
+// Include Wally of Eve, (un)comment the right one.
+#include "calibration.wally.h"
+//#include "calibration.eve.h"
// *****************
// ** DEFINITIONS **
// *****************
// Pin configuration
-#define pinSensCompass
-#define pinSensObstacleTurret
-#define pinSensIRLeft
-#define pinSensIRRight
-#define pinSensSampleTurret
-#define pinSensSampleGripper
-#define pinSensBeaconTurret
-#define pinSensLab
+#define PIN_SENS_COMPASS;
+#define PIN_SENS_OBSTACLE_TURRET = 9;
+#define PIN_SENS_IR_LEFT;
+#define PIN_SENS_IR_RIGHT;
+#define PIN_SENS_SAMPLE_TURRET;
+#define PIN_SENS_SAMPLE_GRIPPER;
+#define PIN_SENS_BEACON_TURRET;
+#define PIN_SERVO_LEFT = 12;
+#define PIN_SERVO_RIGHT = 13;
+#define PIN_SERVO_TURRET = 11;
+
+// Raspberry Pi Data type declarations
+enum piDataType {COMPASS, OBSTACLETURRET, IRLEFT, IRRIGHT, SAMPLETURRET, SAMPLEGRIPPER, BEACONTURRET, LAB, MOVETO, GRIPPER, TURRET};
+// Operation modes
+enum opMode {RANDOM, WAIT, INITIALSEQUENCE, RANDOM, MAPPING, GOTOSAMPLE, GRABSAMPLE, GOTOLABLOCATION, WAITFORLAB, FINDMAGNET, LABSEQUENCE};
+
+// Current operation mode
+opMode operationMode = 0;
+unsigned long operationChange = 0;
// Location values
int currValRobotX;
@@ -31,16 +58,6 @@ int currValServoTurret;
// Actuator values
int currValTurret;
-// Calibration values
-#define calObstacleTurretMaxDist 50
-#define calObstacleTurretMinDist 10
-#define calIRLeftThreshold 2
-#define calIRRightThreshold 2
-#define cal
-
-// RPi Data type declarations
-enum piDataType {COMPASS, OBSTACLETURRET, IRLEFT, IRRIGHT, SAMPLETURRET, SAMPLEGRIPPER, BEACONTURRET, LAB};
-
// **********************
// ** PI COMMUNICATION **
@@ -51,20 +68,31 @@ void sendData(int method, int data, int data1 = null, int data2 = null) {
}
+// receive data from Raspberry Pi
+// sequence = ... ?????
void readData() {
+ // if data received -> interpretate it
+ // change operation mode + update timer
+ operationMode = WAIT;
+ operationChange = millis();
+ // for example:
+ interpretData(MOVETO, 0);
}
-void interpretData(piDataType dataType, message) {
+void interpretData(piDataType dataType, int message) {
switch(dataType) {
- case x:
+ case MOVETO:
+
+ break;
+ case GRIPPER:
break;
- case y:
+ case TURRET:
break;
case default:
-
+ // ignore ????
break;
}
}
@@ -76,6 +104,7 @@ void interpretData(piDataType dataType, message) {
// sensor Compass, orientation
int sensCompass() {
+ // average for last x ????????
int degree = 359;
sendData(COMPASS, degree);
return degree;
@@ -113,6 +142,7 @@ int sensIRRight() {
int sensSampleTurret() {
boolean sample = false;
if(sample) {
+ // If a sample is detected, stop all servos, send data to the PI and wait for response
stopAllServos();
sendData(SAMPLETURRET, currValRobotX, currValRobotY, currValSensCompass, currValTurret);
}
@@ -158,5 +188,39 @@ void setup() {
}
void loop() {
-
+ sensCompass();
+ sensObstacleTurret();
+ sensIRLeft();
+ sensIRRight();
+ sensSampleTurret();
+ sensSampleGripper();
+ sensBeaconTurret();
+ sensLab();
+
+ if((operationChange + OPERATION_MAX_CHANGE_TIME) > millis() && operationMode != RANDOM) {
+ operationMode = RANDOM;
+ }
+
+}
+
+// **********************
+// ** HELPER FUNCTIONS **
+// **********************
+
+long microsecondsToInches(long microseconds)
+{
+ // According to Parallax's datasheet for the PING))), there are
+ // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
+ // second). This gives the distance travelled by the ping, outbound
+ // and return, so we divide by 2 to get the distance of the obstacle.
+ // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
+ return microseconds / 74 / 2;
+}
+
+long microsecondsToCentimeters(long microseconds)
+{
+ // The speed of sound is 340 m/s or 29 microseconds per centimeter.
+ // The ping travels out and back, so to find the distance of the
+ // object we take half of the distance travelled.
+ return microseconds / 29 / 2;
}