Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Racer name logging to CSV #30

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ Written in [Cinder](https://libcinder.org/), an opensource C++ library for creat
## Using the Application

#### Requirements
* Requires OS X version 10.7 and up.
* PC requires Windows 7 and up.
* Requires (±mac)OS X version 10.7 and up.
* PC requires Windows 7 and up

#### Installation
1. Download the latest [SilverSprints](https://github.com/cwhitney/SilverSprint/releases/latest) for your operating system.
2. In the downlaoded zip file, there is an `Arduino` folder with software you'll need to load onto the OpenSprints hardware. Detailed instructions on how to do this can be found here: [http://cwhitney.github.io/SilverSprint/installation.html](http://cwhitney.github.io/SilverSprint/installation.html).

#### App Settings
1. Go to the Settings page by clicking the gear icon or pressing Command + 3.
1. Go to the Settings page by clicking the gear icon or pressing <kbd>Command</kbd> + <kbd>3</kbd>
2. Set the roller diameter as the distance from the magnet to the center of the roller multiplied by 2.
3. Choose the number of racers competing from 1-4.
4. If SilverSprints detects an Arduino connected it will show a checkmark, otherwise it will display an X.

#### Roster
1. Go to the Roster page by clicking the list icon or pressing Command + 2.
2. Set all active participants' names.
1. Go to the Roster page by clicking the list icon or pressing <kbd>Command</kbd> + <kbd>2</kbd>
2. Set all active participants names

#### Race
1. Click the START button to begin a race.
Expand All @@ -38,10 +38,10 @@ In the event of a crash, a log file will be created in a folder called "logs" in
Please attach this file when asking for support along with any other relevant information.

## Code Setup
1. Clone the repo with all of its submodules with: `git clone https://github.com/cwhitney/SilverSprint.git --depth 1 --recursive`
2. Build Cinder for your platform [OS X](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html).
If you're having trouble building Cinder, it may be missing some of its dependencies. You may need to run `git submodule update --init --recursive` to make sure Cinder has all of its submodules.
3. The structure of the repo is like so:
1. Clone the repo with all of it's sumodules with: `git clone https://github.com/cwhitney/SilverSprint.git --depth 1 --recursive`
1. Build Cinder (with Cinder-OpenCV) for your platform [(±mac)OS X](https://libcinder.org/docs/guides/mac-setup/index.html) - [Windows](https://libcinder.org/docs/guides/windows-setup/index.html).
If you're having trouble building Cinder, it may be missing some of it's dependencies. You may need to run `git submodule update --init --recursive` to make sure Cinder has all of it's submodules.
2. The structure of the repo is like so:

```
Root
Expand All @@ -50,10 +50,12 @@ Root
- SilverSprints
- libs
- Cinder
- blocks
- Cinder-OpenCV
```
4. Update Arduino if necessary. (See above.)
5. Open the project file for your platform. It will be in `apps/SilverSprints/xcode/SilverSprint.xcodeproj` for OS X, and `apps/SilverSprints/vs2015` for PC.
6. Build SilverSprints. There are no external dependencies aside from Cinder itself.
3. Update Arduino if necessary. (See above)
4. Open the project file for your platform. It will be in `apps/SilverSprint/xcode/SilverSprint.xcodeproj` for OSX, and `apps/SilverSprint/vs2015` for PC.
5. Build Silversprints. There are no external dependencies aside from Cinder itself.

## Credits

Expand Down
18 changes: 17 additions & 1 deletion apps/Silversprints/src/app/GFXMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ GFXMain::~GFXMain(){
void GFXMain::setup(){
// INIT --------------------------------------------------------------
mSerialReader = std::make_shared<SerialReader>();
CsvLogger::instance().setHeaders({"Timestamp", "Event", "Racer 1", "Racer 2", "Racer 3", "Racer 4"});
if(Model::instance().getCurrentRaceType() == Model::RACE_TYPE::RACE_TYPE_DISTANCE){
CsvLogger::instance().setHeaders({"Timestamp", "Event", "Racer 1", "Distance 1", "Racer 2", "Distance 2", "Racer 3", "Distance 3", "Racer 4", "Distance 4"});
} else {
CsvLogger::instance().setHeaders({"Timestamp", "Event", "Racer 1", "Time 1", "Racer 2", "Time 2", "Racer 3", "Time 3", "Racer 4", "Time 4"});
}

// VIEWS --------------------------------------------------------------
mNav = std::make_shared<NavBarView>();
Expand Down Expand Up @@ -91,24 +95,36 @@ void GFXMain::onRaceFinished() {
// If it's a distance race, log the times
if(Model::instance().getCurrentRaceType() == Model::RACE_TYPE::RACE_TYPE_DISTANCE){
CsvLogger::instance().log(CsvLogger::RACE_FINISH_DISTANCE,
Model::instance().playerData[0]->player_name,
sb::utils::millisToTimestamp(Model::instance().playerData[0]->finishTimeMillis),
Model::instance().playerData[1]->player_name,
sb::utils::millisToTimestamp(Model::instance().playerData[1]->finishTimeMillis),
Model::instance().playerData[2]->player_name,
sb::utils::millisToTimestamp(Model::instance().playerData[2]->finishTimeMillis),
Model::instance().playerData[3]->player_name,
sb::utils::millisToTimestamp(Model::instance().playerData[3]->finishTimeMillis));
}
// If it's a time race, log the distance
else {
if(Model::instance().getUsesKph()){
CsvLogger::instance().log(CsvLogger::RACE_FINISH_TIME,
Model::instance().playerData[0]->player_name,
Model::instance().playerData[0]->getDistanceMeters(),
Model::instance().playerData[1]->player_name,
Model::instance().playerData[1]->getDistanceMeters(),
Model::instance().playerData[2]->player_name,
Model::instance().playerData[2]->getDistanceMeters(),
Model::instance().playerData[3]->player_name,
Model::instance().playerData[3]->getDistanceMeters());
}else{
CsvLogger::instance().log(CsvLogger::RACE_FINISH_TIME,
Model::instance().playerData[0]->player_name,
Model::instance().playerData[0]->getDistanceFeet(),
Model::instance().playerData[1]->player_name,
Model::instance().playerData[1]->getDistanceFeet(),
Model::instance().playerData[2]->player_name,
Model::instance().playerData[2]->getDistanceFeet(),
Model::instance().playerData[3]->player_name,
Model::instance().playerData[3]->getDistanceFeet());
}
}
Expand Down
22 changes: 21 additions & 1 deletion apps/Silversprints/xcode/SilverSprint.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0820;
LastUpgradeCheck = 1000;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SilverSprint" */;
compatibilityVersion = "Xcode 3.2";
Expand Down Expand Up @@ -631,6 +631,7 @@
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
Expand All @@ -657,6 +658,7 @@
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
Expand Down Expand Up @@ -687,14 +689,23 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CINDER_PATH = "../../..//libs/Cinder";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++11";
CLANG_CXX_LIBRARY = "libc++";
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_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_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -723,14 +734,23 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CINDER_PATH = "../../..//libs/Cinder";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++11";
CLANG_CXX_LIBRARY = "libc++";
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_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_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down
2 changes: 1 addition & 1 deletion libs/Cinder
Submodule Cinder updated 679 files