diff --git a/VRIS-prototype/.gitattributes b/VRIS-prototype/.gitattributes new file mode 100644 index 0000000..77b165a --- /dev/null +++ b/VRIS-prototype/.gitattributes @@ -0,0 +1 @@ +VRISprototype.sdf filter=lfs diff=lfs merge=lfs -text diff --git a/VRIS-prototype/.gitignore b/VRIS-prototype/.gitignore new file mode 100644 index 0000000..f1ed149 --- /dev/null +++ b/VRIS-prototype/.gitignore @@ -0,0 +1,5 @@ +Intermediate/ +Saved/ +VRISprototype.sdf +VRISprototype.sln +VRISprototype.suo \ No newline at end of file diff --git a/VRIS-prototype/Config/DefaultEditor.ini b/VRIS-prototype/Config/DefaultEditor.ini new file mode 100644 index 0000000..6838df0 --- /dev/null +++ b/VRIS-prototype/Config/DefaultEditor.ini @@ -0,0 +1,5 @@ +[EditoronlyBP] +bAllowClassAndBlueprintPinMatching=true +bReplaceBlueprintWithClass=true +bDontLoadBlueprintOutsideEditor=true +bBlueprintIsNotBlueprintType=true diff --git a/VRIS-prototype/Config/DefaultEngine.ini b/VRIS-prototype/Config/DefaultEngine.ini new file mode 100644 index 0000000..c55599d --- /dev/null +++ b/VRIS-prototype/Config/DefaultEngine.ini @@ -0,0 +1,60 @@ +[URL] +[/Script/EngineSettings.GameMapsSettings] +EditorStartupMap=/Game/StarterContent/Maps/Minimal_Default +GameDefaultMap=/Game/StarterContent/Maps/Minimal_Default + +[/Script/Engine.UserInterfaceSettings] +RenderFocusRule=NavigationOnly +DefaultCursor=None +TextEditBeamCursor=None +CrosshairsCursor=None +GrabHandCursor=None +GrabHandClosedCursor=None +SlashedCircleCursor=None +ApplicationScale=1.000000 +UIScaleRule=ShortestSide +CustomScalingRuleClass=None +UIScaleCurve=(EditorCurveData=(PreInfinityExtrap=RCCE_Constant,PostInfinityExtrap=RCCE_Constant,Keys=((Time=480.000000,Value=0.444000),(Time=720.000000,Value=0.666000),(Time=1080.000000,Value=1.000000),(Time=8640.000000,Value=8.000000))),ExternalCurve=None) + +[/Script/Engine.RendererSettings] +r.MobileHDR=True +r.MobileNumDynamicPointLights=4 +r.MobileDynamicPointLightsUseStaticBranch=True +r.AllowOcclusionQueries=True +r.MinScreenRadiusForLights=0.030000 +r.MinScreenRadiusForDepthPrepass=0.030000 +r.PrecomputedVisibilityWarning=False +r.TextureStreaming=True +Compat.UseDXT5NormalMaps=False +r.AllowStaticLighting=True +r.NormalMapsForStaticLighting=False +r.GenerateMeshDistanceFields=False +r.GenerateLandscapeGIData=True +r.TessellationAdaptivePixelsPerTriangle=48.000000 +r.SeparateTranslucency=True +r.TranslucentSortPolicy=0 +TranslucentSortAxis=(X=0.000000,Y=-1.000000,Z=0.000000) +r.CustomDepth=1 +r.DefaultFeature.Bloom=True +r.DefaultFeature.AmbientOcclusion=True +r.DefaultFeature.AmbientOcclusionStaticFraction=True +r.DefaultFeature.AutoExposure=True +r.DefaultFeature.MotionBlur=True +r.DefaultFeature.LensFlare=True +r.DefaultFeature.AntiAliasing=2 +r.EarlyZPass=3 +r.EarlyZPassMovable=False +r.DBuffer=False +r.ClearSceneMethod=1 +r.BasePassOutputsVelocity=False +r.WireframeCullThreshold=5.000000 +UIScaleRule=ShortestSide +UIScaleCurve=(EditorCurveData=(PreInfinityExtrap=RCCE_Constant,PostInfinityExtrap=RCCE_Constant,Keys=),ExternalCurve=None) + +[/Script/HardwareTargeting.HardwareTargetingSettings] +TargetedHardwareClass=Desktop +AppliedTargetedHardwareClass=Desktop +DefaultGraphicsPerformance=Maximum +AppliedDefaultGraphicsPerformance=Maximum + + diff --git a/VRIS-prototype/Config/DefaultGame.ini b/VRIS-prototype/Config/DefaultGame.ini new file mode 100644 index 0000000..15de8ee --- /dev/null +++ b/VRIS-prototype/Config/DefaultGame.ini @@ -0,0 +1,6 @@ +[/Script/EngineSettings.GeneralProjectSettings] +ProjectID=03D8975F4EA14BB07FC38BA6364CCA52 + +[StartupActions] +bAddPacks=True +InsertPack=(PackSource="StarterContent.upack,PackName="StarterContent") diff --git a/VRIS-prototype/README.md b/VRIS-prototype/README.md new file mode 100644 index 0000000..9161288 --- /dev/null +++ b/VRIS-prototype/README.md @@ -0,0 +1 @@ +Prototype for VRIS. diff --git a/VRIS-prototype/Source/VRISprototype-external/MPU6050_Multi/MPU6050_Multi.ino b/VRIS-prototype/Source/VRISprototype-external/MPU6050_Multi/MPU6050_Multi.ino new file mode 100644 index 0000000..42a989a --- /dev/null +++ b/VRIS-prototype/Source/VRISprototype-external/MPU6050_Multi/MPU6050_Multi.ino @@ -0,0 +1,141 @@ +#include "Wire.h" +/* I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files + * for both classes must be in the include path of your project + */ +#include "I2Cdev.h" +#include "MPU6050_6Axis_MotionApps20.h" + +#define NUMBER_OF_SENSORS 3 /// YOU MAY NEED TO CHANGE THIS + +// Default I2C address is 0x68 +// AD0 LOW(0) = 0x68 (Default for SparkFun breakout and InvenSense evaluation board) +// AD0 HIGH(1) = 0x69 + +// MPU Control Variables +MPU6050 mpu; +bool dmpReady; // Set true if DMP init was successful. +uint8_t devStatus; // Return status after each device operation. (0 = success, !0 = error) +uint8_t mpuIntStatus; // Holds interrupt status byte from MPU. +uint16_t packetSize; // Expected DMP packet size. (Default is 42 bytes) +uint16_t fifoCount; // Count of all bytes currently in FIFO. +uint8_t fifoBuffer[64]; // FIFO storage buffer. + +// Orientation and Motion Variables +Quaternion q; // [W, X, Y, Z] Quaternion container. +VectorFloat gravity; // [X, Y, Z] Gravity vector +float ypr[3]; // [Yaw, Pitch, Roll] array container. + +//Digital Pins Reference Variables +/* Displace array beginning with 0. + * The numbers after the 0th index correspond to the pin connected to the ADO line of each sensor. + */ +int sensorPins[NUMBER_OF_SENSORS + 1] = {0, 5, 6, 7}; // {none, Sensor 1 ADO pin, Sensor 2 ADO pin,...} + +// Other Variables +String finalParts[NUMBER_OF_SENSORS]; // Final output. +String final = ""; // Part of final output. + +//============================================================== + +void switchSensor(int sensorNumber) { + digitalWrite(sensorPins[sensorNumber], LOW); // Change one ADO line to low. (The one we are recieving from! 0x68) +} + +// ================================================================ +// === MAIN PROGRAM SETUP === +// ================================================================ + +void setup() { + + // Setup Variables + int i = 0; // For loop counter. + int dmpReadyCounter = 0; // Counts number of sensors ready. + + // Set all ADO lines to default high, and configure pins. + for(i = 1; i <= NUMBER_OF_SENSORS; i++) { + pinMode(sensorPins[i], OUTPUT); + digitalWrite(sensorPins[i], HIGH); + } + + Serial.begin(115200); // Initialize serial communication with baud rate. + + for (i = 1; i <= NUMBER_OF_SENSORS; i++) { + /* We read data from all sensors by switching addresses one by one, only reading from the first address (0x68). + * Therefore, we select sensors by making an ADO line LOW. + */ + switchSensor(i); + + Wire.begin(); // Joins I2C bus. (I2C libary doesn't do this on it's own.) + TWBR = 24; // Sets SCL higher. + + mpu.initialize(); // Intialize device. + + devStatus = mpu.dmpInitialize(); // Load and configure the DMP. (Digital Motion Processor) + + // Check success of DMP. + if (devStatus == 0) { + mpu.setDMPEnabled(true); + + dmpReadyCounter += 1; // Add one to count number of ready sensors. + + packetSize = mpu.dmpGetFIFOPacketSize(); // Get expected DMP packet size for later comparison + + } else { + // Error! + Serial.println("Error on sensor " + String(i)); + } + digitalWrite(sensorPins[i], HIGH); // Reset current ADO pin back to high. (0x69) + Wire.endTransmission(); // End transmission for sensor. + } + if (dmpReadyCounter == NUMBER_OF_SENSORS) { + dmpReady = true; // Set DMP Ready flag. (Allows main loop to use the DMP.) + } +} + +// ================================================================ +// === MAIN PROGRAM LOOP === +// ================================================================ + +void loop() { + // If DMP isn't ready... + if (!(dmpReady)) { + return; + } + + final = ""; // Reset final to nothing. + + for (int i = 1; i <= NUMBER_OF_SENSORS; i++) { + + switchSensor(i); + + // Check for overflow. + if (fifoCount == 1024) { + mpu.resetFIFO(); // Reset so we can continue cleanly. + } else { + fifoCount = mpu.getFIFOCount(); // Get current FIFO count. + + // Wait for correct avaliable data length. + while (fifoCount < packetSize) { + fifoCount = mpu.getFIFOCount(); + } + + mpu.getFIFOBytes(fifoBuffer, packetSize); // Read a packet from FIFO + /* Track FIFO count in case there is more than 1 packet avaliable. + * (Read more without waiting for an interrupt.) + */ + fifoCount -= packetSize; + + // Get values to process. + mpu.dmpGetQuaternion(&q, fifoBuffer); + mpu.dmpGetGravity(&gravity, &q); + mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); + + // Concatenate for outputting. (Displays in Euler Angles in degrees.) + finalParts[i - 1] = String(ypr[0] * 180 / M_PI) + "," + String(ypr[1] * 180 / M_PI) + "," + String(ypr[2] * 180 / M_PI) + ":"; + final += finalParts[i - 1]; + digitalWrite(sensorPins[i], HIGH); // Resets current ADO pin back to high. (0x69) + } + } + Serial.println(final.substring(0, final.length() - 1)); // Prints and removes extra colon. +} + diff --git a/VRIS-prototype/Source/VRISprototype.Target.cs b/VRIS-prototype/Source/VRISprototype.Target.cs new file mode 100644 index 0000000..f7732c2 --- /dev/null +++ b/VRIS-prototype/Source/VRISprototype.Target.cs @@ -0,0 +1,25 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +using UnrealBuildTool; +using System.Collections.Generic; + +public class VRISprototypeTarget : TargetRules +{ + public VRISprototypeTarget(TargetInfo Target) + { + Type = TargetType.Game; + } + + // + // TargetRules interface. + // + + public override void SetupBinaries( + TargetInfo Target, + ref List OutBuildBinaryConfigurations, + ref List OutExtraModuleNames + ) + { + OutExtraModuleNames.AddRange( new string[] { "VRISprototype" } ); + } +} diff --git a/VRIS-prototype/Source/VRISprototype/ReadFile.cpp b/VRIS-prototype/Source/VRISprototype/ReadFile.cpp new file mode 100644 index 0000000..84ef4f1 --- /dev/null +++ b/VRIS-prototype/Source/VRISprototype/ReadFile.cpp @@ -0,0 +1,12 @@ +#include "VRISprototype.h" +#include "ReadFile.h" +#include "CoreMisc.h" + +void UReadFile::ReadFile(FString Filename, FString& Result) +{ + FFileHelper::LoadFileToString(Result, *Filename); +} + + + + diff --git a/VRIS-prototype/Source/VRISprototype/ReadFile.h b/VRIS-prototype/Source/VRISprototype/ReadFile.h new file mode 100644 index 0000000..e00e36c --- /dev/null +++ b/VRIS-prototype/Source/VRISprototype/ReadFile.h @@ -0,0 +1,12 @@ +#pragma once + +#include "Kismet/BlueprintFunctionLibrary.h" +#include "ReadFile.generated.h" + +UCLASS() +class VRISPROTOTYPE_API UReadFile : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() public: + UFUNCTION(BlueprintCallable, meta = (DisplayName = "Read File", Keywords = "Reads from a file"), Category = Utilities) + static void ReadFile(FString Directory, FString& Value); +}; diff --git a/VRIS-prototype/Source/VRISprototype/VRISprototype.Build.cs b/VRIS-prototype/Source/VRISprototype/VRISprototype.Build.cs new file mode 100644 index 0000000..e25e9ff --- /dev/null +++ b/VRIS-prototype/Source/VRISprototype/VRISprototype.Build.cs @@ -0,0 +1,26 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +using UnrealBuildTool; + +public class VRISprototype : ModuleRules +{ + public VRISprototype(TargetInfo Target) + { + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); + + PrivateDependencyModuleNames.AddRange(new string[] { }); + + // Uncomment if you are using Slate UI + // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); + + // Uncomment if you are using online features + // PrivateDependencyModuleNames.Add("OnlineSubsystem"); + // if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) + // { + // if (UEBuildConfiguration.bCompileSteamOSS == true) + // { + // DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam"); + // } + // } + } +} diff --git a/VRIS-prototype/Source/VRISprototype/VRISprototype.cpp b/VRIS-prototype/Source/VRISprototype/VRISprototype.cpp new file mode 100644 index 0000000..7c1fffc --- /dev/null +++ b/VRIS-prototype/Source/VRISprototype/VRISprototype.cpp @@ -0,0 +1,5 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#include "VRISprototype.h" + +IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, VRISprototype, "VRISprototype" ); diff --git a/VRIS-prototype/Source/VRISprototype/VRISprototype.h b/VRIS-prototype/Source/VRISprototype/VRISprototype.h new file mode 100644 index 0000000..3d85d22 --- /dev/null +++ b/VRIS-prototype/Source/VRISprototype/VRISprototype.h @@ -0,0 +1,6 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "Engine.h" + diff --git a/VRIS-prototype/Source/VRISprototypeEditor.Target.cs b/VRIS-prototype/Source/VRISprototypeEditor.Target.cs new file mode 100644 index 0000000..9d767c6 --- /dev/null +++ b/VRIS-prototype/Source/VRISprototypeEditor.Target.cs @@ -0,0 +1,25 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +using UnrealBuildTool; +using System.Collections.Generic; + +public class VRISprototypeEditorTarget : TargetRules +{ + public VRISprototypeEditorTarget(TargetInfo Target) + { + Type = TargetType.Editor; + } + + // + // TargetRules interface. + // + + public override void SetupBinaries( + TargetInfo Target, + ref List OutBuildBinaryConfigurations, + ref List OutExtraModuleNames + ) + { + OutExtraModuleNames.AddRange( new string[] { "VRISprototype" } ); + } +} diff --git a/VRIS-prototype/VRISprototype.uproject b/VRIS-prototype/VRISprototype.uproject new file mode 100644 index 0000000..99cc903 --- /dev/null +++ b/VRIS-prototype/VRISprototype.uproject @@ -0,0 +1,16 @@ +{ + "FileVersion": 3, + "EngineAssociation": "4.9", + "Category": "", + "Description": "", + "Modules": [ + { + "Name": "VRISprototype", + "Type": "Runtime", + "LoadingPhase": "Default", + "AdditionalDependencies": [ + "Engine" + ] + } + ] +} \ No newline at end of file diff --git a/VRIS-prototype/VRISprototype.v12.suo b/VRIS-prototype/VRISprototype.v12.suo new file mode 100644 index 0000000..668fe33 Binary files /dev/null and b/VRIS-prototype/VRISprototype.v12.suo differ diff --git a/VRIS-prototype/Xylos.exe.lnk b/VRIS-prototype/Xylos.exe.lnk new file mode 100644 index 0000000..66887b9 Binary files /dev/null and b/VRIS-prototype/Xylos.exe.lnk differ