Merged in recording (pull request #2)

Basic recording functionality
This commit is contained in:
Michael Pivato
2020-04-28 13:20:23 +00:00
37 changed files with 1194 additions and 43 deletions

2
.gitignore vendored
View File

@@ -18,3 +18,5 @@
**/dist/* **/dist/*
build build
__pycache__ __pycache__
Pods

1
.idea/gradle.xml generated
View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>

1
.idea/vcs.xml generated
View File

@@ -2,6 +2,5 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/car" vcs="Git" />
</component> </component>
</project> </project>

8
.vscode/launch.json vendored
View File

@@ -5,10 +5,14 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "Python: Module", "name": "Car Module",
"type": "python", "type": "python",
"request": "launch", "request": "launch",
"module": "car" "module": "car",
"env": {
"CAR_LIDAR": "LIDAR_MOCK",
"CAR_VEHICLE": "CAR_MOCK"
}
}, },
{ {
"name": "Python: Current File", "name": "Python: Current File",

View File

@@ -0,0 +1,425 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objects = {
/* Begin PBXBuildFile section */
5A9C27132443F52500DBDF12 /* SimpleControllerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A9C27122443F52500DBDF12 /* SimpleControllerView.swift */; };
5A9C27152443F5B500DBDF12 /* ServerData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A9C27142443F5B500DBDF12 /* ServerData.swift */; };
5A9EB27A240100960053D3CF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A9EB279240100960053D3CF /* AppDelegate.swift */; };
5A9EB27C240100960053D3CF /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A9EB27B240100960053D3CF /* SceneDelegate.swift */; };
5A9EB27E240100960053D3CF /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A9EB27D240100960053D3CF /* ContentView.swift */; };
5A9EB280240100970053D3CF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5A9EB27F240100970053D3CF /* Assets.xcassets */; };
5A9EB283240100970053D3CF /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5A9EB282240100970053D3CF /* Preview Assets.xcassets */; };
5A9EB286240100970053D3CF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5A9EB284240100970053D3CF /* LaunchScreen.storyboard */; };
5BEA7A8C24AF155FC02A6C58 /* Pods_CarController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03FB25F696A1B33332234B4F /* Pods_CarController.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
03FB25F696A1B33332234B4F /* Pods_CarController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CarController.framework; sourceTree = BUILT_PRODUCTS_DIR; };
460C6595E5C32777EF7F2A4E /* Pods-CarController.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CarController.release.xcconfig"; path = "Target Support Files/Pods-CarController/Pods-CarController.release.xcconfig"; sourceTree = "<group>"; };
4C5C85A33DD98E3CA9FCEF6B /* Pods-CarController.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CarController.debug.xcconfig"; path = "Target Support Files/Pods-CarController/Pods-CarController.debug.xcconfig"; sourceTree = "<group>"; };
5A9C27122443F52500DBDF12 /* SimpleControllerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleControllerView.swift; sourceTree = "<group>"; };
5A9C27142443F5B500DBDF12 /* ServerData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerData.swift; sourceTree = "<group>"; };
5A9EB276240100960053D3CF /* CarController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CarController.app; sourceTree = BUILT_PRODUCTS_DIR; };
5A9EB279240100960053D3CF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5A9EB27B240100960053D3CF /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
5A9EB27D240100960053D3CF /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
5A9EB27F240100970053D3CF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5A9EB282240100970053D3CF /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
5A9EB285240100970053D3CF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5A9EB287240100970053D3CF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
5A9EB273240100960053D3CF /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5BEA7A8C24AF155FC02A6C58 /* Pods_CarController.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
49C2CFB75CF1768D7363A9DB /* Frameworks */ = {
isa = PBXGroup;
children = (
03FB25F696A1B33332234B4F /* Pods_CarController.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
5A9EB26D240100950053D3CF = {
isa = PBXGroup;
children = (
5A9EB278240100960053D3CF /* CarController */,
5A9EB277240100960053D3CF /* Products */,
A595BD070E838AFD9A774908 /* Pods */,
49C2CFB75CF1768D7363A9DB /* Frameworks */,
);
sourceTree = "<group>";
};
5A9EB277240100960053D3CF /* Products */ = {
isa = PBXGroup;
children = (
5A9EB276240100960053D3CF /* CarController.app */,
);
name = Products;
sourceTree = "<group>";
};
5A9EB278240100960053D3CF /* CarController */ = {
isa = PBXGroup;
children = (
5A9EB279240100960053D3CF /* AppDelegate.swift */,
5A9EB27B240100960053D3CF /* SceneDelegate.swift */,
5A9EB27D240100960053D3CF /* ContentView.swift */,
5A9EB27F240100970053D3CF /* Assets.xcassets */,
5A9EB284240100970053D3CF /* LaunchScreen.storyboard */,
5A9EB287240100970053D3CF /* Info.plist */,
5A9EB281240100970053D3CF /* Preview Content */,
5A9C27122443F52500DBDF12 /* SimpleControllerView.swift */,
5A9C27142443F5B500DBDF12 /* ServerData.swift */,
);
path = CarController;
sourceTree = "<group>";
};
5A9EB281240100970053D3CF /* Preview Content */ = {
isa = PBXGroup;
children = (
5A9EB282240100970053D3CF /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
A595BD070E838AFD9A774908 /* Pods */ = {
isa = PBXGroup;
children = (
4C5C85A33DD98E3CA9FCEF6B /* Pods-CarController.debug.xcconfig */,
460C6595E5C32777EF7F2A4E /* Pods-CarController.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
5A9EB275240100960053D3CF /* CarController */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5A9EB28A240100970053D3CF /* Build configuration list for PBXNativeTarget "CarController" */;
buildPhases = (
DF3C92ECA29980008D9A0ED0 /* [CP] Check Pods Manifest.lock */,
5A9EB272240100960053D3CF /* Sources */,
5A9EB273240100960053D3CF /* Frameworks */,
5A9EB274240100960053D3CF /* Resources */,
E0B3D65287999242E7AD3ABB /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = CarController;
productName = CarController;
productReference = 5A9EB276240100960053D3CF /* CarController.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
5A9EB26E240100950053D3CF /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1130;
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = "Michael Pivato";
TargetAttributes = {
5A9EB275240100960053D3CF = {
CreatedOnToolsVersion = 11.3.1;
};
};
};
buildConfigurationList = 5A9EB271240100950053D3CF /* Build configuration list for PBXProject "CarController" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 5A9EB26D240100950053D3CF;
productRefGroup = 5A9EB277240100960053D3CF /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
5A9EB275240100960053D3CF /* CarController */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
5A9EB274240100960053D3CF /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5A9EB286240100970053D3CF /* LaunchScreen.storyboard in Resources */,
5A9EB283240100970053D3CF /* Preview Assets.xcassets in Resources */,
5A9EB280240100970053D3CF /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
DF3C92ECA29980008D9A0ED0 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-CarController-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
E0B3D65287999242E7AD3ABB /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-CarController/Pods-CarController-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-CarController/Pods-CarController-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CarController/Pods-CarController-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
5A9EB272240100960053D3CF /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5A9C27152443F5B500DBDF12 /* ServerData.swift in Sources */,
5A9EB27A240100960053D3CF /* AppDelegate.swift in Sources */,
5A9EB27C240100960053D3CF /* SceneDelegate.swift in Sources */,
5A9C27132443F52500DBDF12 /* SimpleControllerView.swift in Sources */,
5A9EB27E240100960053D3CF /* ContentView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
5A9EB284240100970053D3CF /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
5A9EB285240100970053D3CF /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
5A9EB288240100970053D3CF /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
5A9EB289240100970053D3CF /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
5A9EB28B240100970053D3CF /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 4C5C85A33DD98E3CA9FCEF6B /* Pods-CarController.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"CarController/Preview Content\"";
DEVELOPMENT_TEAM = KZ66DBVG63;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = CarController/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.Vato.CarController;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
5A9EB28C240100970053D3CF /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 460C6595E5C32777EF7F2A4E /* Pods-CarController.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"CarController/Preview Content\"";
DEVELOPMENT_TEAM = KZ66DBVG63;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = CarController/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.Vato.CarController;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5A9EB271240100950053D3CF /* Build configuration list for PBXProject "CarController" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5A9EB288240100970053D3CF /* Debug */,
5A9EB289240100970053D3CF /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
5A9EB28A240100970053D3CF /* Build configuration list for PBXNativeTarget "CarController" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5A9EB28B240100970053D3CF /* Debug */,
5A9EB28C240100970053D3CF /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 5A9EB26E240100950053D3CF /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:CarController.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:CarController.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,37 @@
//
// AppDelegate.swift
// CarController
//
// Created by Michael Pivato on 22/2/20.
// Copyright © 2020 Michael Pivato. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}

View File

@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,35 @@
//
// ContentView.swift
// CarController
//
// Created by Michael Pivato on 22/2/20.
// Copyright © 2020 Michael Pivato. All rights reserved.
//
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView{
List{
NavigationLink(destination: SimpleControllerView()){
Text("Simple Controller")
}
// TODO: Change these when other functionality is implemented
NavigationLink(destination: SimpleControllerView()){
Text("SLAM Controller")
}
NavigationLink(destination: SimpleControllerView()){
Text("Tracking Controller")
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,64 @@
//
// SceneDelegate.swift
// CarController
//
// Created by Michael Pivato on 22/2/20.
// Copyright © 2020 Michael Pivato. All rights reserved.
//
import UIKit
import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView.environmentObject(ServerData()))
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}

View File

@@ -0,0 +1,29 @@
//
// ServerData.swift
// CarController
//
// Created by Michael Pivato on 13/4/20.
// Copyright © 2020 Michael Pivato. All rights reserved.
//
import Foundation
final class ServerData: ObservableObject{
// TODO: Find a way to save/represent this stuff in iOS settings (user can access via settings app).
// Then load the below values ar runtime, from settings.
@Published var port: Int = 50051
@Published var grpcPort: Int = 50050
@Published var host: String = "10.0.0.53"
func load(){
// Load the server values from settings, if they had been
// previously saved.
}
func save(){
// Save the current state to be remembered for next time.
}
}

View File

@@ -0,0 +1,28 @@
//
// SimpleControllerView.swift
// CarController
//
// Created by Michael Pivato on 13/4/20.
// Copyright © 2020 Michael Pivato. All rights reserved.
//
import SwiftUI
struct SimpleControllerView: View {
@EnvironmentObject var server: ServerData
@State var throttle: Float = 0
var body: some View {
HStack{
Text("Opened Simple Controller!")
Slider(value: $throttle)
}
}
}
struct SimpleControllerView_Previews: PreviewProvider {
static var previews: some View {
SimpleControllerView()
.environmentObject(ServerData())
}
}

View File

@@ -0,0 +1,12 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'CarController' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for CarController
pod 'SwiftGRPC'
pod 'SwiftyZeroMQ5'
pod 'SwiftProtobuf', '~> 1.0'
end

View File

@@ -13,7 +13,8 @@ import android.view.SurfaceView;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import org.vato.carcontroller.Empty; import com.google.protobuf.Empty;
import org.vato.carcontroller.Int32Value; import org.vato.carcontroller.Int32Value;
import org.vato.carcontroller.PersonTrackingGrpc; import org.vato.carcontroller.PersonTrackingGrpc;
import org.vato.carcontroller.PointScan; import org.vato.carcontroller.PointScan;
@@ -89,7 +90,7 @@ public class LidarView extends SurfaceView implements AbstractUpdater.MapChanged
} }
}; };
// use async grpc method, ZMQ doesn't need to connect straight away. // use async grpc method, ZMQ doesn't need to connect straight away.
stub.startTracking(Int32Value.newBuilder().setValue(Integer.parseInt(port)).build(), response); stub.startTracking(Empty.newBuilder().build(), response);
} }
@Override @Override

View File

@@ -1,6 +1,8 @@
package org.vato.carcontroller; package org.vato.carcontroller;
import com.google.protobuf.Empty;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@@ -68,4 +70,15 @@ public class PiLoader implements Runnable {
} }
} }
} }
public void saveRecording() {
// Ideally don't want to use a blocking stub here, android may complain.
Empty done = stub.saveRecordedData(SaveRequest.newBuilder().setFile("Test").build());
}
public void record(boolean record) {
// Ideally don't want to use a blocking stub here, android may complain.
Empty done = stub.record(RecordingReqeust.newBuilder().setRecord(record).build());
}
} }

View File

@@ -13,8 +13,8 @@ import android.view.SurfaceView;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.google.protobuf.ByteString; import com.google.protobuf.ByteString;
import com.google.protobuf.Empty;
import org.vato.carcontroller.Empty;
import org.vato.carcontroller.SlamControlGrpc; import org.vato.carcontroller.SlamControlGrpc;
import org.vato.carcontroller.SlamDetails; import org.vato.carcontroller.SlamDetails;
import org.vato.carcontroller.SlamLocation; import org.vato.carcontroller.SlamLocation;
@@ -57,7 +57,7 @@ public class SlamView extends SurfaceView implements AbstractUpdater.MapChangedL
private void init() { private void init() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
String host = prefs.getString("host", "10.0.0.53"); String host = prefs.getString("host", "10.0.0.53");
port = prefs.getString("zmqPort", "5050"); port = prefs.getString("zmqPort", "50052");
String gRPCPort = prefs.getString("port", "50051"); String gRPCPort = prefs.getString("port", "50051");
mapSizePixels = Integer.parseInt(prefs.getString("MAPSIZEPIXELS", "540")); mapSizePixels = Integer.parseInt(prefs.getString("MAPSIZEPIXELS", "540"));
mapSizeMeters = Integer.parseInt(prefs.getString("MAPSIZEMETRES", "10")); mapSizeMeters = Integer.parseInt(prefs.getString("MAPSIZEMETRES", "10"));
@@ -96,7 +96,6 @@ public class SlamView extends SurfaceView implements AbstractUpdater.MapChangedL
stub.startMapStreaming(SlamDetails.newBuilder() stub.startMapStreaming(SlamDetails.newBuilder()
.setMapSizePixels(mapSizePixels) .setMapSizePixels(mapSizePixels)
.setMapSizeMeters(mapSizeMeters) .setMapSizeMeters(mapSizeMeters)
.setPort(Integer.parseInt(port))
.build(), response); .build(), response);
} }

View File

@@ -2,16 +2,31 @@ package org.vato.carcontroller;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.Switch;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import com.google.protobuf.Empty;
import org.vato.carcontroller.LIDAR.LidarTrackingController;
import java.util.stream.Stream;
import io.grpc.stub.StreamObserver;
public class SimpleController extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener { public class SimpleController extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener {
SeekBar steeringSlider; private SeekBar steeringSlider;
SeekBar throttleSlider; private SeekBar throttleSlider;
private Switch recordSwitch;
private Switch recordLidarSwitch;
private static PiLoader grpcController; private static PiLoader grpcController;
private PersonTrackingGrpc.PersonTrackingStub trackingStub;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@@ -26,6 +41,9 @@ public class SimpleController extends AppCompatActivity implements SeekBar.OnSee
if (throttleSlider != null) { if (throttleSlider != null) {
throttleSlider.setOnSeekBarChangeListener(this); throttleSlider.setOnSeekBarChangeListener(this);
} }
recordSwitch = findViewById(R.id.recordSwitch);
recordLidarSwitch = findViewById(R.id.lidarSwitch);
} }
@Override @Override
@@ -83,4 +101,33 @@ public class SimpleController extends AppCompatActivity implements SeekBar.OnSee
steeringSlider.setProgress(50); steeringSlider.setProgress(50);
throttleSlider.setProgress(50); throttleSlider.setProgress(50);
} }
public void saveRecording(View view) {
grpcController.saveRecording();
}
public void record(View view) {
grpcController.record(recordSwitch.isChecked());
}
public void recordLidar(View view) {
StreamObserver<Empty> response = new StreamObserver<Empty>() {
@Override
public void onNext(Empty value) {
Toast.makeText(getApplicationContext(), "Started Recording Lidar", Toast.LENGTH_SHORT).show();
}
@Override
public void onError(Throwable t) {
Toast.makeText(getApplicationContext(), "Failed to set lidar recording", Toast.LENGTH_SHORT).show();
}
@Override
public void onCompleted() {
}
};
}
} }

View File

@@ -7,14 +7,17 @@
tools:context=".LIDAR.LidarTrackingController"> tools:context=".LIDAR.LidarTrackingController">
<org.vato.carcontroller.LIDAR.LidarView <org.vato.carcontroller.LIDAR.LidarView
android:id="@+id/lidarMap"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/lidarMap"/> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="-45dp" />
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
android:layout_width="37dp" android:layout_width="96dp"
android:layout_height="21dp" android:layout_height="89dp"
android:rotation="270" android:rotation="270"
android:scaleType="fitCenter" android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@@ -23,5 +26,13 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_car" /> app:srcCompat="@drawable/ic_car" />
<Switch
android:id="@+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -28,4 +28,37 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
<Switch
android:id="@+id/recordSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:onClick="record"
android:text="Record Vehicle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/saveButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:onClick="saveRecording"
android:text="Save"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
android:id="@+id/lidarSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:onClick="recordLidar"
android:text="Record LiDAR"
app:layout_constraintStart_toEndOf="@+id/recordSwitch"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -22,7 +22,7 @@ class ZmqPubSubStreamer:
self.send_message_topic("", message) self.send_message_topic("", message)
def send_message_topic(self, topic, message): def send_message_topic(self, topic, message):
self._socket.send_multipart([bytes(topic), message.serialise()]) self._socket.send_multipart([topic, message.serialise()])
class BluetoothStreamer: class BluetoothStreamer:

View File

@@ -0,0 +1,86 @@
import datetime
class VehicleRecordingDecorator:
def __init__(self, vehicle):
"""
A decorator for a vehicle object to record the changes in steering/throttle.
This will be recorded to memory, and will save to the given file when save is called.
Parameters
----------
vehicle
Base vehicle to decorate.
outfile: str
Filename to write to. Will create/overwrite existing file. You must call save to save the
data to the file.
"""
self._vehicle = vehicle
self._recording = False
self._records = []
@property
def vehicle(self):
return self._vehicle
def save_data(self, outfile):
"""
Flushes all current records to disk.
"""
with open(outfile, 'w') as f:
for line in self._records:
f.write('%s\n' % line)
self._records = []
@property
def record(self):
return self._recording
@record.setter
def record(self, value: bool):
if not value:
self._records = []
self._recording = value
@property
def throttle(self):
return self._vehicle.throttle
@throttle.setter
def throttle(self, value):
if self._recording:
self._records.append(
't,' + str(value) + ',' + datetime.datetime.now().isoformat(sep=' ', timespec='seconds'))
self._vehicle.throttle = value
@property
def steering(self):
return self._vehicle.steering
@steering.setter
def steering(self, value):
if self._recording:
self._records.append(
's,' + str(value) + ',' + datetime.datetime.now().isoformat(sep=' ', timespec='seconds'))
self._vehicle.steering = value
@property
def motor_pin(self):
return self._vehicle.motor_pin
@motor_pin.setter
def motor_pin(self, value):
self._vehicle.motor_pin = value
@property
def steering_pin(self):
return self._vehicle.steering_pin
@steering_pin.setter
def steering_pin(self, value):
self._vehicle.steering_pin = value
def stop(self):
self.throttle = 0

View File

@@ -4,13 +4,16 @@ import time
import car.control.motorService_pb2 as motorService_pb2 import car.control.motorService_pb2 as motorService_pb2
import car.control.motorService_pb2_grpc as motorService_pb2_grpc import car.control.motorService_pb2_grpc as motorService_pb2_grpc
from car.control.gpio.recording_vehicle_decorator import VehicleRecordingDecorator
import google.protobuf.empty_pb2 as empty
class MotorServicer(motorService_pb2_grpc.CarControlServicer): class MotorServicer(motorService_pb2_grpc.CarControlServicer):
def __init__(self, vehicle): def __init__(self, vehicle):
self.vehicle = vehicle self.vehicle = VehicleRecordingDecorator(vehicle)
self._timer = None self._timer = None
def SetThrottle(self, request, context): def set_throttle(self, request, context):
# gRPC streams currently don't work between python and android. # gRPC streams currently don't work between python and android.
# If we don't get a response every 3 seconds, stop the car. # If we don't get a response every 3 seconds, stop the car.
print('Setting throttle to: ' + str(request.throttle)) print('Setting throttle to: ' + str(request.throttle))
@@ -18,7 +21,7 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
self.vehicle.throttle = request.throttle self.vehicle.throttle = request.throttle
return motorService_pb2.ThrottleResponse(throttleSet=True) return motorService_pb2.ThrottleResponse(throttleSet=True)
def SetSteering(self, request, context): def set_steering(self, request, context):
print('Setting steering to: ' + str(request.steering)) print('Setting steering to: ' + str(request.steering))
self.vehicle.steering = request.steering self.vehicle.steering = request.steering
return motorService_pb2.SteeringResponse(steeringSet=True) return motorService_pb2.SteeringResponse(steeringSet=True)
@@ -38,3 +41,11 @@ class MotorServicer(motorService_pb2_grpc.CarControlServicer):
print("Node timeout elapsed") print("Node timeout elapsed")
self.vehicle.stop() self.vehicle.stop()
def record(self, request, context):
"""Indicate whether the vehicle data should be recorded."""
self.vehicle.record = request.record
return empty.Empty()
def save_recorded_data(self, request, context):
self.vehicle.save_data(request.file)
return empty.Empty()

View File

@@ -83,7 +83,7 @@ class SlamStreamer:
location=SlamLocation(x=location[0], y=location[1], theta=location[2]))) location=SlamLocation(x=location[0], y=location[1], theta=location[2])))
print('Sending map') print('Sending map')
self._mFactory.send_message_topic( self._mFactory.send_message_topic(
'slam_map', protoScan) b'slam_map', protoScan)
def stop_scanning(self): def stop_scanning(self):
self.can_scan = False self.can_scan = False

View File

@@ -0,0 +1,52 @@
import datetime
class RecordingLidarDecorator:
def __init__(self, lidar):
self._lidar = lidar
self._scans = []
self._record = False
@property
def record(self):
return self._record
@record.setter
def record(self, value):
self.record = value
def save_data(self, filename):
with open(filename, 'w') as f:
for scan in self._scans:
f.write("%s\n" % scan)
def iter_scans(self, min_len=100):
# Need to customise the iterable.
return RecordingIterator(self._lidar.iter_scans(min_len), self._scans)
def get_health(self):
return self._lidar.get_health()
def get_info(self):
return self._lidar.get_info()
def stop(self):
return self._lidar.stop()
def disconnect(self):
return self._lidar.disconnect()
class RecordingIterator:
def __init__(self, iterator, scan_list):
self._iterator = iterator
self._scans = scan_list
def __iter__(self):
return self
def __next__(self):
nextIter = next(self._iterator)
self._scans.append((nextIter, str(datetime.datetime.now())))
return nextIter

View File

@@ -4,42 +4,65 @@ from car.tracking.lidar_cache import LidarCache
from multiprocessing import Process from multiprocessing import Process
import car.messaging.message_factory as mf import car.messaging.message_factory as mf
import car.tracking.devices.factory as lidar_factory import car.tracking.devices.factory as lidar_factory
from car.tracking.devices.recording_lidar import RecordingLidarDecorator
from car.messaging import messages from car.messaging import messages
import car.tracking.algorithms as alg import car.tracking.algorithms as alg
import os import os
import google.protobuf.empty_pb2 as empty
class LidarServicer(PersonTrackingServicer): class LidarServicer(PersonTrackingServicer):
def __init__(self, vehicle=None): def __init__(self, vehicle=None):
# TODO: Put the rplidar creation in a factory or something, to make it possible to test this servicer. self._lidar = RecordingLidarDecorator(
# Also, it would allow creating the service without the lidar being connected. lidar_factory.get_lidar())
self.cache = LidarCache(lidar_factory.get_lidar(), measurements=100) self.cache = LidarCache(self._lidar, measurements=100)
self.cache.add_groups_changed_listener(self) self.cache.add_groups_changed_listener(self)
self._mFactory = None self._mFactory = None
self._port = 50052 if 'CAR_ZMQ_PORT' not in os.environ else os.environ[ self._port = 50052 if 'CAR_ZMQ_PORT' not in os.environ else os.environ[
'CAR_ZMQ_PORT'] 'CAR_ZMQ_PORT']
self._vehicle = vehicle self._vehicle = vehicle
self._tracked_group = None self._tracked_group = None
self._should_stream = False
def set_tracking_group(self, request, context): def set_tracking_group(self, request, context):
# Invalid groups should stop tracking # Invalid groups should stop tracking
self._tracked_group = None if request.value < 0 else request.value self._tracked_group = None if request.value < 0 else request.value
return empty.Empty()
def stop_tracking(self, request, context): def stop_tracking(self, request, context):
self._should_stream = False
self.cache.stop_scanning() self.cache.stop_scanning()
return empty.Empty()
def start_tracking(self, request, context): def start_tracking(self, request, context):
"""Starts the lidar cache, streaming on the provided port.""" """Starts the lidar cache, streaming on the provided port."""
self._should_stream = True
self.cache.start_cache() self.cache.start_cache()
return empty.Empty()
def record(self, request, context):
# TODO: Fix this to not require
if request.value:
self.cache.start_cache()
else:
self.cache.stop_scanning()
self._lidar.record = request.value
return empty.Empty()
def save_lidar(self, request, context):
self._lidar.save_data(request.file)
return empty.Empty()
def onGroupsChanged(self, message): def onGroupsChanged(self, message):
if self._mFactory is None: if self._mFactory is None:
# Create the zmq socket in the thread that it will be used, just to be safe. # Create the zmq socket in the thread that it will be used, just to be safe.
self._mFactory = mf.getZmqPubSubStreamer(self._port) self._mFactory = mf.getZmqPubSubStreamer(self._port)
self._mFactory.send_message_topic(
"lidar_map", messages.ProtoMessage(message=message.SerializeToString())) if self._should_stream:
self._mFactory.send_message_topic(
"lidar_map", messages.ProtoMessage(message=message.SerializeToString()))
if self._tracked_group is not None and self._vehicle is not None: if self._tracked_group is not None and self._vehicle is not None:
# Update vehicle to correctly follow the tracked group. # Update vehicle to correctly follow the tracked group.

View File

@@ -7,6 +7,8 @@ option java_multiple_files = true;
option java_package = "org.vato.carcontroller"; option java_package = "org.vato.carcontroller";
option java_outer_classname = "MotorServiceProto"; option java_outer_classname = "MotorServiceProto";
import "google/protobuf/empty.proto";
message ThrottleRequest{ message ThrottleRequest{
float throttle = 1; float throttle = 1;
} }
@@ -23,7 +25,17 @@ message SteeringResponse{
bool steeringSet = 1; bool steeringSet = 1;
} }
service CarControl{ message RecordingReqeust{
rpc SetThrottle(ThrottleRequest) returns (ThrottleResponse){} bool record = 1;
rpc SetSteering(SteeringRequest) returns (SteeringResponse){} }
message SaveRequest{
string file = 1;
}
service CarControl{
rpc set_throttle(ThrottleRequest) returns (ThrottleResponse){}
rpc set_steering(SteeringRequest) returns (SteeringResponse){}
rpc record(RecordingReqeust) returns (google.protobuf.Empty) {}
rpc save_recorded_data(SaveRequest) returns (google.protobuf.Empty) {}
} }

View File

@@ -1,9 +0,0 @@
syntax = "proto3";
option java_multiple_files = true;
option java_package = "org.vato.carcontroller";
option java_outer_classname = "EmptyProto";
message Empty{
}

View File

@@ -4,7 +4,7 @@ option java_multiple_files = true;
option java_package = "org.vato.carcontroller"; option java_package = "org.vato.carcontroller";
option java_outer_classname = "SlamControllerProto"; option java_outer_classname = "SlamControllerProto";
import "car/empty.proto"; import "google/protobuf/empty.proto";
message SlamDetails { message SlamDetails {
int32 map_size_pixels = 1; int32 map_size_pixels = 1;
@@ -27,7 +27,7 @@ message SlamScan{
} }
service SlamControl { service SlamControl {
rpc start_map_streaming(SlamDetails) returns (Empty) {} rpc start_map_streaming(SlamDetails) returns (google.protobuf.Empty) {}
rpc stop_streaming(Empty) returns (Empty) {} rpc stop_streaming(google.protobuf.Empty) returns (google.protobuf.Empty) {}
} }

View File

@@ -6,7 +6,9 @@ option java_multiple_files = true;
option java_package = "org.vato.carcontroller"; option java_package = "org.vato.carcontroller";
option java_outer_classname = "PersonTrackingProto"; option java_outer_classname = "PersonTrackingProto";
import "car/empty.proto"; import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "car/control/motorService.proto";
message Int32Value{ message Int32Value{
int32 value = 1; int32 value = 1;
@@ -22,10 +24,16 @@ message PointScan{
repeated Point points = 1; repeated Point points = 1;
} }
service PersonTracking{ service PersonTracking{
rpc set_tracking_group(Int32Value) returns (Empty) {} rpc set_tracking_group(Int32Value) returns (google.protobuf.Empty) {}
rpc stop_tracking(Empty) returns (Empty) {} rpc stop_tracking(google.protobuf.Empty) returns (google.protobuf.Empty) {}
rpc start_tracking(google.protobuf.Empty) returns (google.protobuf.Empty) {}
rpc record(google.protobuf.BoolValue) returns (google.protobuf.Empty) {}
rpc save_lidar(MotorControl.SaveRequest) returns (google.protobuf.Empty) {}
rpc start_tracking(Empty) returns (Empty) {}
} }