This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added JSON parser, added functioning screen for TeleOp and Auton
- Loading branch information
1 parent
836da8e
commit de764f2
Showing
29 changed files
with
364 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 36 additions & 18 deletions
54
scouting1072/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+961 Bytes
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.23 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.23 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.55 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.54 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.54 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.54 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.23 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.96 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.96 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.22 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.22 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.7 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.81 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.1 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.6 KB
scouting1072/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// | ||
// AutonViewController.swift | ||
// scouting1072 | ||
// | ||
// Created by Aydin Tiritoglu on 2/9/18. | ||
// Copyright © 2018 Aydin Tiritoglu. All rights reserved. | ||
// | ||
|
||
var startingPosition = Float() | ||
var autonStartTime = Double() | ||
var teleOpStartTime = Double() | ||
var autonStarted = false | ||
var teleOpStarted = false | ||
var autonPresses = [Double: String]() | ||
var teleOpPresses = [Double: String]() | ||
var timer = Timer() | ||
var crossedLine = false | ||
|
||
class AutonViewController: UIViewController { | ||
var counter = 0 | ||
@IBOutlet weak var fieldImage: UIImageView! | ||
@IBOutlet weak var timerLabel: UILabel! | ||
@IBOutlet weak var actionButton: UIButton! | ||
@IBOutlet weak var initialBotPosition: UISlider! { | ||
didSet { | ||
initialBotPosition.transform = CGAffineTransform(rotationAngle: CGFloat(Double.pi / 2)) | ||
} | ||
} | ||
|
||
@IBAction func actionButtonPressed(_ sender: Any) { | ||
if actionButton.currentTitle == "Confirm Starting Position" { | ||
startingPosition = initialBotPosition.value | ||
actionButton.setTitle("Start Auton", for: .normal) | ||
} else if actionButton.currentTitle == "Start Auton" { | ||
counter = 15 | ||
autonStartTime = NSDate().timeIntervalSince1970 | ||
autonStarted = true | ||
actionButton.setTitle("Auton Started", for: .normal) | ||
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(timerUpdate), userInfo: nil, repeats: true) | ||
timer.fire() | ||
} | ||
} | ||
|
||
@objc func timerUpdate() { | ||
counter -= 1 | ||
if counter <= -1 { | ||
timer.invalidate() | ||
if autonStarted { | ||
autonEnd() | ||
} else if teleOpStarted { | ||
teleOpEnd() | ||
} | ||
} else { | ||
timerLabel.text = "\(Int(counter / 60)):\(String(counter % 60).count == 2 ? "\(counter % 60)" : "0\(counter % 60)")" | ||
} | ||
} | ||
|
||
func autonEnd() { | ||
print(autonPresses) | ||
counter = 135 | ||
autonStarted = false | ||
teleOpStartTime = NSDate().timeIntervalSince1970 | ||
teleOpStarted = true | ||
actionButton.setTitle("TeleOp Started", for: .normal) | ||
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(timerUpdate), userInfo: nil, repeats: true) | ||
timer.fire() | ||
} | ||
|
||
func teleOpEnd() { | ||
print(teleOpPresses) | ||
teleOpStarted = false | ||
timer.invalidate() | ||
// TODO: Transition to info-sending screen | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
let appdelegate = UIApplication.shared.delegate as! AppDelegate | ||
appdelegate.shouldRotate = false | ||
let value = UIInterfaceOrientation.landscapeLeft.rawValue | ||
UIDevice.current.setValue(value, forKey: "orientation") | ||
if scoutingUserInfo!.scouting.blue { | ||
fieldImage.transform = fieldImage.transform.rotated(by: CGFloat.pi) | ||
} | ||
} | ||
|
||
override func didReceiveMemoryWarning() { | ||
super.didReceiveMemoryWarning() | ||
} | ||
|
||
private func supportedInterfaceOrientations() -> UIInterfaceOrientationMask { | ||
return UIInterfaceOrientationMask.landscapeLeft | ||
} | ||
|
||
private func shouldAutorotate() -> Bool { | ||
return true | ||
} | ||
} |
Oops, something went wrong.