├── ProjectSettings ├── ProjectVersion.txt ├── TagManager.asset ├── TimeManager.asset ├── AudioManager.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── DynamicsManager.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── NetworkManager.asset ├── ProjectSettings.asset ├── QualitySettings.asset ├── UnityAdsSettings.asset ├── Physics2DSettings.asset ├── ClusterInputManager.asset ├── EditorBuildSettings.asset ├── UnityAnalyticsManager.asset └── UnityConnectSettings.asset ├── Assets ├── MainScene.unity ├── Map1Scene.unity ├── Map2Scene.unity ├── Map3Scene.unity ├── RosScene.unity ├── Materials │ ├── Base.mat │ ├── search.mat │ ├── Base.mat.meta │ └── search.mat.meta ├── Resources │ ├── UAV.prefab │ ├── Waypoint.prefab │ ├── UAV.prefab.meta │ └── Waypoint.prefab.meta ├── TestObstacleScene.unity ├── QuadPhysics.physicMaterial ├── Art Resources │ ├── 3DModels │ │ ├── trap.fbx │ │ ├── Propellor.fbx │ │ ├── QuadArm.fbx │ │ ├── QuadArm2.fbx │ │ ├── TopPlate.fbx │ │ ├── UAVLegs.fbx │ │ ├── AcrylicPlate.fbx │ │ ├── QuadCopterBase.fbx │ │ ├── Materials │ │ │ ├── No Name.mat │ │ │ ├── wood001.mat │ │ │ ├── No Name.mat.meta │ │ │ └── wood001.mat.meta │ │ ├── Materials.meta │ │ ├── TopPlate.fbx.meta │ │ ├── QuadCopterBase.fbx.meta │ │ ├── QuadArm2.fbx.meta │ │ ├── QuadArm.fbx.meta │ │ ├── Propellor.fbx.meta │ │ ├── trap.fbx.meta │ │ ├── UAVLegs.fbx.meta │ │ └── AcrylicPlate.fbx.meta │ ├── Materials │ │ ├── prop.mat │ │ ├── No Name.mat │ │ ├── QuadBase.mat │ │ ├── QuadProp.mat │ │ ├── Waypoint.mat │ │ ├── WaypointPath.mat │ │ ├── No Name.mat.meta │ │ ├── prop.mat.meta │ │ ├── QuadBase.mat.meta │ │ ├── QuadProp.mat.meta │ │ ├── Waypoint.mat.meta │ │ └── WaypointPath.mat.meta │ ├── Images │ │ ├── Propellor.tif │ │ └── Propellor.tif.meta │ ├── 3DModels.meta │ ├── Images.meta │ └── Materials.meta ├── ROSBridgeLib │ ├── websocket-sharp.dll │ ├── sensor_msgs.meta │ ├── std_msgs.meta │ ├── turtlesim.meta │ ├── geometry_msgs.meta │ ├── websocket-sharp.dll.meta │ ├── ROSBridgeMsg.cs.meta │ ├── ROSBridgePublisher.cs.meta │ ├── ROSBridgeSubscriber.cs.meta │ ├── std_msgs │ │ ├── HeaderMsg.cs.meta │ │ ├── Int32Msg.cs.meta │ │ ├── Int64Msg.cs.meta │ │ ├── Int8Msg.cs.meta │ │ ├── StringMsg.cs.meta │ │ ├── TimeMsg.cs.meta │ │ ├── UInt16Msg.cs.meta │ │ ├── UInt32Msg.cs.meta │ │ ├── UInt64Msg.cs.meta │ │ ├── UInt8Msg.cs.meta │ │ ├── Int32MultiArrayMsg.cs.meta │ │ ├── Int64MultiArrayMsg.cs.meta │ │ ├── Int8MultiArrayMsg.cs.meta │ │ ├── MultiArrayLayoutMsg.cs.meta │ │ ├── UInt16MultiArrayMsg.cs.meta │ │ ├── UInt32MultiArrayMsg.cs.meta │ │ ├── UInt64MultiArrayMsg.cs.meta │ │ ├── UInt8MultiArrayMsg.cs.meta │ │ ├── MultiArrayDimensionMsg.cs.meta │ │ ├── PoseMsg.cs.meta │ │ ├── Int32Msg.cs │ │ ├── Int64Msg.cs │ │ ├── Int8Msg.cs │ │ ├── StringMsg.cs │ │ ├── UInt8Msg.cs │ │ ├── UInt32Msg.cs │ │ ├── UInt64Msg.cs │ │ ├── UInt16Msg.cs │ │ ├── PoseMsg.cs │ │ ├── TimeMsg.cs │ │ ├── MultiArrayDimensionMsg.cs │ │ ├── HeaderMsg.cs │ │ ├── UInt64MultiArrayMsg.cs │ │ ├── MultiArrayLayoutMsg.cs │ │ ├── Int32MultiArrayMsg.cs │ │ ├── Int64MultiArrayMsg.cs │ │ ├── Int8MultiArrayMsg.cs │ │ ├── UInt8MultiArrayMsg.cs │ │ ├── UInt32MultiArrayMsg.cs │ │ └── UInt16MultiArrayMsg.cs │ ├── turtlesim │ │ ├── ColorMsg.cs.meta │ │ ├── PoseMsg.cs.meta │ │ ├── VelocityMsg.cs.meta │ │ ├── ColorMsg.cs │ │ ├── VelocityMsg.cs │ │ └── PoseMsg.cs │ ├── geometry_msgs │ │ ├── TwistMsg.cs.meta │ │ ├── Vector3Msg.cs.meta │ │ ├── PoseStampedMsg.cs.meta │ │ ├── PoseStampedMsg.cs │ │ ├── TwistMsg.cs │ │ └── Vector3Msg.cs │ ├── ROSBridgeWebSocketConnection.cs.meta │ ├── sensor_msgs │ │ ├── CompressedImageMsg.cs.meta │ │ └── CompressedImageMsg.cs │ ├── nav_msgs.meta │ ├── waypoint_analyzer.meta │ ├── nav_msgs │ │ ├── PathMsg.cs.meta │ │ └── PathMsg.cs │ ├── ROSBridgePublisher.cs │ ├── ROSBridgeSubscriber.cs │ ├── ROSBridgeMsg.cs │ └── ROSBridgeWebSocketConnection.cs ├── MainScene.unity.meta ├── RosScene.unity.meta ├── Map1Scene.unity.meta ├── Map2Scene.unity.meta ├── Map3Scene.unity.meta ├── TestObstacleScene.unity.meta ├── QuadPhysics.physicMaterial.meta ├── Materials.meta ├── Plugins.meta ├── Resources.meta ├── Scripts.meta ├── TurtleSim.meta ├── Art Resources.meta ├── ControScripts.meta ├── ROSBridgeLib.meta ├── Waypoint_Getter.meta ├── ControScripts │ ├── DestroyTimed.cs │ ├── InternalProp.cs │ ├── MoveTo.cs.meta │ ├── QCVTwo.cs.meta │ ├── DestroyTimed.cs.meta │ ├── InternalProp.cs.meta │ ├── QuadComputer.cs.meta │ ├── SpinProppeller.cs.meta │ ├── MoveTo.cs │ ├── SpinProppeller.cs │ ├── QuadComputer.cs │ └── QCVTwo.cs ├── Scripts │ ├── DragTransform.cs.meta │ ├── TrapMagnet.cs │ ├── WindAffector.cs │ ├── Wind.cs.meta │ ├── SimpleJSON.cs.meta │ ├── TrapMagnet.cs.meta │ ├── UAVMagnet.cs.meta │ ├── WindAffector.cs.meta │ ├── DragTransform.cs │ ├── Wind.cs │ ├── UAVMagnet.cs │ └── SimpleJSON.cs ├── StartMap.cs.meta ├── GroundControl.cs.meta ├── TurtleSim │ ├── FloorTile.cs.meta │ ├── PixPro.cs.meta │ ├── EddyOperator.cs.meta │ ├── Turtle1Pose.cs.meta │ ├── Turtle1Teleop.cs.meta │ ├── TurtlesimViewer.cs.meta │ ├── Turtle1ColorSensor.cs.meta │ ├── Turtle1ServiceResponse.cs.meta │ ├── Turtle1Teleop.cs │ ├── Turtle1ServiceResponse.cs │ ├── FloorTile.cs │ ├── Turtle1ColorSensor.cs │ ├── EddyOperator.cs │ ├── Turtle1Pose.cs │ ├── PixPro.cs │ └── TurtlesimViewer.cs ├── UtilityScripts │ ├── KeepSteady.cs │ └── KeepSteady.cs.meta ├── Waypoint_Getter │ ├── UAV_Path.cs.meta │ └── UAV_Path.cs ├── StartMap.cs └── GroundControl.cs ├── .gitignore └── README.md /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.2.2f1 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /Assets/MainScene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/MainScene.unity -------------------------------------------------------------------------------- /Assets/Map1Scene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Map1Scene.unity -------------------------------------------------------------------------------- /Assets/Map2Scene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Map2Scene.unity -------------------------------------------------------------------------------- /Assets/Map3Scene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Map3Scene.unity -------------------------------------------------------------------------------- /Assets/RosScene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/RosScene.unity -------------------------------------------------------------------------------- /Assets/Materials/Base.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Materials/Base.mat -------------------------------------------------------------------------------- /Assets/Materials/search.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Materials/search.mat -------------------------------------------------------------------------------- /Assets/Resources/UAV.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Resources/UAV.prefab -------------------------------------------------------------------------------- /Assets/TestObstacleScene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/TestObstacleScene.unity -------------------------------------------------------------------------------- /Assets/QuadPhysics.physicMaterial: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/QuadPhysics.physicMaterial -------------------------------------------------------------------------------- /Assets/Resources/Waypoint.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Resources/Waypoint.prefab -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/trap.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/trap.fbx -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/prop.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/Materials/prop.mat -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/websocket-sharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/ROSBridgeLib/websocket-sharp.dll -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/Propellor.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/Propellor.fbx -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/QuadArm.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/QuadArm.fbx -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/QuadArm2.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/QuadArm2.fbx -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/TopPlate.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/TopPlate.fbx -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/UAVLegs.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/UAVLegs.fbx -------------------------------------------------------------------------------- /Assets/Art Resources/Images/Propellor.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/Images/Propellor.tif -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/No Name.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/Materials/No Name.mat -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/QuadBase.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/Materials/QuadBase.mat -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/QuadProp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/Materials/QuadProp.mat -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/Waypoint.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/Materials/Waypoint.mat -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityAnalyticsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/UnityAnalyticsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/AcrylicPlate.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/AcrylicPlate.fbx -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/QuadCopterBase.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/QuadCopterBase.fbx -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/WaypointPath.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/Materials/WaypointPath.mat -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/sensor_msgs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1fa871827f940462e955885e1dd4cff2 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0730648a19ab44b089bc20522ae90cca 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/turtlesim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ff91f4d43ede4a99a75de9336683ea7 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/geometry_msgs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0f5e6e4587064f288f47928600c1a48 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/Materials/No Name.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/Materials/No Name.mat -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/Materials/wood001.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2016UAVClass/Simulation-Unity3D/HEAD/Assets/Art Resources/3DModels/Materials/wood001.mat -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/websocket-sharp.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf26c2b0184f64960a5f1c02a69f3643 3 | MonoAssemblyImporter: 4 | serializedVersion: 1 5 | iconMap: {} 6 | executionOrder: {} 7 | userData: 8 | -------------------------------------------------------------------------------- /Assets/MainScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7945f3d40fae0407b8aa4c23ed2fa437 3 | timeCreated: 1459973667 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/RosScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d1ee30ce8afe43a2838416aed6c011c 3 | timeCreated: 1459978839 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Map1Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f3900c0057111b4aa5eac791ec03116 3 | timeCreated: 1460575500 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Map2Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72a72d45a8a3eb543a77dfb9a5951dc4 3 | timeCreated: 1460603013 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Map3Scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d2873a41566880547ad0edc649bc8774 3 | timeCreated: 1460603410 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Base.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61d4529d466f64668a7a078ff13eed46 3 | timeCreated: 1460831735 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/search.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f8a85eddb2444fbbb43f968f0eb1dfd 3 | timeCreated: 1460402440 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/UAV.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49388830b3b6d4c59a8dd6ee6112b389 3 | timeCreated: 1460831821 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TestObstacleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0af1ba778cecfd54d8e16dd0a0383562 3 | timeCreated: 1460475126 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Waypoint.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f80106fb9778e4e01b0a7cbded452b9d 3 | timeCreated: 1460836547 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/QuadPhysics.physicMaterial.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72f49fd3525ce4f8a93c685b3cb49aeb 3 | timeCreated: 1430083069 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/ROSBridgeMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddfdfbcb287444cdc86b9c85e8da3a4e 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/No Name.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a5822e71311442e3990d216974eaea0 3 | timeCreated: 1459982563 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/prop.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ff3c4c8310144105a3ccbc22198739f 3 | timeCreated: 1431053041 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d96cf6f793df14fdd9cae535debdc973 3 | folderAsset: yes 4 | timeCreated: 1460402440 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40a088cbdfbc4473cb9e2dea76eb76e2 3 | folderAsset: yes 4 | timeCreated: 1459976482 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/ROSBridgePublisher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6173f6d9a3e142bcb3a40106cec8532 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/ROSBridgeSubscriber.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0edf3d17685f345618bc4d9a303dfd14 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/HeaderMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa0fe1eb2d84b446cb2d6a6fbf1db200 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int32Msg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ef1520a454fa45fe834e3be86741894 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int64Msg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 743786319cd014ab28877ecac648f928 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int8Msg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1b5d15e1fca94f89a85411243e23dba 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/StringMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e8c61b841a7d46e3b7bd73e5eb86eaf 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/TimeMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94e73a3a573dc4a66acf242722389049 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt16Msg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 697e105079ef14549a9a4816d28a5f3d 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt32Msg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c47a609befc0402096ac82064415a87 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt64Msg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ab83b5ba3e7d416c9266f41203fc857 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt8Msg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce38a0dda3ec5496c882712efa7ad96c 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/turtlesim/ColorMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c53a3e4284f89450abf702f088d13378 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/turtlesim/PoseMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e789a39767e244f6bb93284e96a270db 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9fe71171e501425fba5b8b34d9922fd 3 | folderAsset: yes 4 | timeCreated: 1459973333 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6617b607c7b842318d4fd25af1b9d10 3 | folderAsset: yes 4 | timeCreated: 1459973333 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TurtleSim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6d603591193b41de9d04333a836ddbd 3 | folderAsset: yes 4 | timeCreated: 1459976580 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Art Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3436b0f0e4a347258ea025ffccc35d9 3 | folderAsset: yes 4 | timeCreated: 1459973333 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/QuadBase.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6737f4ef1b8640f7a1ac250fb257618 3 | timeCreated: 1429404874 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/QuadProp.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6212a06d012b94a37979840c3a7acc36 3 | timeCreated: 1429404886 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/Waypoint.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6cc6a1acd9187453d9bbd9f748ea3d38 3 | timeCreated: 1460836428 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Art Resources/Materials/WaypointPath.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80f93b60e1b834088863fcf1f862eb5d 3 | timeCreated: 1460836472 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ControScripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62f43ae97407c4ec7bfd90792b4a6e49 3 | folderAsset: yes 4 | timeCreated: 1459973333 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8de54507a3858451188d3c26c46b43ed 3 | folderAsset: yes 4 | timeCreated: 1459976498 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/geometry_msgs/TwistMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 144bc841f514642b78880081d813310e 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/geometry_msgs/Vector3Msg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98b84f18246784fae90cf8ffe694adb8 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/turtlesim/VelocityMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db19bc271eb1b4fce981e6ef920bca76 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/Materials/No Name.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc0835af1a28a54458bd305d52753815 3 | timeCreated: 1459981595 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/Materials/wood001.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27f045cab61c4b54085508abbd81e1be 3 | timeCreated: 1459981597 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/ROSBridgeWebSocketConnection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f95a42eb0eab64a5f8ac621ccef19a14 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/sensor_msgs/CompressedImageMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c02188a407cc4aa3b04c21481619f78 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int32MultiArrayMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e57b97b53daaf4d6ca28c9262c6f6d8e 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int64MultiArrayMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc8490e1e5930464db3f39f19961e411 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int8MultiArrayMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2fb16010ba544816b9e36d48a21536b 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/MultiArrayLayoutMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3de29cf6939a848a0a0812ebffce65dc 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt16MultiArrayMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96cd231dcf0c44220a100d278c272e1b 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt32MultiArrayMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8bc65883e19a446ab2646c4d483ffec 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt64MultiArrayMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80a2764d07cd2488fa72334ca8580550 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt8MultiArrayMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8acc76021f60d4435846080610203631 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Waypoint_Getter.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2024abe284d327e45a40a1ff4a48d218 3 | folderAsset: yes 4 | timeCreated: 1461281973 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e48d6740cb1aa41b694f8517034b975e 3 | folderAsset: yes 4 | timeCreated: 1459973333 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Art Resources/Images.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c99d44825509d48f1b399b86c31d7831 3 | folderAsset: yes 4 | timeCreated: 1459973333 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Art Resources/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3bf1bdea4e2a74677961241332394978 3 | folderAsset: yes 4 | timeCreated: 1459973333 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/nav_msgs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e64b256445252fb4c8c51ab0750bdbc1 3 | folderAsset: yes 4 | timeCreated: 1461280107 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/MultiArrayDimensionMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85ab0af26ec6a463dab7c5c11a1dba0e 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/ControScripts/DestroyTimed.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class DestroyTimed : MonoBehaviour { 5 | 6 | public float Seconds; 7 | 8 | void Start () 9 | { 10 | Destroy(gameObject, Seconds); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0765f118f1f3c4244a06b21dc6a4524d 3 | folderAsset: yes 4 | timeCreated: 1459981595 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/waypoint_analyzer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c62c5ece4ed389b40824b47da001194f 3 | folderAsset: yes 4 | timeCreated: 1461281973 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/DragTransform.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82678328e01d0468ebdbcb6bda3ec43a 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Scripts/TrapMagnet.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class TrapMagnet : MonoBehaviour { 5 | 6 | // Use this for initialization 7 | void Start () { 8 | 9 | } 10 | 11 | // Update is called once per frame 12 | void Update () { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Assets/Scripts/WindAffector.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class WindAffector : MonoBehaviour { 5 | 6 | // Use this for initialization 7 | void Start () { 8 | 9 | } 10 | 11 | // Update is called once per frame 12 | void Update () { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Assets/ControScripts/InternalProp.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class InternalProp : MonoBehaviour { 5 | 6 | public Rigidbody Holder; 7 | 8 | void Update() 9 | { 10 | transform.localEulerAngles -= Vector3.up*Time.deltaTime*Mathf.Abs(Holder.angularVelocity.y)*50f; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Assets/StartMap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef9aee99deb924d4da6042c55126f030 3 | timeCreated: 1461598573 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/GroundControl.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c613135543eda496caf757ce91d22b8f 3 | timeCreated: 1460833243 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/Wind.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 217f3bc0010f9467d94854fdb96a2b02 3 | timeCreated: 1460336964 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ControScripts/MoveTo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ca0cfb45eef647148e2404f2570fa57 3 | timeCreated: 1429285319 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ControScripts/QCVTwo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f567d6bda083647dba29178504b98145 3 | timeCreated: 1429811445 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/SimpleJSON.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3868f969ca65e45d0a9713b52b324786 3 | timeCreated: 1459976506 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/TrapMagnet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06dbbaa7b51ed4231a80ccfe39d38f09 3 | timeCreated: 1460338239 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/UAVMagnet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c05e00e702794e2283ae2b034e79ea8 3 | timeCreated: 1460338319 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/WindAffector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1fb0b81dc9ace4c969b9e542b42dfcf7 3 | timeCreated: 1460337150 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TurtleSim/FloorTile.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d0d0f1172fab040e586ee47f99824cba 3 | timeCreated: 1459976612 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TurtleSim/PixPro.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5299655acda44cfd96a4ab003c5beda 3 | timeCreated: 1459976797 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TurtleSim/EddyOperator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2d113cafec144cd2a23a29c2a12df0d 3 | timeCreated: 1459976797 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TurtleSim/Turtle1Pose.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e3f8c43211b7438e947c35e48c369f3 3 | timeCreated: 1459976586 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TurtleSim/Turtle1Teleop.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4963d83e61b94b828cc86ffaa7ea2dc 3 | timeCreated: 1459976586 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TurtleSim/TurtlesimViewer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2b07008799ef405fbabd5d6c288a417 3 | timeCreated: 1459976603 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/UtilityScripts/KeepSteady.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class KeepSteady : MonoBehaviour { 5 | 6 | // Use this for initialization 7 | void Start () { 8 | 9 | } 10 | 11 | // Update is called once per frame 12 | void Update () 13 | { 14 | transform.eulerAngles = Vector3.zero; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Assets/UtilityScripts/KeepSteady.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee854160763814bc097e095216887341 3 | timeCreated: 1461250240 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Waypoint_Getter/UAV_Path.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77c7a882dafb1df488f68540c50e2344 3 | timeCreated: 1461281974 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ControScripts/DestroyTimed.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dbf0df55460bd4df7b659b2d67686c3a 3 | timeCreated: 1429285723 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ControScripts/InternalProp.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1258a75da4ca4b5ea8ad2acee8b9012 3 | timeCreated: 1430264990 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ControScripts/QuadComputer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df52bad85d655462c9194595ceddc614 3 | timeCreated: 1429221843 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ControScripts/SpinProppeller.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6f6d949930e84d46b8d9a3a8c83aa18 3 | timeCreated: 1429024730 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/nav_msgs/PathMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d585bbbd7a0a494b89565358d0fd0a3 3 | timeCreated: 1461280108 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/PoseMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 234dab29f346ef54b84267cc17c77bd8 3 | timeCreated: 1461284875 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TurtleSim/Turtle1ColorSensor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a487bf427a4aa4c469731b6950953ac9 3 | timeCreated: 1459976586 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TurtleSim/Turtle1ServiceResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09ac02ff1efe146e1aeb6c0a2dbc0c0e 3 | timeCreated: 1459976586 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/geometry_msgs/PoseStampedMsg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20f75ab4516679a42966160324ba15d2 3 | timeCreated: 1461280107 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/StartMap.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class StartMap : MonoBehaviour { 5 | 6 | public GameObject[] Maplist; 7 | 8 | // Use this for initialization 9 | void Start () 10 | { 11 | Maplist[Random.Range(0, Maplist.Length)].SetActive(true); 12 | } 13 | 14 | // Update is called once per frame 15 | void Update () { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # =============== # 2 | # Unity generated # 3 | # =============== # 4 | [Tt]emp/ 5 | [Oo]bj/ 6 | [Bb]uild 7 | [Ll]ibrary/ 8 | sysinfo.txt 9 | *.stackdump 10 | 11 | # ===================================== # 12 | # Visual Studio / MonoDevelop generated # 13 | # ===================================== # 14 | [Ee]xported[Oo]bj/ 15 | .vs/ 16 | /*.userprefs 17 | /*.csproj 18 | /*.pidb 19 | /*.suo 20 | /*.sln* 21 | /*.user 22 | /*.unityproj 23 | /*.booproj 24 | 25 | # ============ # 26 | # OS generated # 27 | # ============ # 28 | .DS_Store* 29 | ._* 30 | .Spotlight-V100 31 | .Trashes 32 | Icon? 33 | ehthumbs.db 34 | [Tt]humbs.db 35 | -------------------------------------------------------------------------------- /Assets/ControScripts/MoveTo.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class MoveTo : MonoBehaviour { 5 | 6 | public Vector3 WantPos; 7 | 8 | Vector3 wp; 9 | 10 | 11 | // Update is called once per frame 12 | void Update () 13 | { 14 | if(Input.GetMouseButtonDown(0)) 15 | { 16 | Ray ray = Camera.main.ScreenPointToRay( Input.mousePosition ); 17 | RaycastHit hit; 18 | if( Physics.Raycast( ray, out hit ) ) 19 | { 20 | 21 | if( hit.collider.tag == "Base" ) 22 | { 23 | WantPos = hit.point; 24 | } 25 | 26 | } 27 | } 28 | if(wp != WantPos) 29 | { 30 | wp = WantPos; 31 | QCVTwo[] t = GameObject.FindObjectsOfType(); 32 | foreach(var v in t) 33 | { 34 | v.SetTarget(WantPos); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int32Msg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class Int32Msg : ROSBridgeMsg { 8 | private int _data; 9 | 10 | public Int32Msg(JSONNode msg) { 11 | _data = msg["data"].AsInt; 12 | } 13 | 14 | public Int32Msg(int data) { 15 | _data = data; 16 | } 17 | 18 | public static string GetMessageType() { 19 | return "std_msgs/Int32"; 20 | } 21 | 22 | public int GetData() { 23 | return _data; 24 | } 25 | 26 | public override string ToString() { 27 | return "Int32 [data=" + _data + "]"; 28 | } 29 | 30 | public override string ToYAMLString() { 31 | return "{\"data\" : " + _data + "}"; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int64Msg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class Int64Msg : ROSBridgeMsg { 8 | private long _data; 9 | 10 | public Int64Msg(JSONNode msg) { 11 | _data = long.Parse(msg["data"]); 12 | } 13 | 14 | public Int64Msg(long data) { 15 | _data = data; 16 | } 17 | 18 | public static string GetMessageType() { 19 | return "std_msgs/Int64"; 20 | } 21 | 22 | public long GetData() { 23 | return _data; 24 | } 25 | 26 | public override string ToString() { 27 | return "Int64 [data=" + _data + "]"; 28 | } 29 | 30 | public override string ToYAMLString() { 31 | return "{\"data\" : " + _data + "}"; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int8Msg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class Int8Msg : ROSBridgeMsg { 8 | private sbyte _data; 9 | 10 | public Int8Msg(JSONNode msg) { 11 | _data = sbyte.Parse(msg["data"]); 12 | } 13 | 14 | public Int8Msg(sbyte data) { 15 | _data = data; 16 | } 17 | 18 | public static string GetMessageType() { 19 | return "std_msgs/Int8"; 20 | } 21 | 22 | public sbyte GetData() { 23 | return _data; 24 | } 25 | 26 | public override string ToString() { 27 | return "Int8 [data=" + _data + "]"; 28 | } 29 | 30 | public override string ToYAMLString() { 31 | return "{\"data\" : " + _data + "}"; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/StringMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class StringMsg : ROSBridgeMsg { 8 | private string _data; 9 | 10 | public StringMsg(JSONNode msg) { 11 | _data = msg["data"]; 12 | } 13 | 14 | public StringMsg(string data) { 15 | _data = data; 16 | } 17 | 18 | public static string GetMessageType() { 19 | return "std_msgs/String"; 20 | } 21 | 22 | public string GetData() { 23 | return _data; 24 | } 25 | 26 | public override string ToString() { 27 | return "String [data=" + _data + "]"; 28 | } 29 | 30 | public override string ToYAMLString() { 31 | return "{\"data\" : " + _data + "}"; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt8Msg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class UInt8Msg : ROSBridgeMsg { 8 | private byte _data; 9 | 10 | public UInt8Msg(JSONNode msg) { 11 | _data = byte.Parse(msg["data"]); 12 | } 13 | 14 | public UInt8Msg(byte data) { 15 | _data = data; 16 | } 17 | 18 | public static string GetMessageType() { 19 | return "std_msgs/UInt8"; 20 | } 21 | 22 | public byte GetData() { 23 | return _data; 24 | } 25 | 26 | public override string ToString() { 27 | return "UInt8 [data=" + _data + "]"; 28 | } 29 | 30 | public override string ToYAMLString() { 31 | return "{\"data\" : " + _data + "}"; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt32Msg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class UInt32Msg : ROSBridgeMsg { 8 | private uint _data; 9 | 10 | public UInt32Msg(JSONNode msg) { 11 | _data = uint.Parse(msg["data"]); 12 | } 13 | 14 | public UInt32Msg(uint data) { 15 | _data = data; 16 | } 17 | 18 | public static string GetMessageType() { 19 | return "std_msgs/UInt32"; 20 | } 21 | 22 | public uint GetData() { 23 | return _data; 24 | } 25 | 26 | public override string ToString() { 27 | return "UInt32 [data=" + _data + "]"; 28 | } 29 | 30 | public override string ToYAMLString() { 31 | return "{\"data\" : " + _data + "}"; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/Scripts/DragTransform.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | [AddComponentMenu("Scripts/DragTransform")] 5 | 6 | public class DragTransform : MonoBehaviour { 7 | 8 | protected IEnumerator OnMouseDown () { 9 | Vector3 screenSpace = Camera.main.WorldToScreenPoint(transform.position); 10 | Vector3 offset = transform.position - Camera.main.ScreenToWorldPoint( 11 | new Vector3( 12 | Input.mousePosition.x, 13 | Input.mousePosition.y, 14 | screenSpace.z 15 | ) 16 | ); 17 | while (Input.GetMouseButton(0)) { 18 | Vector3 curScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z); 19 | Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenSpace) + offset; 20 | transform.position = curPosition; 21 | yield return 1; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt64Msg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class Uint64Msg : ROSBridgeMsg { 8 | private ulong _data; 9 | 10 | public Uint64Msg(JSONNode msg) { 11 | _data = ulong.Parse(msg["data"]); 12 | } 13 | 14 | public Uint64Msg(ulong data) { 15 | _data = data; 16 | } 17 | 18 | public static string GetMessageType() { 19 | return "std_msgs/UInt64"; 20 | } 21 | 22 | public ulong GetData() { 23 | return _data; 24 | } 25 | 26 | public override string ToString() { 27 | return "Bool [data=" + _data + "]"; 28 | } 29 | 30 | public override string ToYAMLString() { 31 | return "{\"data\" : " + _data + "}"; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt16Msg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class UInt16Msg : ROSBridgeMsg { 8 | private ushort _data; 9 | 10 | public UInt16Msg(JSONNode msg) { 11 | _data = ushort.Parse(msg["data"]); 12 | } 13 | 14 | public UInt16Msg(ushort data) { 15 | _data = data; 16 | } 17 | 18 | public static string GetMessageType() { 19 | return "std_msgs/UInt16"; 20 | } 21 | 22 | public ushort GetData() { 23 | return _data; 24 | } 25 | 26 | public override string ToString() { 27 | return "UInt16 [data=" + _data + "]"; 28 | } 29 | 30 | public override string ToYAMLString() { 31 | return "{\"data\" : " + _data + "}"; 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/ROSBridgePublisher.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using SimpleJSON; 3 | 4 | /** 5 | * This defines a publisher. There had better be a corresponding subscriber somewhere. This is really 6 | * just a holder for the message topic and message type. 7 | * 8 | * Version History 9 | * 3.1 - changed methods to start with an upper case letter to be more consistent with c# 10 | * style. 11 | * 3.0 - modification from hand crafted version 2.0 12 | * 13 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 14 | * @version 3.1 15 | */ 16 | 17 | namespace ROSBridgeLib { 18 | public class ROSBridgePublisher { 19 | 20 | public static string GetMessageTopic() { 21 | return null; 22 | } 23 | 24 | public static string GetMessageType() { 25 | return null; 26 | } 27 | 28 | public static string ToYAMLString() { 29 | return null; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/Scripts/Wind.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class Wind : MonoBehaviour { 5 | 6 | private WindAffector[] UAVs; 7 | 8 | [Range (0, 25)] 9 | public float WindForce; 10 | public Vector3 WindDirection; 11 | 12 | private float WindForceConst = 4.5f; 13 | 14 | void Start() 15 | { 16 | //Find all objects with WindAffector component at start of simulation 17 | UAVs = FindObjectsOfType(); 18 | } 19 | 20 | void FixedUpdate () 21 | { 22 | for(int i=0; i < UAVs.Length; i++) 23 | { 24 | Rigidbody UAVBody = UAVs[i].GetComponent(); 25 | if(UAVBody) 26 | { 27 | Vector3 wind = WindForce*WindForceConst*(WindDirection.normalized)*Random.Range(0.9f, 1.1f); 28 | Debug.DrawRay(UAVBody.transform.position, wind/(WindForceConst*2), Color.blue); 29 | UAVBody.AddForce(wind*Time.fixedDeltaTime); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Assets/Scripts/UAVMagnet.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class UAVMagnet : MonoBehaviour 5 | { 6 | 7 | GameObject ConnectedTrap; 8 | public bool hasTrap; 9 | 10 | public void Release() 11 | { 12 | if(ConnectedTrap != null) 13 | { 14 | Destroy(ConnectedTrap.GetComponent()); 15 | ConnectedTrap = null; 16 | hasTrap = false; 17 | } 18 | } 19 | 20 | void OnTriggerEnter(Collider col) 21 | { 22 | if(col.GetComponent() != null && ConnectedTrap == null) 23 | { 24 | GameObject Trap = col.GetComponentInParent().gameObject; 25 | Trap.transform.position = new Vector3(transform.position.x, Trap.transform.position.y, transform.position.z); 26 | Trap.AddComponent(); 27 | Trap.GetComponent().connectedBody = GetComponent(); 28 | ConnectedTrap = Trap; 29 | hasTrap = true; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/TurtleSim/Turtle1Teleop.cs: -------------------------------------------------------------------------------- 1 | using ROSBridgeLib; 2 | using ROSBridgeLib.std_msgs; 3 | using ROSBridgeLib.turtlesim; 4 | using System.Collections; 5 | using SimpleJSON; 6 | using UnityEngine; 7 | 8 | /** 9 | * This is a toy example of the Unity-ROS interface talking to the TurtleSim 10 | * tutorial (circa Groovy). Note that due to some changes since then this will have 11 | * to be slightly re-written. This defines the velocity message that we will publish 12 | * 13 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 14 | * @version 3.0 15 | **/ 16 | 17 | public class Turtle1Teleop: ROSBridgePublisher { 18 | 19 | public static string GetMessageTopic() { 20 | return "/turtle1/cmd_vel"; 21 | } 22 | 23 | public static string GetMessageType() { 24 | return "geometry_msgs/Twist"; 25 | } 26 | 27 | public static string ToYAMLString(VelocityMsg msg) { 28 | return msg.ToYAMLString (); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Simulation-Unity3D 2 | Unity3D UAV Simulation 3 | 4 | ## ROS Integration 5 | Simple setup to get ROS on Linux VM connected to Unity3D on host computer 6 | #### ROS Bridge 7 | To connect ROS on VM to host computer, ROS-Bridge is required

8 | Install: `sudo apt-get install ros-indigo-rosbridge-suite`
9 | Run: `roslaunch rosbridge_server rosbridge_websocket.launch`
10 | This creates a websocket on port 9090 by default 11 | #### Connection in Unity3D 12 | Edit line 29 in TurtlesimViewer.cs to use the VM IP address
13 | `ros = new ROSBridgeWebSocketConnection ("ws://VM.IP.ADDRESS", 9090);`
14 | The VM IP address can be found at the top right of VM (two arrows up/down) -> "Connection Information" -> IPv4 IP Address 15 | #### Running System 16 | To test connection, run the ROS turtle sim (http://wiki.ros.org/turtlesim) and run ROS-Bridge on the VM.
17 | In Unity3D open RosScene and click Play.
18 | Use arrow keys inside Unity to move turtle in ROS on VM 19 | -------------------------------------------------------------------------------- /Assets/TurtleSim/Turtle1ServiceResponse.cs: -------------------------------------------------------------------------------- 1 | using ROSBridgeLib; 2 | using ROSBridgeLib.std_msgs; 3 | using ROSBridgeLib.turtlesim; 4 | using System.Collections; 5 | using SimpleJSON; 6 | using UnityEngine; 7 | 8 | /** 9 | * This is a toy example of the Unity-ROS interface talking to the TurtleSim 10 | * tutorial (circa Groovy). Note that due to some changes since then this will have 11 | * to be slightly re-written, but as its a test .... 12 | * 13 | * This defines the callback that responds to service requests. Try the 'T' character 14 | * to toggle the line left by the turtle. 15 | * 16 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 17 | * @version 3.0 18 | **/ 19 | 20 | public class Turtle1ServiceResponse { 21 | 22 | public static void ServiceCallBack(string service, string response) { 23 | if(response == null) 24 | Debug.Log ("ServiceCallback for service " + service); 25 | else 26 | Debug.Log ("ServiceCallback for service " + service + " response " + response); 27 | } 28 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/geometry_msgs/PoseStampedMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | using ROSBridgeLib.std_msgs; 5 | 6 | namespace ROSBridgeLib { 7 | namespace geometry_msgs { 8 | public class PoseStampedMsg : ROSBridgeMsg { 9 | public HeaderMsg _header; 10 | public PoseMsg _pose; 11 | 12 | public PoseStampedMsg(JSONNode msg) { 13 | _header = new HeaderMsg(msg["header"]); 14 | _pose = new PoseMsg(msg["pose"]); 15 | } 16 | /* 17 | public static string GetMessageType() { 18 | return "geometry_msgs/Twist"; 19 | } 20 | 21 | public Vector3Msg GetLinear() { 22 | return _linear; 23 | } 24 | 25 | public Vector3Msg GetAngular() { 26 | return _angular; 27 | } 28 | 29 | public override string ToString() { 30 | return "Twist [linear=" + _linear.ToString() + ", angular=" + _angular.ToString() + "]"; 31 | } 32 | 33 | public override string ToYAMLString() { 34 | return "{\"linear\" : " + _linear.ToYAMLString() + ", \"angular\" : " + _angular.ToYAMLString() + "}"; 35 | } */ 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Assets/TurtleSim/FloorTile.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | /** 5 | * Build a simple floor tile in alternating red and white checks, 1m a side. 6 | * x-z is the floor. Origin is (x0, y0) and the tile floor is n squares in x 7 | * and m squares in z. 8 | * 9 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 10 | * @version 3.0 11 | */ 12 | 13 | public static class FloorTile { 14 | 15 | public static void Floor(float x0, float z0, int n, int m) { 16 | 17 | Quaternion pose = Quaternion.Euler (90, 0, 0); 18 | 19 | for (int i=0; i().material.color = new Color (255, 255, 255); 28 | else 29 | obj.GetComponent().material.color = new Color (255, 0, 0); 30 | white = !white; 31 | } 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Assets/TurtleSim/Turtle1ColorSensor.cs: -------------------------------------------------------------------------------- 1 | using ROSBridgeLib; 2 | using ROSBridgeLib.std_msgs; 3 | using ROSBridgeLib.turtlesim; 4 | using System.Collections; 5 | using SimpleJSON; 6 | using UnityEngine; 7 | 8 | /** 9 | * This is a toy example of the Unity-ROS interface talking to the TurtleSim 10 | * tutorial (circa Groovy). Note that due to some changes since then this will have 11 | * to be slightly re-written, but as its a test .... 12 | * 13 | * This defines the callback that links the color_sensor message and its callback 14 | * 15 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 16 | * @version 3.0 17 | **/ 18 | 19 | public class Turtle1ColorSensor : ROSBridgeSubscriber { 20 | 21 | public new static string GetMessageTopic() { 22 | return "/turtle1/color_sensor"; 23 | } 24 | 25 | public new static string GetMessageType() { 26 | return "turtlesim/Color"; 27 | } 28 | 29 | public new static ROSBridgeMsg ParseMessage(JSONNode msg) { 30 | return new ColorMsg(msg); 31 | } 32 | 33 | public new static void CallBack(ROSBridgeMsg msg) { 34 | Debug.Log ("Render callback in /turtle1/color_sensor" + msg); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/geometry_msgs/TwistMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace geometry_msgs { 7 | public class TwistMsg : ROSBridgeMsg { 8 | private Vector3Msg _linear; 9 | private Vector3Msg _angular; 10 | 11 | public TwistMsg(JSONNode msg) { 12 | _linear = new Vector3Msg(msg["linear"]); 13 | _angular = new Vector3Msg(msg["angular"]); 14 | } 15 | 16 | public TwistMsg(Vector3Msg linear, Vector3Msg angular) { 17 | _linear = linear; 18 | _angular = angular; 19 | } 20 | 21 | public static string GetMessageType() { 22 | return "geometry_msgs/Twist"; 23 | } 24 | 25 | public Vector3Msg GetLinear() { 26 | return _linear; 27 | } 28 | 29 | public Vector3Msg GetAngular() { 30 | return _angular; 31 | } 32 | 33 | public override string ToString() { 34 | return "Twist [linear=" + _linear.ToString() + ", angular=" + _angular.ToString() + "]"; 35 | } 36 | 37 | public override string ToYAMLString() { 38 | return "{\"linear\" : " + _linear.ToYAMLString() + ", \"angular\" : " + _angular.ToYAMLString() + "}"; 39 | } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/PoseMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | using ROSBridgeLib.std_msgs; 5 | 6 | /** 7 | * Define a turtle pose message. This has been hand-crafted from the corresponding 8 | * turtle message file. 9 | * 10 | * Version History 11 | * 3.1 - changed methods to start with an upper case letter to be more consistent with c# 12 | * style. 13 | * 3.0 - modification from hand crafted version 2.0 14 | * 15 | */ 16 | 17 | namespace ROSBridgeLib { 18 | namespace std_msgs { 19 | public class PoseMsg : ROSBridgeMsg { 20 | public float _x, _y, _z; 21 | 22 | public PoseMsg(JSONNode msg) { 23 | _x = float.Parse(msg["x"]); 24 | _y = float.Parse(msg["y"]); 25 | _z = float.Parse(msg["z"]); 26 | } 27 | 28 | public PoseMsg(float x, float y, float z) { 29 | _x = x; 30 | _y = y; 31 | _z = z; 32 | } 33 | 34 | /* public static string getMessageType() { 35 | return "turtlesim/Pose"; 36 | } */ 37 | 38 | /* public float GetX() { 39 | return _x; 40 | } 41 | 42 | public float GetY() { 43 | return _y; 44 | } 45 | 46 | public float GetZ() { 47 | return _z; 48 | } */ 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/ROSBridgeSubscriber.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using SimpleJSON; 3 | 4 | /** 5 | * This defines a subscriber. Subscribers listen to publishers in ROS. Now if we could have inheritance 6 | * on static classes then we could do this differently. But basically, you have to make up one of these 7 | * for every subscriber you need. 8 | * 9 | * Subscribers require a ROSBridgePacket to subscribe to (its type). They need the name of 10 | * the message, and they need something to draw it. 11 | * 12 | * Version History 13 | * 3.1 - changed methods to start with an upper case letter to be more consistent with c# 14 | * style. 15 | * 3.0 - modification from hand crafted version 2.0 16 | * 17 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 18 | * @version 3.1 19 | */ 20 | 21 | namespace ROSBridgeLib { 22 | public class ROSBridgeSubscriber { 23 | 24 | public static string GetMessageTopic() { 25 | return null; 26 | } 27 | 28 | public static string GetMessageType() { 29 | return null; 30 | } 31 | 32 | public static ROSBridgeMsg ParseMessage(JSONNode msg) { 33 | return null; 34 | } 35 | 36 | public static void callBack(ROSBridgeMsg msg) { 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/geometry_msgs/Vector3Msg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | using ROSBridgeLib.geometry_msgs; 5 | 6 | namespace ROSBridgeLib { 7 | namespace geometry_msgs { 8 | public class Vector3Msg : ROSBridgeMsg { 9 | private double _x; 10 | private double _y; 11 | private double _z; 12 | 13 | public Vector3Msg(JSONNode msg) { 14 | _x = double.Parse(msg["x"]); 15 | _y = double.Parse(msg["y"]); 16 | _z = double.Parse(msg["z"]); 17 | } 18 | 19 | public Vector3Msg(double x, double y, double z) { 20 | _x = x; 21 | _y = y; 22 | _z = z; 23 | } 24 | 25 | public static string GetMessageType() { 26 | return "geometry_msgs/Vector3"; 27 | } 28 | 29 | public double GetX() { 30 | return _x; 31 | } 32 | 33 | public double GetY() { 34 | return _y; 35 | } 36 | 37 | public double GetZ() { 38 | return _z; 39 | } 40 | 41 | public override string ToString() { 42 | return "Vector3 [x=" + _x + ", y="+ _y + ", z=" + _z + "]"; 43 | } 44 | 45 | public override string ToYAMLString() { 46 | return "{\"x\" : " + _x + ", \"y\" : " + _y + ", \"z\" : " + _z + "}"; 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Assets/TurtleSim/EddyOperator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using ROSBridgeLib; 4 | using System.Reflection; 5 | using System; 6 | using ROSBridgeLib.geometry_msgs; 7 | 8 | 9 | /** 10 | * Talk to Eddy 11 | * 12 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 13 | * @version 3.0 14 | **/ 15 | 16 | public class EddyOperator : MonoBehaviour { 17 | private ROSBridgeWebSocketConnection ros = null; 18 | private Boolean _useJoysticks; 19 | 20 | 21 | // the critical thing here is to define our subscribers, publishers and service response handlers 22 | void Start () { 23 | //FloorTile.Floor (0, 0, 12, 12); 24 | _useJoysticks = Input.GetJoystickNames ().Length > 0; 25 | ros = new ROSBridgeWebSocketConnection ("ws://130.63.93.66", 9090); 26 | ros.AddSubscriber (typeof(Pixpro)); 27 | ros.Connect (); 28 | } 29 | 30 | // extremely important to disconnect from ROS. OTherwise packets continue to flow 31 | void OnApplicationQuit() { 32 | if(ros!=null) 33 | ros.Disconnect (); 34 | } 35 | 36 | // Update is called once per frame in Unity. The Unity camera follows the robot (which is driven by 37 | // the ROS environment. We also use the joystick or cursor keys to generate teleoperational commands 38 | // that are sent to the ROS world, which drives the robot which ... 39 | void Update () { 40 | ros.Render (); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/nav_msgs/PathMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | using ROSBridgeLib.std_msgs; 5 | using ROSBridgeLib.geometry_msgs; 6 | // Need geometry_msgs/PoseStamped[] 7 | 8 | namespace ROSBridgeLib { 9 | namespace nav_msgs { 10 | public class PathMsg : ROSBridgeMsg { 11 | public HeaderMsg _header; 12 | public PoseStampedMsg[] _poses; 13 | 14 | public PathMsg(JSONNode msg) { 15 | _header = new HeaderMsg(msg["header"]); 16 | _poses = new PoseStampedMsg[](msg["poses"]); //WRONG syntax 17 | // Maybe for loop here 18 | } 19 | 20 | /* public CompressedImageMsg(JSONNode msg) { 21 | _format = msg ["format"]; 22 | _header = new HeaderMsg (msg ["header"]); 23 | //_poses = 24 | } */ 25 | 26 | /* public static string GetMessageType() { 27 | return "geometry_msgs/Twist"; 28 | } */ 29 | 30 | /* public HeaderMsg GetHeader() { 31 | return _header; 32 | } */ 33 | 34 | /* public PoseStamped[] GetPoses() { 35 | return _poses; 36 | } */ 37 | /* 38 | public override string ToString() { 39 | return "Twist [linear=" + _linear.ToString() + ", angular=" + _angular.ToString() + "]"; 40 | } 41 | 42 | public override string ToYAMLString() { 43 | return "{\"linear\" : " + _linear.ToYAMLString() + ", \"angular\" : " + _angular.ToYAMLString() + "}"; 44 | } */ 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/TimeMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | /** 6 | * Define a time message. These have been hand-crafted from the corresponding msg file. 7 | * 8 | * Version History 9 | * 3.1 - changed methods to start with an upper case letter to be more consistent with c# 10 | * style. 11 | * 3.0 - modification from hand crafted version 2.0 12 | * 13 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 14 | * @version 3.1 15 | */ 16 | 17 | namespace ROSBridgeLib { 18 | namespace std_msgs { 19 | public class TimeMsg : ROSBridgeMsg { 20 | private int _secs, _nsecs; 21 | 22 | public TimeMsg(JSONNode msg) { 23 | _secs = int.Parse(msg["secs"]); 24 | _nsecs = int.Parse (msg["nsecs"]); 25 | } 26 | 27 | public TimeMsg(int secs, int nsecs) { 28 | _secs = secs; 29 | _nsecs = nsecs; 30 | } 31 | 32 | public static string GetMessageType() { 33 | return "std_msgs/Time"; 34 | } 35 | 36 | public int GetSecs() { 37 | return _secs; 38 | } 39 | 40 | public int GetNsecs() { 41 | return _nsecs; 42 | } 43 | 44 | public override string ToString() { 45 | return "Time [secs=" + _secs + ", nsecs=" + _nsecs + "]"; 46 | } 47 | 48 | public override string ToYAMLString() { 49 | return "{\"data\" : {\"secs\" : " + _secs + ", \"nsecs\" : " + _nsecs + "}}"; 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Assets/Art Resources/Images/Propellor.tif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3bd70eaae396840fea11eb06e02d5733 3 | timeCreated: 1431052991 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | spriteMode: 1 41 | spriteExtrude: 1 42 | spriteMeshType: 1 43 | alignment: 0 44 | spritePivot: {x: .5, y: .5} 45 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 46 | spritePixelsToUnits: 100 47 | alphaIsTransparency: 1 48 | textureType: 8 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/MultiArrayDimensionMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class MultiArrayDimensionMsg : ROSBridgeMsg { 8 | private string _label; 9 | private uint _size, _stride; 10 | 11 | public MultiArrayDimensionMsg(JSONNode msg) { 12 | _label = msg["label"]; 13 | _size = uint.Parse(msg["size"]); 14 | _stride = uint.Parse(msg["stride"]); 15 | } 16 | 17 | public MultiArrayDimensionMsg(string label, uint size, uint stride) { 18 | _label = label; 19 | _size = size; 20 | _stride = stride; 21 | } 22 | 23 | public static string GetMessageType() { 24 | return "std_msgs/MultiArrayDimension"; 25 | } 26 | 27 | public string GetLabel() { 28 | return _label; 29 | } 30 | 31 | public uint GetSize() { 32 | return _size; 33 | } 34 | 35 | public uint GetStride() { 36 | return _stride; 37 | } 38 | 39 | public override string ToString() { 40 | return "MultiArrayDimension [label=" + _label + ", size=" + _size + ", stride = " + _stride + "]"; 41 | } 42 | 43 | public override string ToYAMLString() { 44 | return "{\"label\" : " + _label + ",\"size\" :" + _size + ",\"stride\" :" + _stride + "}"; 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Assets/TurtleSim/Turtle1Pose.cs: -------------------------------------------------------------------------------- 1 | using ROSBridgeLib; 2 | using ROSBridgeLib.std_msgs; 3 | using ROSBridgeLib.turtlesim; 4 | using System.Collections; 5 | using SimpleJSON; 6 | using UnityEngine; 7 | 8 | /** 9 | * This is a toy example of the Unity-ROS interface talking to the TurtleSim 10 | * tutorial (circa Groovy). Note that due to some changes since then this will have 11 | * to be slightly re-written, but as its a test .... 12 | * 13 | * This defines the callback that links the pose message. It moves the Dalek with 14 | * the turtlesim 15 | * 16 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 17 | * @version 3.0 18 | **/ 19 | 20 | public class Turtle1Pose : ROSBridgeSubscriber { 21 | 22 | public new static string GetMessageTopic() { 23 | return "/turtle1/pose"; 24 | } 25 | 26 | public new static string GetMessageType() { 27 | return "turtlesim/Pose"; 28 | } 29 | 30 | public new static ROSBridgeMsg ParseMessage(JSONNode msg) { 31 | return new PoseMsg(msg); 32 | } 33 | 34 | public new static void CallBack(ROSBridgeMsg msg) { 35 | GameObject robot = GameObject.Find ("Dalek"); 36 | if (robot == null) 37 | Debug.Log ("Can't find the robot???"); 38 | else { 39 | PoseMsg pose = (PoseMsg) msg; 40 | robot.transform.position = new Vector3(pose.GetX (), 0.2f, pose.GetY()); 41 | robot.transform.rotation = Quaternion.AngleAxis (-pose.GetTheta() * 180.0f / 3.1415f, Vector3.up); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/turtlesim/ColorMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | /** 6 | * Define a turtle colour message. This has been hand-crafted from the corresponding 7 | * turtle message file. 8 | * 9 | * Version History 10 | * 3.1 - changed methods to start with an upper case letter to be more consistent with c# 11 | * style. 12 | * 3.0 - modification from hand crafted version 2.0 13 | * 14 | */ 15 | 16 | namespace ROSBridgeLib { 17 | namespace turtlesim { 18 | public class ColorMsg : ROSBridgeMsg { 19 | private int _r, _g, _b; //uint 20 | 21 | public ColorMsg(JSONNode msg) { 22 | _r = int.Parse(msg["r"]); 23 | _g = int.Parse(msg["g"]); 24 | _b = int.Parse(msg["b"]); 25 | } 26 | 27 | public ColorMsg(int r, int g, int b) { 28 | _r = r; 29 | _g = g; 30 | _b = b; 31 | } 32 | 33 | public static string GetMessageType() { 34 | return "turtlesim/Color"; 35 | } 36 | 37 | public int GetR() { 38 | return _r; 39 | } 40 | 41 | public int GetG() { 42 | return _g; 43 | } 44 | 45 | public int GetB() { 46 | return _b; 47 | } 48 | 49 | public override string ToString() { 50 | return "turtlesim/Color [r=" + _r + ", g=" + _g + ", b=" + _b + "]"; 51 | } 52 | 53 | public override string ToYAMLString() { 54 | return "{\"r\" : " + _r + ", \"g\": " + _g + ", \"b\": " + _b + "}"; 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Assets/Waypoint_Getter/UAV_Path.cs: -------------------------------------------------------------------------------- 1 | using ROSBridgeLib; 2 | using ROSBridgeLib.std_msgs; 3 | using ROSBridgeLib.turtlesim; 4 | using System.Collections; 5 | using SimpleJSON; 6 | using UnityEngine; 7 | 8 | /** 9 | * This is a toy example of the Unity-ROS interface talking to the TurtleSim 10 | * tutorial (circa Groovy). Note that due to some changes since then this will have 11 | * to be slightly re-written, but as its a test .... 12 | * 13 | * This defines the callback that links the pose message. It moves the Dalek with 14 | * the turtlesim 15 | * 16 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 17 | * @version 3.0 18 | **/ 19 | 20 | public class UAV_Path : ROSBridgeSubscriber { 21 | 22 | public new static string GetMessageTopic() { 23 | return "/uav_path_topic"; 24 | } 25 | 26 | public new static string GetMessageType() { 27 | return "turtlesim/Pose"; //??? 28 | } 29 | 30 | public new static ROSBridgeMsg ParseMessage(JSONNode msg) { 31 | return new PathMsg(msg); 32 | } 33 | 34 | public new static void CallBack(ROSBridgeMsg msg) { 35 | GameObject uav = GameObject.Find ("UAV"); 36 | if (uav == null) 37 | Debug.Log ("Can't find the uav???"); 38 | else { 39 | PathMsg path = (PathMsg) msg; 40 | for (int i = 0; i < path.poses.length(); i = i+1){ 41 | // Just need to add a point type for each pose message 42 | } 43 | 44 | robot.transform.position = new Vector3(pose.GetX (), 0.2f, pose.GetY()); 45 | robot.transform.rotation = Quaternion.AngleAxis (-pose.GetTheta() * 180.0f / 3.1415f, Vector3.up); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/turtlesim/VelocityMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | /** 6 | * Define a turtle velocity message. This has been hand-crafted from the corresponding 7 | * turtle message file. Note: the Groovy version of turtlesim uses this message. Later 8 | * versions of turtle sim do not. This will have to be fixed in the future. 9 | * 10 | * Version History 11 | * 3.1 - changed methods to start with an upper case letter to be more consistent with c# 12 | * style. 13 | * 3.0 - modification from hand crafted version 2.0 14 | * 15 | */ 16 | 17 | namespace ROSBridgeLib { 18 | namespace turtlesim { 19 | public class VelocityMsg : ROSBridgeMsg { 20 | private float _linear, _angular; 21 | 22 | public VelocityMsg(JSONNode msg) { 23 | _linear = float.Parse(msg["linear"]); 24 | _angular = float.Parse (msg["angular"]); 25 | } 26 | 27 | public VelocityMsg(float linear, float angular) { 28 | _linear = linear; 29 | _angular = angular; 30 | } 31 | 32 | public static string GetMessageType() { 33 | return "turtlesim/Velocity"; 34 | } 35 | 36 | public float GetLinear() { 37 | return _linear; 38 | } 39 | 40 | public float GetAngular() { 41 | return _angular; 42 | } 43 | 44 | public override string ToString() { 45 | return "turtlesim/Velocity [linear=" + _linear + ", angular=" + _angular + "]"; 46 | } 47 | 48 | public override string ToYAMLString() { 49 | return "{\"linear\" : " + _linear + ", \"angular\" : " + _angular +"}"; 50 | } 51 | } 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /Assets/ControScripts/SpinProppeller.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class SpinProppeller : MonoBehaviour { 5 | 6 | public Rigidbody rb; 7 | public Rigidbody holder; 8 | public float force; 9 | public Vector3 TorqueForce; 10 | 11 | private bool broken; 12 | 13 | public GameObject Point; 14 | 15 | public GameObject Blur; 16 | 17 | void Start() 18 | { 19 | rb.maxAngularVelocity = 40; 20 | } 21 | 22 | void Update() 23 | { 24 | if(Mathf.Abs(rb.angularVelocity.y) > 10) 25 | { 26 | Blur.SetActive(true); 27 | } 28 | else 29 | { 30 | Blur.SetActive(false); 31 | } 32 | } 33 | 34 | public void SpinProp(float PortionForce) 35 | { 36 | if(broken) 37 | return; 38 | 39 | rb.AddRelativeTorque(TorqueForce*Time.deltaTime*PortionForce*Mathf.Clamp((0.5f/Mathf.Abs(rb.angularVelocity.y)), 0, 1)); 40 | rb.AddForceAtPosition((transform.TransformDirection(Vector3.up)*force*Time.deltaTime*PortionForce) * GroundEffect(), transform.position); 41 | rb.AddForce((Point.transform.TransformDirection(Vector3.forward)*force*Time.deltaTime*PortionForce)); 42 | } 43 | 44 | float GroundEffect() 45 | { 46 | float val = 1; 47 | float extra = 0; 48 | Ray r = new Ray(holder.transform.position, Vector3.down*0.25f); 49 | RaycastHit hit; 50 | if(Physics.Raycast(r, out hit)) 51 | { 52 | extra = Random.Range(0.7f, Mathf.Clamp(1.0f/hit.distance, 0.0f, 1.8f)) * Mathf.Clamp(Mathf.Sqrt(1.0f/hit.distance), 0, 1.35f); 53 | } 54 | return val;//+extra; 55 | } 56 | 57 | void OnJointBreak(float breakForce) 58 | { 59 | holder.angularDrag = .01f; 60 | broken = true; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/sensor_msgs/CompressedImageMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | using ROSBridgeLib.std_msgs; 5 | using UnityEngine; 6 | 7 | /** 8 | * Define a compressed image message. Note: the image is assumed to be in Base64 format. 9 | * Which seems to be what is normally found in json strings. Documentation. Got to love it. 10 | * 11 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 12 | * @version 3.1 13 | */ 14 | 15 | namespace ROSBridgeLib { 16 | namespace sensor_msgs { 17 | public class CompressedImageMsg : ROSBridgeMsg { 18 | private string _format; 19 | private byte[] _data; 20 | private HeaderMsg _header; 21 | 22 | 23 | public CompressedImageMsg(JSONNode msg) { 24 | _format = msg ["format"]; 25 | _header = new HeaderMsg (msg ["header"]); 26 | _data = System.Convert.FromBase64String(msg ["data"]); 27 | } 28 | 29 | public CompressedImageMsg(HeaderMsg header, string format, byte[] data) { 30 | _header = header; 31 | _format = format; 32 | _data = data; 33 | } 34 | 35 | public byte[] GetImage() { 36 | return _data; 37 | } 38 | 39 | public static string GetMessageType() { 40 | return "sensor_msgs/CompressedImage"; 41 | } 42 | 43 | public override string ToString() { 44 | return "Compressed Image [format=" + _format + ", size=" + _data.Length + ", Header " + _header.ToString () + "]"; 45 | } 46 | 47 | public override string ToYAMLString() { 48 | return "{\"format\" : " + "\"" + _format + "\", \"data\" : \"" + System.Convert.ToBase64String (_data) + "\", \"header\" : " + _header.ToYAMLString () + "}"; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/HeaderMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | using UnityEngine; 5 | 6 | /** 7 | * Define a header message. These have been hand-crafted from the corresponding msg file. 8 | * 9 | * Version History 10 | * 11 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 12 | * @version 3.0 13 | */ 14 | 15 | namespace ROSBridgeLib { 16 | namespace std_msgs { 17 | public class HeaderMsg : ROSBridgeMsg { 18 | private int _seq; 19 | private TimeMsg _stamp; 20 | private string _frame_id; 21 | 22 | public HeaderMsg(JSONNode msg) { 23 | Debug.Log ("HeaderMsg with " + msg.ToString ()); 24 | _seq = int.Parse (msg["seq"]); 25 | _stamp = new TimeMsg (msg ["stamp"]); 26 | _frame_id = msg["frame_id"]; 27 | Debug.Log ("HeaderMsg done "); 28 | Debug.Log (" and it looks like " + this.ToString ()); 29 | } 30 | 31 | public HeaderMsg(int seq, TimeMsg stamp, string frame_id) { 32 | _seq = seq; 33 | _stamp = stamp; 34 | _frame_id = frame_id; 35 | } 36 | 37 | public static string GetMessageType() { 38 | return "std_msgs/Header"; 39 | } 40 | 41 | public int GetSeq() { 42 | return _seq; 43 | } 44 | 45 | public TimeMsg GetTimeMsg() { 46 | return _stamp; 47 | } 48 | 49 | public string GetFrameId() { 50 | return _frame_id; 51 | } 52 | 53 | public override string ToString() { 54 | return "Header [seq=" + _seq + ", stamp=" + _stamp + ", frame_id=" + _frame_id + "]"; 55 | } 56 | 57 | public override string ToYAMLString() { 58 | return "{\"seq\" : " + _seq + ", \"stamp\" : " + _stamp.ToYAMLString () + ", frame_id=" + _frame_id + "}"; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Assets/TurtleSim/PixPro.cs: -------------------------------------------------------------------------------- 1 | using ROSBridgeLib; 2 | using ROSBridgeLib.sensor_msgs; 3 | using System.Collections; 4 | using SimpleJSON; 5 | using UnityEngine; 6 | using System.IO; 7 | 8 | /** 9 | * A callback to define a Pixpro image 10 | * 11 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 12 | * @version 3.0 13 | **/ 14 | 15 | public class Pixpro : ROSBridgeSubscriber { 16 | 17 | public new static string GetMessageTopic() { 18 | return "/pixpro/compressed"; 19 | } 20 | 21 | public new static string GetMessageType() { 22 | return "sensor_msgs/CompressedImage"; 23 | } 24 | 25 | public new static ROSBridgeMsg ParseMessage(JSONNode msg) { 26 | Debug.Log ("ParseMessage in Pixpro"); 27 | return new CompressedImageMsg(msg); 28 | } 29 | 30 | public new static void CallBack(ROSBridgeMsg msg) { 31 | Debug.Log (GetMessageTopic () + " received"); 32 | 33 | CompressedImageMsg imageMsg = (CompressedImageMsg) msg; 34 | 35 | Texture2D tex = new Texture2D (2, 2); 36 | byte[] image = imageMsg.GetImage (); 37 | tex.LoadImage (image); 38 | 39 | GameObject sphere = GameObject.Find ("/SkySphere"); 40 | if(sphere == null) 41 | Debug.Log ("No /SkySpheree"); 42 | else { 43 | Texture2D.DestroyImmediate (sphere.GetComponent().material.mainTexture, true); 44 | sphere.GetComponent().material.mainTexture = tex; 45 | 46 | Debug.Log ("Texture updated"); 47 | } 48 | 49 | GameObject cube = GameObject.Find ("/Cube"); 50 | if(sphere == null) 51 | Debug.Log ("No /Cube"); 52 | else { 53 | Texture2D.DestroyImmediate (cube.GetComponent().material.mainTexture, true); 54 | cube.GetComponent().material.mainTexture = tex; 55 | cube.transform.Rotate(0, Time.deltaTime * 50, 0, Space.World); 56 | 57 | Debug.Log ("Cube Texture updated"); 58 | Debug.Log ("delta was " + Time.deltaTime); 59 | } 60 | 61 | 62 | 63 | 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /Assets/GroundControl.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | public class GroundControl : MonoBehaviour { 6 | 7 | public List TargetList; 8 | public QCVTwo UAV; 9 | int i = 0; 10 | 11 | public GameObject WaypointRender; 12 | 13 | List points; 14 | 15 | // Use this for initialization 16 | void Start () 17 | { 18 | points = new List(); 19 | if(UAV == null) 20 | UAV = FindObjectOfType(); 21 | 22 | for(int i=0; i().SetPosition(0, p1); 32 | nW.GetComponent().SetPosition(1, p2); 33 | } 34 | 35 | } 36 | 37 | bool reset; 38 | 39 | // Update is called once per frame 40 | void Update () 41 | { 42 | if(Input.GetKeyDown(KeyCode.R)) 43 | { 44 | reload(); 45 | } 46 | if(UAV.ReachedTarget == true && i < TargetList.Count) 47 | { 48 | if(i > 0) 49 | points[i-1].GetComponent().material.color = new Color(0, 1, 0, 0.5f); 50 | Debug.Log("Starting Waypoint action " + (i+1)); 51 | UAV.SetTarget(TargetList[i].Pos); 52 | UAV.ttype = TargetList[i].type; 53 | i++; 54 | } 55 | else if(i >= TargetList.Count && UAV.ReachedTarget == true && !reset) 56 | { 57 | reset = true; 58 | Invoke("reload", 4f); 59 | } 60 | } 61 | 62 | void reload() 63 | { 64 | Application.LoadLevel(0); 65 | } 66 | } 67 | 68 | [System.Serializable] 69 | public class QuadCommand 70 | { 71 | public Vector3 Pos; 72 | public PointType type; 73 | } 74 | 75 | public enum PointType 76 | { 77 | Takeoff, 78 | Waypoint, 79 | Dropoff, 80 | Pickup, 81 | Land 82 | } -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/TopPlate.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09702f8e164384b84b5108bb4aae6127 3 | timeCreated: 1429470452 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 400000: //RootNode 10 | 2300000: //RootNode 11 | 3300000: //RootNode 12 | 4300000: TopPlate 13 | 9500000: //RootNode 14 | materials: 15 | importMaterials: 1 16 | materialName: 0 17 | materialSearch: 1 18 | animations: 19 | legacyGenerateAnimations: 4 20 | bakeSimulation: 0 21 | optimizeGameObjects: 0 22 | motionNodeName: 23 | animationCompression: 1 24 | animationRotationError: .5 25 | animationPositionError: .5 26 | animationScaleError: .5 27 | animationWrapMode: 0 28 | extraExposedTransformPaths: [] 29 | clipAnimations: [] 30 | isReadable: 1 31 | meshes: 32 | lODScreenPercentages: [] 33 | globalScale: 1 34 | meshCompression: 0 35 | addColliders: 0 36 | importBlendShapes: 1 37 | swapUVChannels: 0 38 | generateSecondaryUV: 0 39 | useFileUnits: 1 40 | optimizeMeshForGPU: 1 41 | keepQuads: 0 42 | weldVertices: 1 43 | secondaryUVAngleDistortion: 8 44 | secondaryUVAreaDistortion: 15.000001 45 | secondaryUVHardAngle: 88 46 | secondaryUVPackMargin: 4 47 | useFileScale: 1 48 | tangentSpace: 49 | normalSmoothAngle: 60 50 | splitTangentsAcrossUV: 1 51 | normalImportMode: 0 52 | tangentImportMode: 1 53 | importAnimation: 1 54 | copyAvatar: 0 55 | humanDescription: 56 | human: [] 57 | skeleton: [] 58 | armTwist: .5 59 | foreArmTwist: .5 60 | upperLegTwist: .5 61 | legTwist: .5 62 | armStretch: .0500000007 63 | legStretch: .0500000007 64 | feetSpacing: 0 65 | rootMotionBoneName: 66 | lastHumanDescriptionAvatarSource: {instanceID: 0} 67 | animationType: 2 68 | additionalBone: 0 69 | userData: 70 | assetBundleName: 71 | assetBundleVariant: 72 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt64MultiArrayMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class UInt64MultiArrayMsg : ROSBridgeMsg { 8 | private MultiArrayLayoutMsg _layout; 9 | private ulong[] _data; 10 | 11 | public UInt64MultiArrayMsg(JSONNode msg) { 12 | _layout = new MultiArrayLayoutMsg(msg["layout"]); 13 | _data = new ulong[msg["data"].Count]; 14 | for (int i = 0; i < _data.Length; i++) { 15 | _data[i] = ulong.Parse(msg["data"][i]); 16 | } 17 | } 18 | 19 | public UInt64MultiArrayMsg(MultiArrayLayoutMsg layout, ulong[] data) { 20 | _layout = layout; 21 | _data = data; 22 | } 23 | 24 | public static string GetMessageType() { 25 | return "std_msgs/UInt64MultiArray"; 26 | } 27 | 28 | public ulong[] GetData() { 29 | return _data; 30 | } 31 | 32 | public MultiArrayLayoutMsg GetLayout() { 33 | return _layout; 34 | } 35 | 36 | public override string ToString() { 37 | string array = "["; 38 | for (int i = 0; i < _data.Length; i++) { 39 | array = array + _data[i]; 40 | if (_data.Length - i <= 1) 41 | array += ","; 42 | } 43 | array += "]"; 44 | return "UInt64MultiArray [layout=" + _layout.ToString() + ", data=" + _data + "]"; 45 | } 46 | 47 | public override string ToYAMLString() { 48 | string array = "["; 49 | for (int i = 0; i < _data.Length; i++) { 50 | array = array + _data[i]; 51 | if (_data.Length - i <= 1) 52 | array += ","; 53 | } 54 | array += "]"; 55 | 56 | return "{\"layout\" : " + _layout.ToYAMLString() + ", \"data\" : " + array + "}"; 57 | } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/QuadCopterBase.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2744f193c59d43e68bb3c1d46e6b4ab 3 | timeCreated: 1429403825 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 400000: //RootNode 10 | 2300000: //RootNode 11 | 3300000: //RootNode 12 | 4300000: Center_plate_top_repaired 13 | 9500000: //RootNode 14 | materials: 15 | importMaterials: 1 16 | materialName: 0 17 | materialSearch: 1 18 | animations: 19 | legacyGenerateAnimations: 4 20 | bakeSimulation: 0 21 | optimizeGameObjects: 0 22 | motionNodeName: 23 | animationCompression: 1 24 | animationRotationError: .5 25 | animationPositionError: .5 26 | animationScaleError: .5 27 | animationWrapMode: 0 28 | extraExposedTransformPaths: [] 29 | clipAnimations: [] 30 | isReadable: 1 31 | meshes: 32 | lODScreenPercentages: [] 33 | globalScale: 1 34 | meshCompression: 0 35 | addColliders: 0 36 | importBlendShapes: 1 37 | swapUVChannels: 0 38 | generateSecondaryUV: 0 39 | useFileUnits: 1 40 | optimizeMeshForGPU: 1 41 | keepQuads: 0 42 | weldVertices: 1 43 | secondaryUVAngleDistortion: 8 44 | secondaryUVAreaDistortion: 15.000001 45 | secondaryUVHardAngle: 88 46 | secondaryUVPackMargin: 4 47 | useFileScale: 1 48 | tangentSpace: 49 | normalSmoothAngle: 60 50 | splitTangentsAcrossUV: 1 51 | normalImportMode: 1 52 | tangentImportMode: 1 53 | importAnimation: 0 54 | copyAvatar: 0 55 | humanDescription: 56 | human: [] 57 | skeleton: [] 58 | armTwist: .5 59 | foreArmTwist: .5 60 | upperLegTwist: .5 61 | legTwist: .5 62 | armStretch: .0500000007 63 | legStretch: .0500000007 64 | feetSpacing: 0 65 | rootMotionBoneName: 66 | lastHumanDescriptionAvatarSource: {instanceID: 0} 67 | animationType: 2 68 | additionalBone: 0 69 | userData: 70 | assetBundleName: 71 | assetBundleVariant: 72 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/QuadArm2.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec1b507d9a6b748a9abdafc4d3892f47 3 | timeCreated: 1429406141 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: Arm_3_0 9 | 100002: //RootNode 10 | 400000: Arm_3_0 11 | 400002: //RootNode 12 | 2300000: Arm_3_0 13 | 3300000: Arm_3_0 14 | 4300000: Arm_3_0 15 | 9500000: //RootNode 16 | materials: 17 | importMaterials: 1 18 | materialName: 0 19 | materialSearch: 1 20 | animations: 21 | legacyGenerateAnimations: 4 22 | bakeSimulation: 0 23 | optimizeGameObjects: 0 24 | motionNodeName: 25 | animationCompression: 1 26 | animationRotationError: .5 27 | animationPositionError: .5 28 | animationScaleError: .5 29 | animationWrapMode: 0 30 | extraExposedTransformPaths: [] 31 | clipAnimations: [] 32 | isReadable: 1 33 | meshes: 34 | lODScreenPercentages: [] 35 | globalScale: 1 36 | meshCompression: 0 37 | addColliders: 0 38 | importBlendShapes: 1 39 | swapUVChannels: 0 40 | generateSecondaryUV: 0 41 | useFileUnits: 1 42 | optimizeMeshForGPU: 1 43 | keepQuads: 0 44 | weldVertices: 1 45 | secondaryUVAngleDistortion: 8 46 | secondaryUVAreaDistortion: 15.000001 47 | secondaryUVHardAngle: 88 48 | secondaryUVPackMargin: 4 49 | useFileScale: 1 50 | tangentSpace: 51 | normalSmoothAngle: 60 52 | splitTangentsAcrossUV: 1 53 | normalImportMode: 0 54 | tangentImportMode: 1 55 | importAnimation: 1 56 | copyAvatar: 0 57 | humanDescription: 58 | human: [] 59 | skeleton: [] 60 | armTwist: .5 61 | foreArmTwist: .5 62 | upperLegTwist: .5 63 | legTwist: .5 64 | armStretch: .0500000007 65 | legStretch: .0500000007 66 | feetSpacing: 0 67 | rootMotionBoneName: 68 | lastHumanDescriptionAvatarSource: {instanceID: 0} 69 | animationType: 2 70 | additionalBone: 0 71 | userData: 72 | assetBundleName: 73 | assetBundleVariant: 74 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/MultiArrayLayoutMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class MultiArrayLayoutMsg : ROSBridgeMsg { 8 | private MultiArrayDimensionMsg[] _dim; 9 | private uint _data_offset; 10 | 11 | public MultiArrayLayoutMsg(JSONNode msg) { 12 | _data_offset = uint.Parse(msg["data_offset"]); 13 | _dim = new MultiArrayDimensionMsg[msg["dim"].Count]; 14 | for (int i = 0; i < _dim.Length; i++) { 15 | _dim[i] = new MultiArrayDimensionMsg(msg["dim"][i]); 16 | } 17 | } 18 | 19 | public MultiArrayLayoutMsg(MultiArrayDimensionMsg[] dim, uint data_offset) { 20 | _dim = dim; 21 | _data_offset = data_offset; 22 | } 23 | 24 | public static string GetMessageType() { 25 | return "std_msgs/MultiArrayLayout"; 26 | } 27 | 28 | public MultiArrayDimensionMsg[] GetDim() { 29 | return _dim; 30 | } 31 | 32 | public uint GetData_Offset() { 33 | return _data_offset; 34 | } 35 | 36 | public override string ToString() { 37 | string array = "["; 38 | for (int i = 0; i < _dim.Length; i++) { 39 | array = array + _dim[i].ToString(); 40 | if (_dim.Length - i <= 1) 41 | array += ","; 42 | } 43 | array += "]"; 44 | return "MultiArrayLayout [dim=" + array + ", data_offset=" + _data_offset + "]"; 45 | } 46 | 47 | public override string ToYAMLString() { 48 | string array = "["; 49 | for (int i = 0; i < _dim.Length; i++) { 50 | array = array + _dim[i].ToYAMLString(); 51 | if (_dim.Length - i <= 1) 52 | array += ","; 53 | } 54 | array += "]"; 55 | return "{\"dim\" : " + array + ",\"data_offset\" :" + _data_offset + "}"; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/QuadArm.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c338a268e7fd4d489d69e86bf650868 3 | timeCreated: 1429403825 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: Boole_1 9 | 100002: Null 10 | 100004: //RootNode 11 | 400000: Boole_1 12 | 400002: Null 13 | 400004: //RootNode 14 | 2300000: Boole_1 15 | 3300000: Boole_1 16 | 4300000: Boole_1 17 | 9500000: //RootNode 18 | materials: 19 | importMaterials: 1 20 | materialName: 0 21 | materialSearch: 1 22 | animations: 23 | legacyGenerateAnimations: 4 24 | bakeSimulation: 0 25 | optimizeGameObjects: 0 26 | motionNodeName: 27 | animationCompression: 1 28 | animationRotationError: .5 29 | animationPositionError: .5 30 | animationScaleError: .5 31 | animationWrapMode: 0 32 | extraExposedTransformPaths: [] 33 | clipAnimations: [] 34 | isReadable: 1 35 | meshes: 36 | lODScreenPercentages: [] 37 | globalScale: 1 38 | meshCompression: 0 39 | addColliders: 0 40 | importBlendShapes: 1 41 | swapUVChannels: 0 42 | generateSecondaryUV: 0 43 | useFileUnits: 1 44 | optimizeMeshForGPU: 1 45 | keepQuads: 0 46 | weldVertices: 1 47 | secondaryUVAngleDistortion: 8 48 | secondaryUVAreaDistortion: 15.000001 49 | secondaryUVHardAngle: 88 50 | secondaryUVPackMargin: 4 51 | useFileScale: 1 52 | tangentSpace: 53 | normalSmoothAngle: 60 54 | splitTangentsAcrossUV: 1 55 | normalImportMode: 1 56 | tangentImportMode: 1 57 | importAnimation: 0 58 | copyAvatar: 0 59 | humanDescription: 60 | human: [] 61 | skeleton: [] 62 | armTwist: .5 63 | foreArmTwist: .5 64 | upperLegTwist: .5 65 | legTwist: .5 66 | armStretch: .0500000007 67 | legStretch: .0500000007 68 | feetSpacing: 0 69 | rootMotionBoneName: 70 | lastHumanDescriptionAvatarSource: {instanceID: 0} 71 | animationType: 2 72 | additionalBone: 0 73 | userData: 74 | assetBundleName: 75 | assetBundleVariant: 76 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/Propellor.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28e0ee9e038db4d45a331b7dee367c89 3 | timeCreated: 1429155956 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: Cinema4D_Editor 9 | 100002: Loft_NURBS_2_Cylinder 10 | 100004: //RootNode 11 | 400000: Cinema4D_Editor 12 | 400002: Loft_NURBS_2_Cylinder 13 | 400004: //RootNode 14 | 2300000: Loft_NURBS_2_Cylinder 15 | 3300000: Loft_NURBS_2_Cylinder 16 | 4300000: Loft_NURBS_2_Cylinder 17 | 9500000: //RootNode 18 | materials: 19 | importMaterials: 1 20 | materialName: 0 21 | materialSearch: 1 22 | animations: 23 | legacyGenerateAnimations: 4 24 | bakeSimulation: 0 25 | optimizeGameObjects: 0 26 | motionNodeName: 27 | animationCompression: 1 28 | animationRotationError: .5 29 | animationPositionError: .5 30 | animationScaleError: .5 31 | animationWrapMode: 0 32 | extraExposedTransformPaths: [] 33 | clipAnimations: [] 34 | isReadable: 1 35 | meshes: 36 | lODScreenPercentages: [] 37 | globalScale: 1 38 | meshCompression: 0 39 | addColliders: 0 40 | importBlendShapes: 1 41 | swapUVChannels: 0 42 | generateSecondaryUV: 0 43 | useFileUnits: 1 44 | optimizeMeshForGPU: 1 45 | keepQuads: 0 46 | weldVertices: 1 47 | secondaryUVAngleDistortion: 8 48 | secondaryUVAreaDistortion: 15.000001 49 | secondaryUVHardAngle: 88 50 | secondaryUVPackMargin: 4 51 | useFileScale: 1 52 | tangentSpace: 53 | normalSmoothAngle: 60 54 | splitTangentsAcrossUV: 1 55 | normalImportMode: 0 56 | tangentImportMode: 1 57 | importAnimation: 1 58 | copyAvatar: 0 59 | humanDescription: 60 | human: [] 61 | skeleton: [] 62 | armTwist: .5 63 | foreArmTwist: .5 64 | upperLegTwist: .5 65 | legTwist: .5 66 | armStretch: .0500000007 67 | legStretch: .0500000007 68 | feetSpacing: 0 69 | rootMotionBoneName: 70 | lastHumanDescriptionAvatarSource: {instanceID: 0} 71 | animationType: 2 72 | additionalBone: 0 73 | userData: 74 | assetBundleName: 75 | assetBundleVariant: 76 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int32MultiArrayMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class Int32MultiArrayMsg : ROSBridgeMsg { 8 | private MultiArrayLayoutMsg _layout; 9 | private int[] _data; 10 | 11 | public Int32MultiArrayMsg(JSONNode msg) { 12 | _layout = new MultiArrayLayoutMsg(msg["layout"]); 13 | _data = new int[msg["data"].Count]; 14 | for (int i = 0; i < _data.Length; i++) { 15 | _data[i] = int.Parse(msg["data"][i]); 16 | } 17 | } 18 | 19 | public Int32MultiArrayMsg(MultiArrayLayoutMsg layout, int[] data) { 20 | _layout = layout; 21 | _data = data; 22 | } 23 | 24 | public static string getMessageType() { 25 | return "std_msgs/Int32MultiArray"; 26 | } 27 | 28 | public int[] GetData() { 29 | return _data; 30 | } 31 | 32 | public MultiArrayLayoutMsg GetLayout() { 33 | return _layout; 34 | } 35 | 36 | public override string ToString() { 37 | string array = "["; 38 | for (int i = 0; i < _data.Length; i++) { 39 | array = array + _data[i]; 40 | if (_data.Length - i <= 1) 41 | array += ","; 42 | } 43 | array += "]"; 44 | return "Int32MultiArray [layout=" + _layout.ToString() + ", data=" + _data + "]"; 45 | } 46 | 47 | public override string ToYAMLString() { 48 | string array = "["; 49 | for (int i = 0; i < _data.Length; i++) { 50 | array = array + _data[i]; 51 | if (_data.Length - i <= 1) 52 | array += ","; 53 | } 54 | array += "]"; 55 | return "{\"layout\" : " + _layout.ToYAMLString() + ", \"data\" : " + array + "}"; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int64MultiArrayMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class Int64MultiArrayMsg : ROSBridgeMsg { 8 | private MultiArrayLayoutMsg _layout; 9 | private long[] _data; 10 | 11 | public Int64MultiArrayMsg(JSONNode msg) { 12 | _layout = new MultiArrayLayoutMsg(msg["layout"]); 13 | _data = new long[msg["data"].Count]; 14 | for (int i = 0; i < _data.Length; i++) { 15 | _data[i] = long.Parse(msg["data"][i]); 16 | } 17 | } 18 | 19 | public void UInt64MultiArrayMsg(MultiArrayLayoutMsg layout, long[] data) { 20 | _layout = layout; 21 | _data = data; 22 | } 23 | 24 | public static string GetMessageType() { 25 | return "std_msgs/Int64MultiArray"; 26 | } 27 | 28 | public long[] GetData() { 29 | return _data; 30 | } 31 | 32 | public MultiArrayLayoutMsg GetLayout() { 33 | return _layout; 34 | } 35 | 36 | public override string ToString() { 37 | string array = "["; 38 | for (int i = 0; i < _data.Length; i++) { 39 | array = array + _data[i]; 40 | if (_data.Length - i <= 1) 41 | array += ","; 42 | } 43 | array += "]"; 44 | return "Int64MultiArray [layout=" + _layout.ToString() + ", data=" + _data + "]"; 45 | } 46 | 47 | public override string ToYAMLString() { 48 | string array = "["; 49 | for (int i = 0; i < _data.Length; i++) { 50 | array = array + _data[i]; 51 | if (_data.Length - i <= 1) 52 | array += ","; 53 | } 54 | array += "]"; 55 | return "{\"layout\" : " + _layout.ToYAMLString() + ", \"data\" : " + array + "}"; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/Int8MultiArrayMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class Int8MultiArrayMsg : ROSBridgeMsg { 8 | private MultiArrayLayoutMsg _layout; 9 | private sbyte[] _data; 10 | 11 | public Int8MultiArrayMsg(JSONNode msg) { 12 | _layout = new MultiArrayLayoutMsg(msg["layout"]); 13 | _data = new sbyte[msg["data"].Count]; 14 | for (int i = 0; i < _data.Length; i++) { 15 | _data[i] = sbyte.Parse(msg["data"][i]); 16 | } 17 | } 18 | 19 | public Int8MultiArrayMsg(MultiArrayLayoutMsg layout, sbyte[] data) { 20 | _layout = layout; 21 | _data = data; 22 | } 23 | 24 | public static string GetMessageType() { 25 | return "std_msgs/Int8MultiArray"; 26 | } 27 | 28 | public sbyte[] GetData() { 29 | return _data; 30 | } 31 | 32 | public MultiArrayLayoutMsg GetLayout() { 33 | return _layout; 34 | } 35 | 36 | public override string ToString() { 37 | string array = "["; 38 | for (int i = 0; i < _data.Length; i++) { 39 | array = array + _data[i]; 40 | if (_data.Length - i <= 1) 41 | array += ","; 42 | } 43 | array += "]"; 44 | return "Int8MultiArray [layout=" + _layout.ToString() + ", data=" + _data + "]"; 45 | } 46 | 47 | public override string ToYAMLString() { 48 | string array = "["; 49 | for (int i = 0; i < _data.Length; i++) { 50 | array = array + _data[i]; 51 | if (_data.Length - i <= 1) 52 | array += ","; 53 | } 54 | array += "]"; 55 | return "{\"layout\" : " + _layout.ToYAMLString() + ", \"data\" : " + array + "}"; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt8MultiArrayMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class UInt8MultiArrayMsg : ROSBridgeMsg { 8 | private MultiArrayLayoutMsg _layout; 9 | private byte[] _data; 10 | 11 | public UInt8MultiArrayMsg(JSONNode msg) { 12 | _layout = new MultiArrayLayoutMsg(msg["layout"]); 13 | _data = new byte[msg["data"].Count]; 14 | for (int i = 0; i < _data.Length; i++) { 15 | _data[i] = byte.Parse(msg["data"][i]); 16 | } 17 | } 18 | 19 | public UInt8MultiArrayMsg(MultiArrayLayoutMsg layout, byte[] data) { 20 | _layout = layout; 21 | _data = data; 22 | } 23 | 24 | public static string GetMessageType() { 25 | return "std_msgs/UInt8MultiArray"; 26 | } 27 | 28 | public byte[] GetData() { 29 | return _data; 30 | } 31 | 32 | public MultiArrayLayoutMsg GetLayout() { 33 | return _layout; 34 | } 35 | 36 | public override string ToString() { 37 | string array = "["; 38 | for (int i = 0; i < _data.Length; i++) { 39 | array = array + _data[i]; 40 | if (_data.Length - i <= 1) 41 | array += ","; 42 | } 43 | array += "]"; 44 | return "UInt8MultiArray [layout=" + _layout.ToString() + ", data=" + _data + "]"; 45 | } 46 | 47 | public override string ToYAMLString() { 48 | string array = "["; 49 | for (int i = 0; i < _data.Length; i++) { 50 | array = array + _data[i]; 51 | if (_data.Length - i <= 1) 52 | array += ","; 53 | } 54 | array += "]"; 55 | return "{\"layout\" : " + _layout.ToYAMLString() + ", \"data\" : " + array + "}"; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt32MultiArrayMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class UInt32MultiArrayMsg : ROSBridgeMsg { 8 | private MultiArrayLayoutMsg _layout; 9 | private uint[] _data; 10 | 11 | public UInt32MultiArrayMsg(JSONNode msg) { 12 | _layout = new MultiArrayLayoutMsg(msg["layout"]); 13 | _data = new uint[msg["data"].Count]; 14 | for (int i = 0; i < _data.Length; i++) { 15 | _data[i] = uint.Parse(msg["data"][i]); 16 | } 17 | } 18 | 19 | public void Int32MultiArrayMsg(MultiArrayLayoutMsg layout, uint[] data) { 20 | _layout = layout; 21 | _data = data; 22 | } 23 | 24 | public static string GetMessageType() { 25 | return "std_msgs/UInt32MultiArray"; 26 | } 27 | 28 | public uint[] GetData() { 29 | return _data; 30 | } 31 | 32 | public MultiArrayLayoutMsg GetLayout() { 33 | return _layout; 34 | } 35 | 36 | public override string ToString() { 37 | string array = "["; 38 | for (int i = 0; i < _data.Length; i++) { 39 | array = array + _data[i]; 40 | if (_data.Length - i <= 1) 41 | array += ","; 42 | } 43 | array += "]"; 44 | return "UInt32MultiArray [layout=" + _layout.ToString() + ", data=" + _data + "]"; 45 | } 46 | 47 | public override string ToYAMLString() { 48 | string array = "["; 49 | for (int i = 0; i < _data.Length; i++) { 50 | array = array + _data[i]; 51 | if (_data.Length - i <= 1) 52 | array += ","; 53 | } 54 | array += "]"; 55 | return "{\"layout\" : " + _layout.ToYAMLString() + ", \"data\" : " + array + "}"; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/std_msgs/UInt16MultiArrayMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | namespace ROSBridgeLib { 6 | namespace std_msgs { 7 | public class UInt16MultiArrayMsg : ROSBridgeMsg { 8 | private MultiArrayLayoutMsg _layout; 9 | private ushort[] _data; 10 | 11 | public UInt16MultiArrayMsg(JSONNode msg) { 12 | _layout = new MultiArrayLayoutMsg(msg["layout"]); 13 | _data = new ushort[msg["data"].Count]; 14 | for (int i = 0; i < _data.Length; i++) { 15 | _data[i] = ushort.Parse(msg["data"][i]); 16 | } 17 | } 18 | 19 | public UInt16MultiArrayMsg(MultiArrayLayoutMsg layout, ushort[] data) { 20 | _layout = layout; 21 | _data = data; 22 | } 23 | 24 | public static string GetMessageType() { 25 | return "std_msgs/UInt16MultiArray"; 26 | } 27 | 28 | public ushort[] GetData() { 29 | return _data; 30 | } 31 | 32 | public MultiArrayLayoutMsg GetLayout() { 33 | return _layout; 34 | } 35 | 36 | public override string ToString() { 37 | string array = "["; 38 | for (int i = 0; i < _data.Length; i++) { 39 | array = array + _data[i]; 40 | if (_data.Length - i <= 1) 41 | array += ","; 42 | } 43 | array += "]"; 44 | return "UInt16MultiArray [layout=" + _layout.ToString() + ", data=" + _data + "]"; 45 | } 46 | 47 | public override string ToYAMLString() { 48 | string array = "["; 49 | for (int i = 0; i < _data.Length; i++) { 50 | array = array + _data[i]; 51 | if (_data.Length - i <= 1) 52 | array += ","; 53 | } 54 | array += "]"; 55 | return "{\"layout\" : " + _layout.ToYAMLString() + ", \"data\" : " + array + "}"; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/turtlesim/PoseMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | /** 6 | * Define a turtle pose message. This has been hand-crafted from the corresponding 7 | * turtle message file. 8 | * 9 | * Version History 10 | * 3.1 - changed methods to start with an upper case letter to be more consistent with c# 11 | * style. 12 | * 3.0 - modification from hand crafted version 2.0 13 | * 14 | */ 15 | 16 | namespace ROSBridgeLib { 17 | namespace turtlesim { 18 | public class PoseMsg : ROSBridgeMsg { 19 | private float _x, _y, _theta, _linear_velocity, _angular_velocity; 20 | 21 | public PoseMsg(JSONNode msg) { 22 | _x = float.Parse(msg["x"]); 23 | _y = float.Parse (msg["y"]); 24 | _theta = float.Parse (msg["theta"]); 25 | _linear_velocity = float.Parse(msg["linear_velocity"]); 26 | _angular_velocity = float.Parse (msg["angular_velocity"]); 27 | } 28 | 29 | public PoseMsg(float x, float y, float theta, float linear_velocity, float angular_velocity) { 30 | _x = x; 31 | _y = y; 32 | _theta = theta; 33 | _linear_velocity = linear_velocity; 34 | _angular_velocity = angular_velocity; 35 | } 36 | 37 | public static string getMessageType() { 38 | return "turtlesim/Pose"; 39 | } 40 | 41 | public float GetX() { 42 | return _x; 43 | } 44 | 45 | public float GetY() { 46 | return _y; 47 | } 48 | 49 | public float GetTheta() { 50 | return _theta; 51 | } 52 | 53 | public float GetLinear_Velocity() { 54 | return _linear_velocity; 55 | } 56 | 57 | public float GetAngular_Velocity() { 58 | return _angular_velocity; 59 | } 60 | 61 | public override string ToString() { 62 | return "turtlesim/Pose [x=" + _x + ", y=" + _y + ", theta=" + _theta + 63 | ", linear_velocity=" + _linear_velocity + ", angular_velocity=" + _angular_velocity + "]"; 64 | } 65 | 66 | 67 | 68 | public override string ToYAMLString() { 69 | return "{\"x\": " + _x + ", \"y\": " + _y + ", \"theta\": " + _theta + 70 | ", \"linear_velocity\": " + _linear_velocity + ", \"angular_velocity\": " + _angular_velocity +"}"; 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/trap.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2ed17d0ba8a948c6998e587007c85e2 3 | timeCreated: 1460338129 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: Cinema4D_Editor 9 | 100002: Null_1 10 | 100004: //RootNode 11 | 400000: Cinema4D_Editor 12 | 400002: Null_1 13 | 400004: //RootNode 14 | 2300000: Null_1 15 | 3300000: Null_1 16 | 4300000: Null_1 17 | 9500000: //RootNode 18 | materials: 19 | importMaterials: 1 20 | materialName: 0 21 | materialSearch: 1 22 | animations: 23 | legacyGenerateAnimations: 4 24 | bakeSimulation: 0 25 | optimizeGameObjects: 0 26 | motionNodeName: 27 | animationImportErrors: 28 | animationImportWarnings: 29 | animationRetargetingWarnings: 30 | animationDoRetargetingWarnings: 0 31 | animationCompression: 1 32 | animationRotationError: .5 33 | animationPositionError: .5 34 | animationScaleError: .5 35 | animationWrapMode: 0 36 | extraExposedTransformPaths: [] 37 | clipAnimations: [] 38 | isReadable: 1 39 | meshes: 40 | lODScreenPercentages: [] 41 | globalScale: 1 42 | meshCompression: 0 43 | addColliders: 0 44 | importBlendShapes: 1 45 | swapUVChannels: 0 46 | generateSecondaryUV: 0 47 | useFileUnits: 1 48 | optimizeMeshForGPU: 1 49 | keepQuads: 0 50 | weldVertices: 1 51 | secondaryUVAngleDistortion: 8 52 | secondaryUVAreaDistortion: 15.000001 53 | secondaryUVHardAngle: 88 54 | secondaryUVPackMargin: 4 55 | useFileScale: 1 56 | tangentSpace: 57 | normalSmoothAngle: 60 58 | splitTangentsAcrossUV: 1 59 | normalImportMode: 0 60 | tangentImportMode: 1 61 | importAnimation: 1 62 | copyAvatar: 0 63 | humanDescription: 64 | human: [] 65 | skeleton: [] 66 | armTwist: .5 67 | foreArmTwist: .5 68 | upperLegTwist: .5 69 | legTwist: .5 70 | armStretch: .0500000007 71 | legStretch: .0500000007 72 | feetSpacing: 0 73 | rootMotionBoneName: 74 | hasTranslationDoF: 0 75 | lastHumanDescriptionAvatarSource: {instanceID: 0} 76 | animationType: 2 77 | humanoidOversampling: 1 78 | additionalBone: 0 79 | userData: 80 | assetBundleName: 81 | assetBundleVariant: 82 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/UAVLegs.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: faabb9780e74a43b98c1b70ff63a2643 3 | timeCreated: 1460474490 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: Cinema4D_Editor 9 | 100002: newleg22 10 | 100004: //RootNode 11 | 400000: Cinema4D_Editor 12 | 400002: newleg22 13 | 400004: //RootNode 14 | 2300000: newleg22 15 | 3300000: newleg22 16 | 4300000: newleg22 17 | 9500000: //RootNode 18 | materials: 19 | importMaterials: 1 20 | materialName: 0 21 | materialSearch: 1 22 | animations: 23 | legacyGenerateAnimations: 4 24 | bakeSimulation: 0 25 | optimizeGameObjects: 0 26 | motionNodeName: 27 | animationImportErrors: 28 | animationImportWarnings: 29 | animationRetargetingWarnings: 30 | animationDoRetargetingWarnings: 0 31 | animationCompression: 1 32 | animationRotationError: .5 33 | animationPositionError: .5 34 | animationScaleError: .5 35 | animationWrapMode: 0 36 | extraExposedTransformPaths: [] 37 | clipAnimations: [] 38 | isReadable: 1 39 | meshes: 40 | lODScreenPercentages: [] 41 | globalScale: 1 42 | meshCompression: 0 43 | addColliders: 0 44 | importBlendShapes: 1 45 | swapUVChannels: 0 46 | generateSecondaryUV: 0 47 | useFileUnits: 1 48 | optimizeMeshForGPU: 1 49 | keepQuads: 0 50 | weldVertices: 1 51 | secondaryUVAngleDistortion: 8 52 | secondaryUVAreaDistortion: 15.000001 53 | secondaryUVHardAngle: 88 54 | secondaryUVPackMargin: 4 55 | useFileScale: 1 56 | tangentSpace: 57 | normalSmoothAngle: 60 58 | splitTangentsAcrossUV: 1 59 | normalImportMode: 0 60 | tangentImportMode: 1 61 | importAnimation: 1 62 | copyAvatar: 0 63 | humanDescription: 64 | human: [] 65 | skeleton: [] 66 | armTwist: .5 67 | foreArmTwist: .5 68 | upperLegTwist: .5 69 | legTwist: .5 70 | armStretch: .0500000007 71 | legStretch: .0500000007 72 | feetSpacing: 0 73 | rootMotionBoneName: 74 | hasTranslationDoF: 0 75 | lastHumanDescriptionAvatarSource: {instanceID: 0} 76 | animationType: 2 77 | humanoidOversampling: 1 78 | additionalBone: 0 79 | userData: 80 | assetBundleName: 81 | assetBundleVariant: 82 | -------------------------------------------------------------------------------- /Assets/Art Resources/3DModels/AcrylicPlate.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84aa523d7b7694bafb9258a53f737981 3 | timeCreated: 1460475747 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: Acrylic_Plate 9 | 100002: //RootNode 10 | 100004: Cinema4D_Editor 11 | 400000: Acrylic_Plate 12 | 400002: //RootNode 13 | 400004: Cinema4D_Editor 14 | 2300000: Acrylic_Plate 15 | 3300000: Acrylic_Plate 16 | 4300000: Acrylic_Plate 17 | 9500000: //RootNode 18 | materials: 19 | importMaterials: 1 20 | materialName: 0 21 | materialSearch: 1 22 | animations: 23 | legacyGenerateAnimations: 4 24 | bakeSimulation: 0 25 | optimizeGameObjects: 0 26 | motionNodeName: 27 | animationImportErrors: 28 | animationImportWarnings: 29 | animationRetargetingWarnings: 30 | animationDoRetargetingWarnings: 0 31 | animationCompression: 1 32 | animationRotationError: .5 33 | animationPositionError: .5 34 | animationScaleError: .5 35 | animationWrapMode: 0 36 | extraExposedTransformPaths: [] 37 | clipAnimations: [] 38 | isReadable: 1 39 | meshes: 40 | lODScreenPercentages: [] 41 | globalScale: 1 42 | meshCompression: 0 43 | addColliders: 0 44 | importBlendShapes: 1 45 | swapUVChannels: 0 46 | generateSecondaryUV: 0 47 | useFileUnits: 1 48 | optimizeMeshForGPU: 1 49 | keepQuads: 0 50 | weldVertices: 1 51 | secondaryUVAngleDistortion: 8 52 | secondaryUVAreaDistortion: 15.000001 53 | secondaryUVHardAngle: 88 54 | secondaryUVPackMargin: 4 55 | useFileScale: 1 56 | tangentSpace: 57 | normalSmoothAngle: 60 58 | splitTangentsAcrossUV: 1 59 | normalImportMode: 0 60 | tangentImportMode: 1 61 | importAnimation: 1 62 | copyAvatar: 0 63 | humanDescription: 64 | human: [] 65 | skeleton: [] 66 | armTwist: .5 67 | foreArmTwist: .5 68 | upperLegTwist: .5 69 | legTwist: .5 70 | armStretch: .0500000007 71 | legStretch: .0500000007 72 | feetSpacing: 0 73 | rootMotionBoneName: 74 | hasTranslationDoF: 0 75 | lastHumanDescriptionAvatarSource: {instanceID: 0} 76 | animationType: 2 77 | humanoidOversampling: 1 78 | additionalBone: 0 79 | userData: 80 | assetBundleName: 81 | assetBundleVariant: 82 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/ROSBridgeMsg.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Text; 3 | using SimpleJSON; 4 | 5 | /** 6 | * This (mostly empty) class is the parent class for all RosBridgeMsg's (the actual message) from 7 | * ROS. As the message can be empty.... 8 | *

9 | * This could be omitted I suppose, but it is retained here as (i) it nicely parallels the 10 | * ROSBRidgePacket class which encapsulates the top of the ROSBridge messages which are not 11 | * empty, and (ii) someday ROS may actually define a minimal message. 12 | * 13 | * Version History 14 | * 3.1 - changed methods to start with an upper case letter to be more consistent with c# 15 | * style. 16 | * 3.0 - modification from hand crafted version 2.0 17 | * 18 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 19 | * @version 3.1 20 | */ 21 | 22 | public class ROSBridgeMsg { 23 | 24 | public ROSBridgeMsg() {} 25 | 26 | 27 | public virtual string ToYAMLString() { 28 | StringBuilder x = new StringBuilder(); 29 | x.Append("{"); 30 | x.Append("}"); 31 | return x.ToString(); 32 | } 33 | 34 | public static string Advertise(string messageTopic, string messageType) { 35 | return "{\"op\": \"advertise\", \"topic\": \"" + messageTopic + "\", \"type\": \"" + messageType + "\"}"; 36 | } 37 | 38 | public static string UnAdvertise(string messageTopic) { 39 | return "{\"op\": \"unadvertise\", \"topic\": \"" + messageTopic + "\"}"; 40 | } 41 | 42 | public static string Publish(string messageTopic, string message) { 43 | return "{\"op\": \"publish\", \"topic\": \"" + messageTopic + "\", \"msg\": " + message + "}"; 44 | } 45 | 46 | public static string Subscribe(string messageTopic) { 47 | return "{\"op\": \"subscribe\", \"topic\": \"" + messageTopic + "\"}"; 48 | } 49 | 50 | public static string Subscribe(string messageTopic, string messageType) { 51 | return "{\"op\": \"subscribe\", \"topic\": \"" + messageTopic + "\", \"type\": \"" + messageType + "\"}"; 52 | } 53 | 54 | public static string UnSubscribe(string messageTopic) { 55 | return "{\"op\": \"unsubscribe\", \"topic\": \"" + messageTopic + "\"}"; 56 | } 57 | 58 | public static string CallService(string service, string args) { 59 | if((args == null)|| args.Equals("")) 60 | return "{\"op\": \"call_service\", \"service\": \"" + service + "\"}"; 61 | else 62 | return "{\"op\": \"call_service\", \"service\": \"" + service + "\", \"args\" : " + args + "}"; 63 | } 64 | 65 | public static string CallService(string service) { 66 | return "{\"op\": \"call_service\", \"service\": \"" + service + "\"}"; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Assets/TurtleSim/TurtlesimViewer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using ROSBridgeLib; 4 | using System.Reflection; 5 | using System; 6 | using ROSBridgeLib.geometry_msgs; 7 | using ROSBridgeLib.turtlesim; 8 | 9 | /** 10 | * This is a toy example of the Unity-ROS interface talking to the TurtleSim 11 | * tutorial (circa Groovy). Note that due to some changes since then this will have 12 | * to be slightly re-written, but as its a test .... 13 | * 14 | * THis does all the ROS work. 15 | * 16 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 17 | * @version 3.0 18 | **/ 19 | 20 | public class TurtlesimViewer : MonoBehaviour { 21 | private ROSBridgeWebSocketConnection ros = null; 22 | private Boolean _useJoysticks; 23 | private Boolean lineOn; 24 | 25 | // the critical thing here is to define our subscribers, publishers and service response handlers 26 | void Start () { 27 | FloorTile.Floor (0, 0, 12, 12); 28 | _useJoysticks = Input.GetJoystickNames ().Length > 0; 29 | ros = new ROSBridgeWebSocketConnection ("ws://192.168.17.128", 9090); 30 | ros.AddSubscriber (typeof(Turtle1ColorSensor)); 31 | ros.AddSubscriber (typeof(Turtle1Pose)); 32 | ros.AddPublisher (typeof(Turtle1Teleop)); 33 | ros.AddServiceResponse (typeof(Turtle1ServiceResponse)); 34 | ros.Connect (); 35 | ros.CallService ("/turtle1/set_pen", "{\"off\": 0}"); 36 | lineOn = true; 37 | } 38 | 39 | // extremely important to disconnect from ROS. OTherwise packets continue to flow 40 | void OnApplicationQuit() { 41 | if(ros!=null) 42 | ros.Disconnect (); 43 | } 44 | 45 | // Update is called once per frame in Unity. The Unity camera follows the robot (which is driven by 46 | // the ROS environment. We also use the joystick or cursor keys to generate teleoperational commands 47 | // that are sent to the ROS world, which drives the robot which ... 48 | void Update () { 49 | float _dx, _dy; 50 | int _button = 0; 51 | 52 | if(_useJoysticks) { 53 | _dx = Input.GetAxis ("Joy0X"); 54 | _dy = Input.GetAxis ("Joy0Y"); 55 | } else { 56 | _dx = Input.GetAxis("Horizontal"); 57 | _dy = Input.GetAxis ("Vertical"); 58 | //Debug.Log ("no joysticks " + _dx + " " + _dy); 59 | } 60 | float linear = _dy * 0.5f; 61 | float angular = -_dx * 0.2f; 62 | 63 | TwistMsg msg = new TwistMsg (new Vector3Msg(linear, 0.0, 0.0), new Vector3Msg(0.0, 0.0, angular)); 64 | 65 | ros.Publish (Turtle1Teleop.GetMessageTopic (), msg); 66 | 67 | if (Input.GetKeyDown (KeyCode.T)) { 68 | if (lineOn) 69 | ros.CallService ("/turtle1/set_pen", "{\"off\": 1}"); 70 | else 71 | ros.CallService ("/turtle1/set_pen", "{\"off\": 0}"); 72 | lineOn = !lineOn; 73 | } 74 | ros.Render (); 75 | 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Assets/ControScripts/QuadComputer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class QuadComputer : MonoBehaviour { 5 | 6 | 7 | public float P = 0.5f; 8 | public float D = 0.5f; 9 | public float I = 0.5f; 10 | 11 | 12 | public Transform Base; 13 | 14 | public GameObject MoveTarget; 15 | 16 | public SpinProppeller Prop1; 17 | public SpinProppeller Prop2; 18 | public SpinProppeller Prop3; 19 | public SpinProppeller Prop4; 20 | 21 | Vector3 WantedPosition; 22 | 23 | public bool isOn; 24 | bool GoTo; 25 | private Rigidbody Br; 26 | 27 | 28 | float WantY = 0; 29 | float LastY = 0; 30 | 31 | void Start() 32 | { 33 | MoveTarget.transform.position = new Vector3(0,-100,0); 34 | Br = Base.GetComponent(); 35 | ToggleRun(); 36 | LastY = transform.eulerAngles.y; 37 | WantY = LastY; 38 | } 39 | 40 | // Use this for initialization 41 | public void ToggleRun() 42 | { 43 | isOn = !isOn; 44 | if(!isOn) 45 | { 46 | GoTo = false; 47 | MoveTarget.transform.position = new Vector3(0,-100,0); 48 | } 49 | } 50 | 51 | 52 | public void SetTarget(Vector3 pos) 53 | { 54 | if(isOn) 55 | { 56 | GoTo = true; 57 | WantedPosition = new Vector3(pos.x, 0, pos.z); 58 | if(MoveTarget != null) 59 | { 60 | MoveTarget.transform.position = pos; 61 | } 62 | } 63 | } 64 | 65 | public float GetHeight() 66 | { 67 | float extra = 0; 68 | Ray r = new Ray(Base.transform.position, Vector3.down); 69 | RaycastHit hit; 70 | if(Physics.Raycast(r, out hit, 50)) 71 | { 72 | extra = hit.distance; 73 | } 74 | return extra; 75 | } 76 | 77 | int i = 1; 78 | 79 | void FixedUpdate () 80 | { 81 | Vector3 Brot = Base.eulerAngles; 82 | float x = Brot.x; 83 | float y = Brot.y; 84 | float z = Brot.z; 85 | if(x > 180) 86 | { 87 | x = -360.0f + x; 88 | } 89 | if(z > 180) 90 | { 91 | z = -360.0f + z; 92 | } 93 | if(y > 180) 94 | { 95 | y = -360.0f + y; 96 | } 97 | Brot = new Vector3(x, y, z); 98 | 99 | Vector3 Bpos = Base.position; 100 | 101 | Vector3 OldRot = Brot; 102 | 103 | //float UpForce = (-1.7f*(Input.GetAxis ("Power"))); //Mathf.Clamp(((5 - GetHeight())/5)-Br.velocity.y/2, 0 , 2 ) + (1*(1+Input.GetAxis ("Power"))); 104 | 105 | 106 | if(isOn) 107 | { 108 | Vector3 av = Base.transform.TransformDirection(Br.angularVelocity); 109 | Vector2 VC = RotationCancel(av); 110 | 111 | if(GoTo) 112 | { 113 | Debug.Log("Moving to position: " + WantedPosition); 114 | SetForce(WantedPosition, Brot); 115 | float dHeight = (4-Br.transform.position.y)/4.0f; 116 | Prop4.SpinProp((dHeight - 0 + GetNorm(-Brot.x, 15) * (1.5f-VC.x))); 117 | Prop2.SpinProp((dHeight - 0 + GetNorm(Brot.x, 15) * (1.5f-VC.x) )); 118 | Prop3.SpinProp((dHeight + 0 + GetNorm(-Brot.z, 15) * (1.5f-VC.y))); 119 | Prop1.SpinProp((dHeight + 0 + GetNorm(Brot.z, 15) * (1.5f-VC.y))); 120 | } 121 | 122 | /* 123 | 124 | Brot = SetDir(-.8f*Input.GetAxis("Vertical"), Input.GetAxis("Strafe")/1.5f, Input.GetAxis("Horizontal"), Brot); 125 | 126 | Vector3 WantRot = SetDir(-.8f*Input.GetAxis("Vertical"), Input.GetAxis("Strafe")/1.5f, Input.GetAxis("Horizontal"), Vector3.zero); 127 | 128 | Vector3 av = Base.transform.TransformDirection(Br.angularVelocity); 129 | Vector2 VC = RotationCancel(av); 130 | float Const = 1f; 131 | 132 | 133 | 134 | float spin = 0; 135 | 136 | float dist = Brot.y - WantY; 137 | if(Mathf.Abs(dist) > 180) 138 | { 139 | dist = WantY - Brot.y; 140 | } 141 | 142 | spin = Mathf.Clamp((dist + (av.y*10))/180, -1.0f, 1); 143 | 144 | DebugGraph.MultiLog("Y Rotation", Color.blue, Brot.y); 145 | DebugGraph.MultiLog("Y Rotation", Color.red, WantY); 146 | 147 | Prop4.SpinProp(Const*(UpForce - spin + GetNorm(-Brot.x, 15) * (1.5f-VC.x))); 148 | Prop2.SpinProp(Const*(UpForce - spin + GetNorm(Brot.x, 15) * (1.5f-VC.x) )); 149 | Prop3.SpinProp(Const*(UpForce + spin + GetNorm(-Brot.z, 15) * (1.5f-VC.y))); 150 | Prop1.SpinProp(Const*(UpForce + spin + GetNorm(Brot.z, 15) * (1.5f-VC.y))); 151 | 152 | /* 153 | DebugGraph.MultiLog("Prop 1", Color.blue, Const*( + GetNorm(Brot.z, 15) * VC.y)); 154 | DebugGraph.MultiLog("Prop 1", Color.red, GetNorm(Brot.z, 15) - Br.angularVelocity.z/3); 155 | 156 | DebugGraph.MultiLog("Prop 2", Color.blue, Const*( + GetNorm(Brot.x, 15) * VC.x )); 157 | DebugGraph.MultiLog("Prop 2", Color.red, GetNorm(Brot.x, 15) - Br.angularVelocity.x/3); 158 | 159 | DebugGraph.MultiLog("Prop 3", Color.blue, Const*( + GetNorm(-Brot.z, 15) * (1.5f-VC.y))); 160 | DebugGraph.MultiLog("Prop 3", Color.red, GetNorm(-Brot.z, 15) + Br.angularVelocity.z/3); 161 | 162 | DebugGraph.MultiLog("Prop 4", Color.blue, Const*( + GetNorm(-Brot.x, 15) * (1.5f-VC.x))); 163 | DebugGraph.MultiLog("Prop 4", Color.red, GetNorm(-Brot.x, 15) + Br.angularVelocity.x/3); 164 | */ 165 | 166 | 167 | /* 168 | DebugGraph.MultiLog("Z Values", Color.red, av.z/4); 169 | DebugGraph.MultiLog("Z Values", Color.blue, VC.y); 170 | */ 171 | 172 | } 173 | /* 174 | else 175 | { 176 | float power = (-1.7f*Input.GetAxis ("Power")); 177 | float FB = Input.GetAxis("Strafe")/2; 178 | float LR = -1*Input.GetAxis("Vertical")/2; 179 | float SR = Input.GetAxis("Horizontal")/2; 180 | 181 | Prop4.SpinProp(power+(FB - LR - SR)); 182 | Prop2.SpinProp(power+(FB + LR + SR)); 183 | Prop3.SpinProp(power+(-FB - LR + SR)); 184 | Prop1.SpinProp(power+(-FB + LR - SR)); 185 | 186 | } 187 | */ 188 | } 189 | 190 | /* Quad Prop Setup 191 | * 192 | * Forward Z+ 193 | * 194 | * 3 4 3 195 | * \ / | 196 | * \ / | 197 | * X 2______X______4 X+ 198 | * X X 199 | * / \ | 200 | * / \ | 201 | * 2 1 1 202 | * 203 | * Back 204 | */ 205 | 206 | public Vector2 RotationCancel(Vector3 v) 207 | { 208 | // Input v is the Quad's rigidbody.angularVelocity 209 | 210 | 211 | float x = 0; 212 | float y = 0; 213 | 214 | float vx = 1/(1+v.x/8); 215 | float vy = 1/(1+v.y/8); 216 | 217 | x = Mathf.Clamp(vx , -1.5f, 1.5f); 218 | y = Mathf.Clamp(vy , -1.5f, 1.5f); 219 | 220 | 221 | return Vector2.zero;//new Vector4(x,y); 222 | } 223 | 224 | public Vector3 SetDir(float fb, float lr, float sr, Vector3 Rot) 225 | { 226 | /* 227 | Prop1.SpinProp( Mathf.Clamp(((1.3f*fb*0)+(-3*lr))/3f, 0, .9f)); 228 | Prop2.SpinProp( Mathf.Clamp(((1.3f*fb*0)+(3*lr))/3f, 0, .9f)); 229 | Prop3.SpinProp( Mathf.Clamp(((-1.3f*fb*0)+(-3*lr))/3f, 0, .9f)); 230 | Prop4.SpinProp( Mathf.Clamp(((-1.3f*fb*0)+(3*lr))/3f, 0, .9f)); 231 | */ 232 | WantY += lr*2f; 233 | if(WantY < -180) 234 | WantY = 180; 235 | else if(WantY > 180) 236 | WantY = -180; 237 | 238 | float AddAmt = 45; 239 | Vector3 NewRot = new Vector3(Rot.x + AddAmt*fb + (AddAmt)*sr, Rot.y, Rot.z + AddAmt*fb - (AddAmt)*sr); 240 | return NewRot; 241 | } 242 | 243 | 244 | 245 | public void SetForce(Vector3 WantPos, Vector3 Cur) 246 | { 247 | Vector3 NoHB = new Vector3(Base.transform.position.z, 0, Base.transform.position.z); 248 | if(Vector3.Distance(WantPos, NoHB) < 2 && Br.velocity.magnitude < 0.7f) 249 | { 250 | return; 251 | } 252 | float MaxForce = .1f * Mathf.Clamp(Vector3.Distance(WantPos, NoHB)/3, 0, 1); 253 | Vector3 Diff = new Vector3(Base.transform.position.x - WantPos.x , 0, Base.transform.position.z-WantPos.z); 254 | Vector3 RelWant = Base.transform.InverseTransformDirection(Diff); 255 | Vector3 RelVel = Base.transform.InverseTransformDirection(Br.velocity); 256 | float P3Force = Mathf.Clamp(RelWant.x/2 + RelVel.x/2, 0, MaxForce); 257 | float P1Force = Mathf.Clamp(-1 * RelWant.x - RelVel.x/2, 0, MaxForce); 258 | float P2Force = Mathf.Clamp(RelWant.z/2 + RelVel.z/2, 0, MaxForce); 259 | float P4Force = Mathf.Clamp(-1 * RelWant.z/2 - RelVel.z/2, 0, MaxForce); 260 | if(Cur.z > -8) 261 | Prop1.SpinProp(P1Force*GetNorm(Cur.z, 8)); 262 | if(Cur.x > -8) 263 | Prop2.SpinProp(P2Force*GetNorm(Cur.x, 8)); 264 | if(Cur.z < 8) 265 | Prop3.SpinProp(P3Force*GetNorm(Cur.z, 8)); 266 | if(Cur.x < 8) 267 | Prop4.SpinProp(P4Force*GetNorm(Cur.x, 8)); 268 | 269 | } 270 | 271 | 272 | float GetNorm(float inpt, float div) 273 | { 274 | return Mathf.Clamp(((inpt)/(div)) , 0, 1); 275 | } 276 | } 277 | -------------------------------------------------------------------------------- /Assets/ROSBridgeLib/ROSBridgeWebSocketConnection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Reflection; 4 | using System; 5 | using WebSocketSharp; 6 | using WebSocketSharp.Net; 7 | using WebSocketSharp.Server; 8 | using SimpleJSON; 9 | using UnityEngine; 10 | 11 | /** 12 | * This class handles the connection with the external ROS world, deserializing 13 | * json messages into appropriate instances of packets and messages. 14 | * 15 | * This class also provides a mechanism for having the callback's exectued on the rendering thread. 16 | * (Remember, Unity has a single rendering thread, so we want to do all of the communications stuff away 17 | * from that. 18 | * 19 | * The one other clever thing that is done here is that we only keep 1 (the most recent!) copy of each message type 20 | * that comes along. 21 | * 22 | * Version History 23 | * 3.1 - changed methods to start with an upper case letter to be more consistent with c# 24 | * style. 25 | * 3.0 - modification from hand crafted version 2.0 26 | * 27 | * @author Michael Jenkin, Robert Codd-Downey and Andrew Speers 28 | * @version 3.1 29 | */ 30 | 31 | namespace ROSBridgeLib { 32 | public class ROSBridgeWebSocketConnection { 33 | private class RenderTask { 34 | private Type _subscriber; 35 | private string _topic; 36 | private ROSBridgeMsg _msg; 37 | 38 | public RenderTask(Type subscriber, string topic, ROSBridgeMsg msg) { 39 | _subscriber = subscriber; 40 | _topic = topic; 41 | _msg = msg; 42 | } 43 | 44 | public Type getSubscriber() { 45 | return _subscriber; 46 | } 47 | 48 | public ROSBridgeMsg getMsg() { 49 | return _msg; 50 | } 51 | 52 | public string getTopic() { 53 | return _topic; 54 | } 55 | }; 56 | private string _host; 57 | private int _port; 58 | private WebSocket _ws; 59 | private System.Threading.Thread _myThread; 60 | private List _subscribers; // our subscribers 61 | private List _publishers; //our publishers 62 | private Type _serviceResponse; // to deal with service responses 63 | private string _serviceName = null; 64 | private string _serviceValues = null; 65 | private List _taskQ = new List(); 66 | 67 | private object _queueLock = new object (); 68 | 69 | private static string GetMessageType(Type t) { 70 | return (string) t.GetMethod ("GetMessageType", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).Invoke (null, null); 71 | } 72 | 73 | private static string GetMessageTopic(Type t) { 74 | return (string) t.GetMethod ("GetMessageTopic", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).Invoke (null, null); 75 | } 76 | 77 | private static ROSBridgeMsg ParseMessage(Type t, JSONNode node) { 78 | return (ROSBridgeMsg) t.GetMethod ("ParseMessage", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).Invoke (null, new object[] {node}); 79 | } 80 | 81 | private static void Update(Type t, ROSBridgeMsg msg) { 82 | t.GetMethod ("CallBack", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).Invoke (null, new object[] {msg}); 83 | } 84 | 85 | private static void ServiceResponse(Type t, string service, string yaml) { 86 | t.GetMethod ("ServiceCallBack", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).Invoke (null, new object[] {service, yaml}); 87 | } 88 | 89 | private static void IsValidServiceResponse(Type t) { 90 | if (t.GetMethod ("ServiceCallBack", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) == null) 91 | throw new Exception ("invalid service response handler"); 92 | } 93 | 94 | private static void IsValidSubscriber(Type t) { 95 | if(t.GetMethod ("CallBack", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) == null) 96 | throw new Exception ("missing Callback method"); 97 | if (t.GetMethod ("GetMessageType", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) == null) 98 | throw new Exception ("missing GetMessageType method"); 99 | if(t.GetMethod ("GetMessageTopic", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) == null) 100 | throw new Exception ("missing GetMessageTopic method"); 101 | if(t.GetMethod ("ParseMessage", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) == null) 102 | throw new Exception ("missing ParseMessage method"); 103 | } 104 | 105 | private static void IsValidPublisher(Type t) { 106 | if (t.GetMethod ("GetMessageType", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) == null) 107 | throw new Exception ("missing GetMessageType method"); 108 | if(t.GetMethod ("GetMessageTopic", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) == null) 109 | throw new Exception ("missing GetMessageTopic method"); 110 | } 111 | 112 | /** 113 | * Make a connection to a host/port. 114 | * This does not actually start the connection, use Connect to do that. 115 | */ 116 | public ROSBridgeWebSocketConnection(string host, int port) { 117 | _host = host; 118 | _port = port; 119 | _myThread = null; 120 | _subscribers = new List (); 121 | _publishers = new List (); 122 | } 123 | 124 | /** 125 | * Add a service response callback to this connection. 126 | */ 127 | public void AddServiceResponse(Type serviceResponse) { 128 | IsValidServiceResponse (serviceResponse); 129 | _serviceResponse = serviceResponse; 130 | } 131 | 132 | /** 133 | * Add a subscriber callback to this connection. There can be many subscribers. 134 | */ 135 | public void AddSubscriber(Type subscriber) { 136 | IsValidSubscriber(subscriber); 137 | _subscribers.Add (subscriber); 138 | } 139 | 140 | /** 141 | * Add a publisher to this connection. There can be many publishers. 142 | */ 143 | public void AddPublisher(Type publisher) { 144 | IsValidPublisher(publisher); 145 | _publishers.Add (publisher); 146 | } 147 | 148 | /** 149 | * Connect to the remote ros environment. 150 | */ 151 | public void Connect() { 152 | _myThread = new System.Threading.Thread (Run); 153 | _myThread.Start (); 154 | } 155 | 156 | /** 157 | * Disconnect from the remote ros environment. 158 | */ 159 | public void Disconnect() { 160 | _myThread.Abort (); 161 | foreach(Type p in _subscribers) { 162 | _ws.Send(ROSBridgeMsg.UnSubscribe(GetMessageTopic(p))); 163 | //Debug.Log ("Sending " + ROSBridgePacket.unSubscribe(getMessageTopic(p))); 164 | } 165 | foreach(Type p in _publishers) { 166 | _ws.Send(ROSBridgeMsg.UnAdvertise (GetMessageTopic(p))); 167 | //Debug.Log ("Sending " + ROSBridgePacket.unAdvertise (getMessageTopic(p))); 168 | } 169 | _ws.Close (); 170 | } 171 | 172 | private void Run() { 173 | _ws = new WebSocket(_host + ":" + _port); 174 | _ws.OnMessage += (sender, e) => this.OnMessage(e.Data); 175 | _ws.Connect(); 176 | 177 | foreach(Type p in _subscribers) { 178 | _ws.Send(ROSBridgeMsg.Subscribe (GetMessageTopic(p), GetMessageType (p))); 179 | Debug.Log ("Sending " + ROSBridgeMsg.Subscribe (GetMessageTopic(p), GetMessageType (p))); 180 | } 181 | foreach(Type p in _publishers) { 182 | _ws.Send(ROSBridgeMsg.Advertise (GetMessageTopic(p), GetMessageType(p))); 183 | Debug.Log ("Sending " + ROSBridgeMsg.Advertise (GetMessageTopic(p), GetMessageType(p))); 184 | } 185 | while(true) { 186 | Thread.Sleep (10000); 187 | } 188 | } 189 | 190 | private void OnMessage(string s) { 191 | Debug.Log ("Got a message " + s); 192 | if((s!= null) && !s.Equals ("")) { 193 | JSONNode node = JSONNode.Parse(s); 194 | Debug.Log ("Parsed it"); 195 | string op = node["op"]; 196 | Debug.Log ("Operation is " + op); 197 | if("publish".Equals (op)) { 198 | string topic = node["topic"]; 199 | Debug.Log ("Got a message on " + topic); 200 | foreach(Type p in _subscribers) { 201 | if(topic.Equals (GetMessageTopic (p))) { 202 | Debug.Log ("And will parse it " + GetMessageTopic (p)); 203 | ROSBridgeMsg msg = ParseMessage(p, node["msg"]); 204 | RenderTask newTask = new RenderTask(p, topic, msg); 205 | lock(_queueLock) { 206 | bool found = false; 207 | for(int i=0;i<_taskQ.Count;i++) { 208 | if(_taskQ[i].getTopic().Equals (topic)) { 209 | _taskQ.RemoveAt (i); 210 | _taskQ.Insert (i, newTask); 211 | found = true; 212 | break; 213 | } 214 | } 215 | if(!found) 216 | _taskQ.Add (newTask); 217 | } 218 | 219 | } 220 | } 221 | } else if("service_response".Equals (op)) { 222 | Debug.Log ("Got service response " + node.ToString ()); 223 | _serviceName = node["service"]; 224 | _serviceValues = (node["values"] == null) ? "" : node["values"].ToString (); 225 | } else 226 | Debug.Log ("Must write code here for other messages"); 227 | } else 228 | Debug.Log ("Got an empty message from the web socket"); 229 | } 230 | 231 | public void Render() { 232 | RenderTask newTask = null; 233 | lock (_queueLock) { 234 | if(_taskQ.Count > 0) { 235 | newTask = _taskQ[0]; 236 | _taskQ.RemoveAt (0); 237 | } 238 | } 239 | if(newTask != null) 240 | Update(newTask.getSubscriber (), newTask.getMsg ()); 241 | 242 | if (_serviceName != null) { 243 | ServiceResponse (_serviceResponse, _serviceName, _serviceValues); 244 | _serviceName = null; 245 | } 246 | } 247 | 248 | public void Publish(String topic, ROSBridgeMsg msg) { 249 | if(_ws != null) { 250 | string s = ROSBridgeMsg.Publish (topic, msg.ToYAMLString ()); 251 | //Debug.Log ("Sending " + s); 252 | _ws.Send (s); 253 | } 254 | } 255 | 256 | public void CallService(string service, string args) { 257 | if (_ws != null) { 258 | string s = ROSBridgeMsg.CallService (service, args); 259 | Debug.Log ("Sending " + s); 260 | _ws.Send (s); 261 | } 262 | } 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /Assets/ControScripts/QCVTwo.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | public class QCVTwo : MonoBehaviour { 6 | 7 | public Mode CurrentMode; 8 | 9 | 10 | public float ComputerRigidity = 45f; 11 | public float ControlPower = 45f; 12 | 13 | public PointType ttype; 14 | 15 | public bool HQuad; 16 | 17 | [Range(0f, 20f)] 18 | public float DesiredHieght = 3; 19 | 20 | [Range(0.5f, 5.5f)] 21 | public float ThrottlePower; 22 | [Range(0.5f, 5.5f)] 23 | public float YawPower; 24 | [Range(0.5f, 5.5f)] 25 | public float RollPower; 26 | [Range(0.5f, 5.5f)] 27 | public float PitchPower; 28 | 29 | [Range(1.0f, 3.0f)] 30 | public float ThrottleExponent; 31 | [Range(1.0f, 3.0f)] 32 | public float YawExponent; 33 | [Range(1.0f, 3.0f)] 34 | public float RollExponent; 35 | [Range(1.0f, 3.0f)] 36 | public float PitchExponet; 37 | 38 | public float MaxHeight; 39 | 40 | public float MotorPower; 41 | 42 | public float MaxSpeed; 43 | 44 | [Range(-1.0f, 1.0f)] 45 | public float TrimPitch; 46 | [Range(-1.0f, 1.0f)] 47 | public float TrimRoll; 48 | [Range(-1.0f, 1.0f)] 49 | public float TrimYaw; 50 | [Range(-1.0f, 1.0f)] 51 | public float TrimThrottle; 52 | 53 | 54 | public bool ReachedTarget; 55 | 56 | 57 | public SpinProppeller P1; 58 | public SpinProppeller P2; 59 | public SpinProppeller P3; 60 | public SpinProppeller P4; 61 | 62 | public GameObject QuadCopter; 63 | 64 | Rigidbody Qrb; 65 | Transform Qtr; 66 | 67 | [System.Serializable] 68 | public enum Mode 69 | { 70 | Acrobatic, 71 | Stabalized 72 | } 73 | 74 | public Vector3 WantedPosition; 75 | public GameObject MoveTarget; 76 | 77 | public void SetTarget(Vector3 pos) 78 | { 79 | ReachedTarget = false; 80 | WantedPosition = new Vector3(pos.x, 0, pos.z); 81 | if(MoveTarget != null) 82 | { 83 | MoveTarget.transform.position = pos; 84 | } 85 | } 86 | 87 | public void ToggleStabalize() 88 | { 89 | if(CurrentMode == Mode.Stabalized) 90 | { 91 | CurrentMode = Mode.Acrobatic; 92 | } 93 | else 94 | { 95 | CurrentMode = Mode.Stabalized; 96 | } 97 | } 98 | 99 | void Start () 100 | { 101 | CurrentMode = Mode.Stabalized; 102 | Qrb = QuadCopter.GetComponent(); 103 | Qtr = QuadCopter.transform; 104 | WantedPosition = Qtr.position; 105 | } 106 | 107 | void FixedUpdate () 108 | { 109 | Qrb.velocity *= .96f; 110 | Vector3 CurRot = Qtr.localEulerAngles; 111 | float x = CurRot.x; 112 | float z = CurRot.z; 113 | if(x > 180) 114 | x = -360.0f + x; 115 | if(z > 180) 116 | z = -360.0f + z; 117 | 118 | float FBAngle = (x + z)/2.0f; 119 | float LRAngle = (z-x)/2.0f; 120 | 121 | Vector4 vals = QuadMoveTo(WantedPosition, CurRot); 122 | 123 | //Throttle 124 | float power = vals.x*2.5f;//(1.7f*Mathf.Pow(ThrottlePower*Mathf.Abs(cInput.GetAxis("Power")), ThrottleExponent)*-Mathf.Sign(cInput.GetAxis("Power"))) + TrimThrottle; 125 | 126 | //Roll 127 | float FB = vals.y; //(Mathf.Pow(RollPower*Mathf.Abs(cInput.GetAxis("Strafe")), RollExponent) * Mathf.Sign(cInput.GetAxis("Strafe"))) + TrimRoll - (LRAngle/800f); 128 | 129 | //Pitch 130 | float LR = vals.z; //(Mathf.Pow(PitchPower*Mathf.Abs(cInput.GetAxis("Vertical")), PitchExponet) * -Mathf.Sign(cInput.GetAxis("Vertical"))) + TrimPitch + (FBAngle/800f); 131 | 132 | //Yaw 133 | float SR = vals.w; //( Mathf.Pow(YawPower*Mathf.Abs(cInput.GetAxis("Horizontal")), YawExponent) * Mathf.Sign(cInput.GetAxis("Horizontal")) )+ TrimYaw; 134 | 135 | Vector3 WantRotation = Vector3.zero; 136 | 137 | 138 | Vector3 Qav = Qtr.TransformVector(Qrb.angularVelocity/Mathf.Rad2Deg); 139 | CurRot = new Vector3(x,CurRot.y, z); 140 | float SpinLeft = 0; 141 | float SpinRight = 0; 142 | Vector3 AngDif = Vector3.zero; 143 | 144 | 145 | /* Quad Prop Setup 146 | * 147 | * Forward Z+ 148 | * 149 | * 3 4 3 150 | * \ / | 151 | * \ / | 152 | * X 2______X______4 X+ 153 | * X X 154 | * / \ | 155 | * / \ | 156 | * 2 1 1 157 | * 158 | * Back 159 | */ 160 | 161 | if(CurrentMode == Mode.Acrobatic) 162 | { 163 | 164 | 165 | P1.SpinProp((power+(-SR + LR - FB))*MotorPower); 166 | P2.SpinProp((power+(SR + LR + FB))*MotorPower); 167 | P3.SpinProp((power+(-SR - LR + FB))*MotorPower); 168 | P4.SpinProp((power+(SR - LR - FB))*MotorPower); 169 | } 170 | else if(CurrentMode == Mode.Stabalized) 171 | { 172 | //Max height power 173 | //power = Mathf.Clamp(((MaxHeight - GetHeight())/MaxHeight)-Qrb.velocity.y/6, 0 , 10) * power; 174 | if(HQuad) 175 | { 176 | WantRotation = new Vector3(-ControlPower*FB, CurRot.y - SR, -(ControlPower)*LR); 177 | } 178 | else 179 | { 180 | WantRotation = new Vector3(ControlPower*LR - (ControlPower)*FB, CurRot.y - SR, ControlPower*LR + (ControlPower)*FB); 181 | } 182 | AngDif = new Vector3(CurRot.x - WantRotation.x, Mathf.Clamp(CurRot.y - WantRotation.y, -1.5f, 1.5f), CurRot.z - WantRotation.z); 183 | if(AngDif.y > 0) 184 | SpinRight = AngDif.y; 185 | else 186 | SpinLeft = -1* AngDif.y; 187 | if(HQuad) 188 | { 189 | P1.SpinProp((power + GetNorm(AngDif.z, ComputerRigidity) + GetNorm(-AngDif.x, ComputerRigidity) + SpinLeft - Qav.z*20)*MotorPower); 190 | P2.SpinProp((power + GetNorm(AngDif.z, ComputerRigidity) + GetNorm(AngDif.x, ComputerRigidity) + SpinRight - Qav.x*20)*MotorPower); 191 | P3.SpinProp((power + GetNorm(-AngDif.z, ComputerRigidity) + GetNorm(AngDif.x, ComputerRigidity) + SpinLeft + Qav.z*20)*MotorPower); 192 | P4.SpinProp((power + GetNorm(-AngDif.z, ComputerRigidity) + GetNorm(-AngDif.x, ComputerRigidity) + SpinRight + Qav.x*20)*MotorPower); 193 | 194 | } 195 | else 196 | { 197 | P1.SpinProp((power + GetNorm(AngDif.z, ComputerRigidity) - AngDif.y - Qav.z*20)*MotorPower); 198 | P2.SpinProp((power + GetNorm(AngDif.x, ComputerRigidity) + AngDif.y - Qav.x*20)*MotorPower); 199 | P3.SpinProp((power + GetNorm(-AngDif.z, ComputerRigidity) - AngDif.y + Qav.z*20)*MotorPower); 200 | P4.SpinProp((power + GetNorm(-AngDif.x, ComputerRigidity) + AngDif.y + Qav.x*20)*MotorPower); 201 | } 202 | 203 | } 204 | 205 | } 206 | 207 | public float AH = 0; 208 | public float MH = 0; 209 | public float OS; 210 | Vector4 QuadMoveTo(Vector3 WantPos, Vector3 Cur) 211 | { 212 | //Vertical Distance Prop Calculations 213 | OS = DesiredHieght-Qtr.position.y-(Qrb.velocity.y/2.0f); 214 | AH += Time.deltaTime*OS*0.5f; 215 | 216 | Vector3 NoHB = new Vector3(Qtr.position.x, WantPos.y, Qtr.position.z); 217 | float DH = DesiredHieght; 218 | 219 | float throttle = (OS+AH)/Mathf.Max(0.1f, DesiredHieght); 220 | //Node Type Handling 221 | if(Vector3.Distance(WantPos,NoHB) < 0.2f && Qrb.velocity.magnitude < 0.5f && ttype == PointType.Waypoint) 222 | { 223 | ReachedTarget = true; 224 | MH = 0; 225 | return new Vector4(throttle,0,0,0); 226 | } 227 | else if(ttype == PointType.Pickup) 228 | { 229 | if(DesiredHieght > 0.25f && Qrb.velocity.y > -0.3f) 230 | { 231 | DesiredHieght -= Time.fixedDeltaTime; 232 | } 233 | else if(DesiredHieght <= 0.25f && Qrb.velocity.y > -0.1f && !GetComponentInChildren().hasTrap) 234 | { 235 | DesiredHieght = 0.2f; 236 | } 237 | else if(GetComponentInChildren().hasTrap) 238 | { 239 | DesiredHieght = 5; 240 | ReachedTarget = true; 241 | return new Vector4(throttle,0,0,0); 242 | } 243 | } 244 | else if(Vector3.Distance(WantPos, NoHB) < .25f && Mathf.Abs(Qrb.velocity.y) < 0.8f && !ReachedTarget) 245 | { 246 | if(ttype == PointType.Dropoff) 247 | { 248 | if(DesiredHieght > 0.4f && Qrb.velocity.y > -0.3f) 249 | { 250 | DesiredHieght -= Time.fixedDeltaTime; 251 | return new Vector4(throttle,0,0,0); 252 | } 253 | else if(DesiredHieght <= 0.4f && Qrb.velocity.y > -0.3f && Qtr.position.y <= 0.5f) 254 | { 255 | DesiredHieght = 5; 256 | GetComponentInChildren().Release(); 257 | } 258 | else 259 | { 260 | return new Vector4(throttle,0,0,0); 261 | } 262 | } 263 | else if(ttype == PointType.Takeoff) 264 | { 265 | DesiredHieght = 5; 266 | } 267 | else if(ttype == PointType.Land) 268 | { 269 | if(DesiredHieght > 0.1 && Qrb.velocity.y > -0.3f) 270 | { 271 | DesiredHieght -= Time.fixedDeltaTime; 272 | return new Vector4(throttle,0,0,0); 273 | } 274 | else if(DesiredHieght <= 0.1f) 275 | DesiredHieght = 0; 276 | else 277 | { 278 | return new Vector4(throttle,0,0,0); 279 | } 280 | } 281 | ReachedTarget = true; 282 | return new Vector4(throttle,0,0,0); 283 | } 284 | 285 | if(DesiredHieght == 0) 286 | return Vector4.zero; 287 | 288 | //Horizontal Distance Calculations 289 | List Dists = new List(); 290 | Dists.Add(Vector3.Distance(P1.transform.position, WantPos)); 291 | Dists.Add(Vector3.Distance(P2.transform.position, WantPos)); 292 | Dists.Add(Vector3.Distance(P3.transform.position, WantPos)); 293 | Dists.Add(Vector3.Distance(P4.transform.position, WantPos)); 294 | int low = 0; 295 | float lowDist = Dists[0]; 296 | 297 | Vector2 NV = new Vector2(Qrb.velocity.x, Qrb.velocity.z).normalized; 298 | Vector2 TD = new Vector2(WantPos.x - Qtr.position.x, WantPos.z - Qtr.position.z).normalized; 299 | float dir = Vector2.Dot(NV, TD); 300 | float off = dir*(new Vector2(Qrb.velocity.x, Qrb.velocity.z).magnitude); 301 | off *= 2f; 302 | float dv = Vector2.Distance(new Vector2(Qtr.position.x, Qtr.position.z), new Vector2(WantPos.x, WantPos.z)) - off; 303 | float rDist = Vector2.Distance(Qtr.position, WantPos); 304 | dv = Mathf.Clamp(dv, -1f,1f); 305 | MH += Time.deltaTime; 306 | 307 | if(ReachedTarget || ttype != PointType.Waypoint) 308 | MH = 0; 309 | 310 | for(int i=0; i Childs { get { yield break;} } 85 | public IEnumerable DeepChilds 86 | { 87 | get 88 | { 89 | foreach (var C in Childs) 90 | foreach (var D in C.DeepChilds) 91 | yield return D; 92 | } 93 | } 94 | 95 | public override string ToString() 96 | { 97 | return "JSONNode"; 98 | } 99 | public virtual string ToString(string aPrefix) 100 | { 101 | return "JSONNode"; 102 | } 103 | 104 | #endregion common interface 105 | 106 | #region typecasting properties 107 | public virtual int AsInt 108 | { 109 | get 110 | { 111 | int v = 0; 112 | if (int.TryParse(Value,out v)) 113 | return v; 114 | return 0; 115 | } 116 | set 117 | { 118 | Value = value.ToString(); 119 | } 120 | } 121 | public virtual float AsFloat 122 | { 123 | get 124 | { 125 | float v = 0.0f; 126 | if (float.TryParse(Value,out v)) 127 | return v; 128 | return 0.0f; 129 | } 130 | set 131 | { 132 | Value = value.ToString(); 133 | } 134 | } 135 | public virtual double AsDouble 136 | { 137 | get 138 | { 139 | double v = 0.0; 140 | if (double.TryParse(Value,out v)) 141 | return v; 142 | return 0.0; 143 | } 144 | set 145 | { 146 | Value = value.ToString(); 147 | } 148 | } 149 | public virtual bool AsBool 150 | { 151 | get 152 | { 153 | bool v = false; 154 | if (bool.TryParse(Value,out v)) 155 | return v; 156 | return !string.IsNullOrEmpty(Value); 157 | } 158 | set 159 | { 160 | Value = (value)?"true":"false"; 161 | } 162 | } 163 | public virtual JSONArray AsArray 164 | { 165 | get 166 | { 167 | return this as JSONArray; 168 | } 169 | } 170 | public virtual JSONClass AsObject 171 | { 172 | get 173 | { 174 | return this as JSONClass; 175 | } 176 | } 177 | 178 | 179 | #endregion typecasting properties 180 | 181 | #region operators 182 | public static implicit operator JSONNode(string s) 183 | { 184 | return new JSONData(s); 185 | } 186 | public static implicit operator string(JSONNode d) 187 | { 188 | return (d == null)?null:d.Value; 189 | } 190 | public static bool operator ==(JSONNode a, object b) 191 | { 192 | if (b == null && a is JSONLazyCreator) 193 | return true; 194 | return System.Object.ReferenceEquals(a,b); 195 | } 196 | 197 | public static bool operator !=(JSONNode a, object b) 198 | { 199 | return !(a == b); 200 | } 201 | public override bool Equals (object obj) 202 | { 203 | return System.Object.ReferenceEquals(this, obj); 204 | } 205 | public override int GetHashCode () 206 | { 207 | return base.GetHashCode(); 208 | } 209 | 210 | 211 | #endregion operators 212 | 213 | internal static string Escape(string aText) 214 | { 215 | string result = ""; 216 | foreach(char c in aText) 217 | { 218 | switch(c) 219 | { 220 | case '\\' : result += "\\\\"; break; 221 | case '\"' : result += "\\\""; break; 222 | case '\n' : result += "\\n" ; break; 223 | case '\r' : result += "\\r" ; break; 224 | case '\t' : result += "\\t" ; break; 225 | case '\b' : result += "\\b" ; break; 226 | case '\f' : result += "\\f" ; break; 227 | default : result += c ; break; 228 | } 229 | } 230 | return result; 231 | } 232 | 233 | public static JSONNode Parse(string aJSON) 234 | { 235 | Stack stack = new Stack(); 236 | JSONNode ctx = null; 237 | int i = 0; 238 | // string Token = ""; 239 | StringBuilder Token = new StringBuilder (); 240 | string TokenName = ""; 241 | bool QuoteMode = false; 242 | while (i < aJSON.Length) 243 | { 244 | switch (aJSON[i]) 245 | { 246 | case '{': 247 | if (QuoteMode) 248 | { 249 | Token.Append (aJSON[i]); 250 | break; 251 | } 252 | stack.Push(new JSONClass()); 253 | if (ctx != null) 254 | { 255 | TokenName = TokenName.Trim(); 256 | if (ctx is JSONArray) 257 | ctx.Add(stack.Peek()); 258 | else if (TokenName != "") 259 | ctx.Add(TokenName,stack.Peek()); 260 | } 261 | TokenName = ""; 262 | Token = new StringBuilder(); 263 | ctx = stack.Peek(); 264 | break; 265 | 266 | case '[': 267 | if (QuoteMode) 268 | { 269 | Token.Append (aJSON[i]); 270 | break; 271 | } 272 | 273 | stack.Push(new JSONArray()); 274 | if (ctx != null) 275 | { 276 | TokenName = TokenName.Trim(); 277 | if (ctx is JSONArray) 278 | ctx.Add(stack.Peek()); 279 | else if (TokenName != "") 280 | ctx.Add(TokenName,stack.Peek()); 281 | } 282 | TokenName = ""; 283 | Token = new StringBuilder(); 284 | ctx = stack.Peek(); 285 | break; 286 | 287 | case '}': 288 | case ']': 289 | if (QuoteMode) 290 | { 291 | Token.Append (aJSON[i]); 292 | break; 293 | } 294 | if (stack.Count == 0) 295 | throw new Exception("JSON Parse: Too many closing brackets"); 296 | 297 | stack.Pop(); 298 | if (Token.Length != 0) 299 | { 300 | TokenName = TokenName.Trim(); 301 | if (ctx is JSONArray) 302 | ctx.Add(Token.ToString ()); 303 | else if (TokenName != "") 304 | ctx.Add(TokenName,Token.ToString ()); 305 | } 306 | TokenName = ""; 307 | Token = new StringBuilder(); 308 | if (stack.Count>0) 309 | ctx = stack.Peek(); 310 | break; 311 | 312 | case ':': 313 | if (QuoteMode) 314 | { 315 | Token.Append (aJSON[i]); 316 | break; 317 | } 318 | TokenName = Token.ToString (); 319 | Token = new StringBuilder(); 320 | break; 321 | 322 | case '"': 323 | QuoteMode ^= true; 324 | break; 325 | 326 | case ',': 327 | if (QuoteMode) 328 | { 329 | Token.Append (aJSON[i]); 330 | break; 331 | } 332 | if (Token.Length != 0) 333 | { 334 | if (ctx is JSONArray) 335 | ctx.Add(Token.ToString ()); 336 | else if (TokenName != "") 337 | ctx.Add(TokenName, Token.ToString ()); 338 | } 339 | TokenName = ""; 340 | Token = new StringBuilder(); 341 | break; 342 | 343 | case '\r': 344 | case '\n': 345 | break; 346 | 347 | case ' ': 348 | case '\t': 349 | if (QuoteMode) 350 | Token.Append (aJSON[i]); 351 | break; 352 | 353 | case '\\': 354 | ++i; 355 | if (QuoteMode) 356 | { 357 | char C = aJSON[i]; 358 | switch (C) 359 | { 360 | case 't' : Token.Append ('\t'); break; 361 | case 'r' : Token.Append ('\r'); break; 362 | case 'n' : Token.Append ('\n'); break; 363 | case 'b' : Token.Append ('\b'); break; 364 | case 'f' : Token.Append ('\f'); break; 365 | case 'u': 366 | { 367 | string s = aJSON.Substring(i+1,4); 368 | Token.Append ((char)int.Parse(s, System.Globalization.NumberStyles.AllowHexSpecifier)); 369 | i += 4; 370 | break; 371 | } 372 | default : Token.Append (C); break; 373 | } 374 | } 375 | break; 376 | 377 | default: 378 | Token.Append (aJSON[i]); 379 | break; 380 | } 381 | ++i; 382 | } 383 | if (QuoteMode) 384 | { 385 | throw new Exception("JSON Parse: Quotation marks seems to be messed up."); 386 | } 387 | return ctx; 388 | } 389 | 390 | public virtual void Serialize(System.IO.BinaryWriter aWriter) {} 391 | 392 | public void SaveToStream(System.IO.Stream aData) 393 | { 394 | var W = new System.IO.BinaryWriter(aData); 395 | Serialize(W); 396 | } 397 | 398 | #if USE_SharpZipLib 399 | public void SaveToCompressedStream(System.IO.Stream aData) 400 | { 401 | using (var gzipOut = new ICSharpCode.SharpZipLib.BZip2.BZip2OutputStream(aData)) 402 | { 403 | gzipOut.IsStreamOwner = false; 404 | SaveToStream(gzipOut); 405 | gzipOut.Close(); 406 | } 407 | } 408 | 409 | public void SaveToCompressedFile(string aFileName) 410 | { 411 | #if USE_FileIO 412 | System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); 413 | using(var F = System.IO.File.OpenWrite(aFileName)) 414 | { 415 | SaveToCompressedStream(F); 416 | } 417 | #else 418 | throw new Exception("Can't use File IO stuff in webplayer"); 419 | #endif 420 | } 421 | public string SaveToCompressedBase64() 422 | { 423 | using (var stream = new System.IO.MemoryStream()) 424 | { 425 | SaveToCompressedStream(stream); 426 | stream.Position = 0; 427 | return System.Convert.ToBase64String(stream.ToArray()); 428 | } 429 | } 430 | 431 | #else 432 | public void SaveToCompressedStream(System.IO.Stream aData) 433 | { 434 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 435 | } 436 | public void SaveToCompressedFile(string aFileName) 437 | { 438 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 439 | } 440 | public string SaveToCompressedBase64() 441 | { 442 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 443 | } 444 | #endif 445 | 446 | public void SaveToFile(string aFileName) 447 | { 448 | #if USE_FileIO 449 | System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); 450 | using(var F = System.IO.File.OpenWrite(aFileName)) 451 | { 452 | SaveToStream(F); 453 | } 454 | #else 455 | throw new Exception("Can't use File IO stuff in webplayer"); 456 | #endif 457 | } 458 | public string SaveToBase64() 459 | { 460 | using (var stream = new System.IO.MemoryStream()) 461 | { 462 | SaveToStream(stream); 463 | stream.Position = 0; 464 | return System.Convert.ToBase64String(stream.ToArray()); 465 | } 466 | } 467 | public static JSONNode Deserialize(System.IO.BinaryReader aReader) 468 | { 469 | JSONBinaryTag type = (JSONBinaryTag)aReader.ReadByte(); 470 | switch(type) 471 | { 472 | case JSONBinaryTag.Array: 473 | { 474 | int count = aReader.ReadInt32(); 475 | JSONArray tmp = new JSONArray(); 476 | for(int i = 0; i < count; i++) 477 | tmp.Add(Deserialize(aReader)); 478 | return tmp; 479 | } 480 | case JSONBinaryTag.Class: 481 | { 482 | int count = aReader.ReadInt32(); 483 | JSONClass tmp = new JSONClass(); 484 | for(int i = 0; i < count; i++) 485 | { 486 | string key = aReader.ReadString(); 487 | var val = Deserialize(aReader); 488 | tmp.Add(key, val); 489 | } 490 | return tmp; 491 | } 492 | case JSONBinaryTag.Value: 493 | { 494 | return new JSONData(aReader.ReadString()); 495 | } 496 | case JSONBinaryTag.IntValue: 497 | { 498 | return new JSONData(aReader.ReadInt32()); 499 | } 500 | case JSONBinaryTag.DoubleValue: 501 | { 502 | return new JSONData(aReader.ReadDouble()); 503 | } 504 | case JSONBinaryTag.BoolValue: 505 | { 506 | return new JSONData(aReader.ReadBoolean()); 507 | } 508 | case JSONBinaryTag.FloatValue: 509 | { 510 | return new JSONData(aReader.ReadSingle()); 511 | } 512 | 513 | default: 514 | { 515 | throw new Exception("Error deserializing JSON. Unknown tag: " + type); 516 | } 517 | } 518 | } 519 | 520 | #if USE_SharpZipLib 521 | public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) 522 | { 523 | var zin = new ICSharpCode.SharpZipLib.BZip2.BZip2InputStream(aData); 524 | return LoadFromStream(zin); 525 | } 526 | public static JSONNode LoadFromCompressedFile(string aFileName) 527 | { 528 | #if USE_FileIO 529 | using(var F = System.IO.File.OpenRead(aFileName)) 530 | { 531 | return LoadFromCompressedStream(F); 532 | } 533 | #else 534 | throw new Exception("Can't use File IO stuff in webplayer"); 535 | #endif 536 | } 537 | public static JSONNode LoadFromCompressedBase64(string aBase64) 538 | { 539 | var tmp = System.Convert.FromBase64String(aBase64); 540 | var stream = new System.IO.MemoryStream(tmp); 541 | stream.Position = 0; 542 | return LoadFromCompressedStream(stream); 543 | } 544 | #else 545 | public static JSONNode LoadFromCompressedFile(string aFileName) 546 | { 547 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 548 | } 549 | public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) 550 | { 551 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 552 | } 553 | public static JSONNode LoadFromCompressedBase64(string aBase64) 554 | { 555 | throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); 556 | } 557 | #endif 558 | 559 | public static JSONNode LoadFromStream(System.IO.Stream aData) 560 | { 561 | using(var R = new System.IO.BinaryReader(aData)) 562 | { 563 | return Deserialize(R); 564 | } 565 | } 566 | public static JSONNode LoadFromFile(string aFileName) 567 | { 568 | #if USE_FileIO 569 | using(var F = System.IO.File.OpenRead(aFileName)) 570 | { 571 | return LoadFromStream(F); 572 | } 573 | #else 574 | throw new Exception("Can't use File IO stuff in webplayer"); 575 | #endif 576 | } 577 | public static JSONNode LoadFromBase64(string aBase64) 578 | { 579 | var tmp = System.Convert.FromBase64String(aBase64); 580 | var stream = new System.IO.MemoryStream(tmp); 581 | stream.Position = 0; 582 | return LoadFromStream(stream); 583 | } 584 | } // End of JSONNode 585 | 586 | public class JSONArray : JSONNode, IEnumerable 587 | { 588 | private List m_List = new List(); 589 | public override JSONNode this[int aIndex] 590 | { 591 | get 592 | { 593 | if (aIndex<0 || aIndex >= m_List.Count) 594 | return new JSONLazyCreator(this); 595 | return m_List[aIndex]; 596 | } 597 | set 598 | { 599 | if (aIndex<0 || aIndex >= m_List.Count) 600 | m_List.Add(value); 601 | else 602 | m_List[aIndex] = value; 603 | } 604 | } 605 | public override JSONNode this[string aKey] 606 | { 607 | get{ return new JSONLazyCreator(this);} 608 | set{ m_List.Add(value); } 609 | } 610 | public override int Count 611 | { 612 | get { return m_List.Count; } 613 | } 614 | public override void Add(string aKey, JSONNode aItem) 615 | { 616 | m_List.Add(aItem); 617 | } 618 | public override JSONNode Remove(int aIndex) 619 | { 620 | if (aIndex < 0 || aIndex >= m_List.Count) 621 | return null; 622 | JSONNode tmp = m_List[aIndex]; 623 | m_List.RemoveAt(aIndex); 624 | return tmp; 625 | } 626 | public override JSONNode Remove(JSONNode aNode) 627 | { 628 | m_List.Remove(aNode); 629 | return aNode; 630 | } 631 | public override IEnumerable Childs 632 | { 633 | get 634 | { 635 | foreach(JSONNode N in m_List) 636 | yield return N; 637 | } 638 | } 639 | public IEnumerator GetEnumerator() 640 | { 641 | foreach(JSONNode N in m_List) 642 | yield return N; 643 | } 644 | public override string ToString() 645 | { 646 | string result = "[ "; 647 | foreach (JSONNode N in m_List) 648 | { 649 | if (result.Length > 2) 650 | result += ", "; 651 | result += N.ToString(); 652 | } 653 | result += " ]"; 654 | return result; 655 | } 656 | public override string ToString(string aPrefix) 657 | { 658 | string result = "[ "; 659 | foreach (JSONNode N in m_List) 660 | { 661 | if (result.Length > 3) 662 | result += ", "; 663 | result += "\n" + aPrefix + " "; 664 | result += N.ToString(aPrefix+" "); 665 | } 666 | result += "\n" + aPrefix + "]"; 667 | return result; 668 | } 669 | public override void Serialize (System.IO.BinaryWriter aWriter) 670 | { 671 | aWriter.Write((byte)JSONBinaryTag.Array); 672 | aWriter.Write(m_List.Count); 673 | for(int i = 0; i < m_List.Count; i++) 674 | { 675 | m_List[i].Serialize(aWriter); 676 | } 677 | } 678 | } // End of JSONArray 679 | 680 | public class JSONClass : JSONNode, IEnumerable 681 | { 682 | private Dictionary m_Dict = new Dictionary(); 683 | public override JSONNode this[string aKey] 684 | { 685 | get 686 | { 687 | if (m_Dict.ContainsKey(aKey)) 688 | return m_Dict[aKey]; 689 | else 690 | return new JSONLazyCreator(this, aKey); 691 | } 692 | set 693 | { 694 | if (m_Dict.ContainsKey(aKey)) 695 | m_Dict[aKey] = value; 696 | else 697 | m_Dict.Add(aKey,value); 698 | } 699 | } 700 | public override JSONNode this[int aIndex] 701 | { 702 | get 703 | { 704 | if (aIndex < 0 || aIndex >= m_Dict.Count) 705 | return null; 706 | return m_Dict.ElementAt(aIndex).Value; 707 | } 708 | set 709 | { 710 | if (aIndex < 0 || aIndex >= m_Dict.Count) 711 | return; 712 | string key = m_Dict.ElementAt(aIndex).Key; 713 | m_Dict[key] = value; 714 | } 715 | } 716 | public override int Count 717 | { 718 | get { return m_Dict.Count; } 719 | } 720 | 721 | 722 | public override void Add(string aKey, JSONNode aItem) 723 | { 724 | if (!string.IsNullOrEmpty(aKey)) 725 | { 726 | if (m_Dict.ContainsKey(aKey)) 727 | m_Dict[aKey] = aItem; 728 | else 729 | m_Dict.Add(aKey, aItem); 730 | } 731 | else 732 | m_Dict.Add(Guid.NewGuid().ToString(), aItem); 733 | } 734 | 735 | public override JSONNode Remove(string aKey) 736 | { 737 | if (!m_Dict.ContainsKey(aKey)) 738 | return null; 739 | JSONNode tmp = m_Dict[aKey]; 740 | m_Dict.Remove(aKey); 741 | return tmp; 742 | } 743 | public override JSONNode Remove(int aIndex) 744 | { 745 | if (aIndex < 0 || aIndex >= m_Dict.Count) 746 | return null; 747 | var item = m_Dict.ElementAt(aIndex); 748 | m_Dict.Remove(item.Key); 749 | return item.Value; 750 | } 751 | public override JSONNode Remove(JSONNode aNode) 752 | { 753 | try 754 | { 755 | var item = m_Dict.Where(k => k.Value == aNode).First(); 756 | m_Dict.Remove(item.Key); 757 | return aNode; 758 | } 759 | catch 760 | { 761 | return null; 762 | } 763 | } 764 | 765 | public override IEnumerable Childs 766 | { 767 | get 768 | { 769 | foreach(KeyValuePair N in m_Dict) 770 | yield return N.Value; 771 | } 772 | } 773 | 774 | public IEnumerator GetEnumerator() 775 | { 776 | foreach(KeyValuePair N in m_Dict) 777 | yield return N; 778 | } 779 | public override string ToString() 780 | { 781 | string result = "{"; 782 | foreach (KeyValuePair N in m_Dict) 783 | { 784 | if (result.Length > 2) 785 | result += ", "; 786 | result += "\"" + Escape(N.Key) + "\":" + N.Value.ToString(); 787 | } 788 | result += "}"; 789 | return result; 790 | } 791 | public override string ToString(string aPrefix) 792 | { 793 | string result = "{ "; 794 | foreach (KeyValuePair N in m_Dict) 795 | { 796 | if (result.Length > 3) 797 | result += ", "; 798 | result += "\n" + aPrefix + " "; 799 | result += "\"" + Escape(N.Key) + "\" : " + N.Value.ToString(aPrefix+" "); 800 | } 801 | result += "\n" + aPrefix + "}"; 802 | return result; 803 | } 804 | public override void Serialize (System.IO.BinaryWriter aWriter) 805 | { 806 | aWriter.Write((byte)JSONBinaryTag.Class); 807 | aWriter.Write(m_Dict.Count); 808 | foreach(string K in m_Dict.Keys) 809 | { 810 | aWriter.Write(K); 811 | m_Dict[K].Serialize(aWriter); 812 | } 813 | } 814 | } // End of JSONClass 815 | 816 | public class JSONData : JSONNode 817 | { 818 | private string m_Data; 819 | public override string Value 820 | { 821 | get { return m_Data; } 822 | set { m_Data = value; } 823 | } 824 | public JSONData(string aData) 825 | { 826 | m_Data = aData; 827 | } 828 | public JSONData(float aData) 829 | { 830 | AsFloat = aData; 831 | } 832 | public JSONData(double aData) 833 | { 834 | AsDouble = aData; 835 | } 836 | public JSONData(bool aData) 837 | { 838 | AsBool = aData; 839 | } 840 | public JSONData(int aData) 841 | { 842 | AsInt = aData; 843 | } 844 | 845 | public override string ToString() 846 | { 847 | return "\"" + Escape(m_Data) + "\""; 848 | } 849 | public override string ToString(string aPrefix) 850 | { 851 | return "\"" + Escape(m_Data) + "\""; 852 | } 853 | public override void Serialize (System.IO.BinaryWriter aWriter) 854 | { 855 | var tmp = new JSONData(""); 856 | 857 | tmp.AsInt = AsInt; 858 | if (tmp.m_Data == this.m_Data) 859 | { 860 | aWriter.Write((byte)JSONBinaryTag.IntValue); 861 | aWriter.Write(AsInt); 862 | return; 863 | } 864 | tmp.AsFloat = AsFloat; 865 | if (tmp.m_Data == this.m_Data) 866 | { 867 | aWriter.Write((byte)JSONBinaryTag.FloatValue); 868 | aWriter.Write(AsFloat); 869 | return; 870 | } 871 | tmp.AsDouble = AsDouble; 872 | if (tmp.m_Data == this.m_Data) 873 | { 874 | aWriter.Write((byte)JSONBinaryTag.DoubleValue); 875 | aWriter.Write(AsDouble); 876 | return; 877 | } 878 | 879 | tmp.AsBool = AsBool; 880 | if (tmp.m_Data == this.m_Data) 881 | { 882 | aWriter.Write((byte)JSONBinaryTag.BoolValue); 883 | aWriter.Write(AsBool); 884 | return; 885 | } 886 | aWriter.Write((byte)JSONBinaryTag.Value); 887 | aWriter.Write(m_Data); 888 | } 889 | } // End of JSONData 890 | 891 | internal class JSONLazyCreator : JSONNode 892 | { 893 | private JSONNode m_Node = null; 894 | private string m_Key = null; 895 | 896 | public JSONLazyCreator(JSONNode aNode) 897 | { 898 | m_Node = aNode; 899 | m_Key = null; 900 | } 901 | public JSONLazyCreator(JSONNode aNode, string aKey) 902 | { 903 | m_Node = aNode; 904 | m_Key = aKey; 905 | } 906 | 907 | private void Set(JSONNode aVal) 908 | { 909 | if (m_Key == null) 910 | { 911 | m_Node.Add(aVal); 912 | } 913 | else 914 | { 915 | m_Node.Add(m_Key, aVal); 916 | } 917 | m_Node = null; // Be GC friendly. 918 | } 919 | 920 | public override JSONNode this[int aIndex] 921 | { 922 | get 923 | { 924 | return new JSONLazyCreator(this); 925 | } 926 | set 927 | { 928 | var tmp = new JSONArray(); 929 | tmp.Add(value); 930 | Set(tmp); 931 | } 932 | } 933 | 934 | public override JSONNode this[string aKey] 935 | { 936 | get 937 | { 938 | return new JSONLazyCreator(this, aKey); 939 | } 940 | set 941 | { 942 | var tmp = new JSONClass(); 943 | tmp.Add(aKey, value); 944 | Set(tmp); 945 | } 946 | } 947 | public override void Add (JSONNode aItem) 948 | { 949 | var tmp = new JSONArray(); 950 | tmp.Add(aItem); 951 | Set(tmp); 952 | } 953 | public override void Add (string aKey, JSONNode aItem) 954 | { 955 | var tmp = new JSONClass(); 956 | tmp.Add(aKey, aItem); 957 | Set(tmp); 958 | } 959 | public static bool operator ==(JSONLazyCreator a, object b) 960 | { 961 | if (b == null) 962 | return true; 963 | return System.Object.ReferenceEquals(a,b); 964 | } 965 | 966 | public static bool operator !=(JSONLazyCreator a, object b) 967 | { 968 | return !(a == b); 969 | } 970 | public override bool Equals (object obj) 971 | { 972 | if (obj == null) 973 | return true; 974 | return System.Object.ReferenceEquals(this, obj); 975 | } 976 | public override int GetHashCode () 977 | { 978 | return base.GetHashCode(); 979 | } 980 | 981 | public override string ToString() 982 | { 983 | return ""; 984 | } 985 | public override string ToString(string aPrefix) 986 | { 987 | return ""; 988 | } 989 | 990 | public override int AsInt 991 | { 992 | get 993 | { 994 | JSONData tmp = new JSONData(0); 995 | Set(tmp); 996 | return 0; 997 | } 998 | set 999 | { 1000 | JSONData tmp = new JSONData(value); 1001 | Set(tmp); 1002 | } 1003 | } 1004 | public override float AsFloat 1005 | { 1006 | get 1007 | { 1008 | JSONData tmp = new JSONData(0.0f); 1009 | Set(tmp); 1010 | return 0.0f; 1011 | } 1012 | set 1013 | { 1014 | JSONData tmp = new JSONData(value); 1015 | Set(tmp); 1016 | } 1017 | } 1018 | public override double AsDouble 1019 | { 1020 | get 1021 | { 1022 | JSONData tmp = new JSONData(0.0); 1023 | Set(tmp); 1024 | return 0.0; 1025 | } 1026 | set 1027 | { 1028 | JSONData tmp = new JSONData(value); 1029 | Set(tmp); 1030 | } 1031 | } 1032 | public override bool AsBool 1033 | { 1034 | get 1035 | { 1036 | JSONData tmp = new JSONData(false); 1037 | Set(tmp); 1038 | return false; 1039 | } 1040 | set 1041 | { 1042 | JSONData tmp = new JSONData(value); 1043 | Set(tmp); 1044 | } 1045 | } 1046 | public override JSONArray AsArray 1047 | { 1048 | get 1049 | { 1050 | JSONArray tmp = new JSONArray(); 1051 | Set(tmp); 1052 | return tmp; 1053 | } 1054 | } 1055 | public override JSONClass AsObject 1056 | { 1057 | get 1058 | { 1059 | JSONClass tmp = new JSONClass(); 1060 | Set(tmp); 1061 | return tmp; 1062 | } 1063 | } 1064 | } // End of JSONLazyCreator 1065 | 1066 | public static class JSON 1067 | { 1068 | public static JSONNode Parse(string aJSON) 1069 | { 1070 | return JSONNode.Parse(aJSON); 1071 | } 1072 | } 1073 | } --------------------------------------------------------------------------------