From 7dde8dd478f0d7a4ee5a1d72b4a560440a49f102 Mon Sep 17 00:00:00 2001 From: ErikBoesen Date: Mon, 23 Jan 2017 17:17:56 -0500 Subject: [PATCH] Tweak some documentation, standardize placeholder NT keynames --- README.md | 18 ++++++++---------- main.js | 10 +++++----- package.json | 4 ++-- ui.js | 12 ++++++------ 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 417b78e..c558cea 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # FRC Dashboard FRC Dashboard is a fully customizable dashboard for [FIRST Robotics Competition (FRC)](http://firstinspires.org/robotics/frc) which is based on web languages (JavaScript/CSS/HTML). It's completely legal for competition, and can be used to give your whole drive team significantly richer control of your robot. -The dashboard's code is designed to be 100% accessible, tweakable, and expandable. To help in this aim, the code is rigorously documented with thousands of inline comments and [a set of training exercises](https://github.com/FRCDashboard/training). In addition, the base system comes with several functioning example widgets and features, and [many addons](https://github.com/FRCDashboard?query=addon-) have been created to speed up the development of your team's dashboard. +The dashboard's code is designed to be 100% accessible, tweakable, and expandable. To help in this aim, the code is rigorously commented and [a set of training exercises](https://github.com/FRCDashboard/training) have been prepared to orient new users. In addition, the base system comes with several functioning example widgets and features, and we've build [several helpful addons](https://github.com/FRCDashboard?query=addon-) to speed up the development of your team's dashboard. **Contributions are VERY welcome! Please feel free to open a pull request or issue!** @@ -16,16 +16,16 @@ The dashboard's code is designed to be 100% accessible, tweakable, and expandabl If you don't have administrator privileges, put `--user` at the end of that command.) -If you're going to be using the preferred method of using the dashboard (as an application), you'll also need: +If you're going to be using the preferred method of using the dashboard (as an application through Electron), you'll also need: * [`nodejs`](https://nodejs.com) & [`npm`](https://npmjs.com) * If you don't have permission to install these, see [this gist](https://gist.github.com/isaacs/579814) for a workaround. -* Electron (to install, `cd` into dashboard directory and run `npm install`) +* Node dependencies (to install, `cd` into dashboard directory and run `npm install`) ### Configuration * In `ui.js`, there's a large `switch` statement in the `onValueChanged()` function which controls the updating of control elements in the dashboard. Example NetworkTables key names are used, but you'll need to change them to match those used in your team's robot code for them to affect anything on your robot. #### Configuring Camera feed -In order to run the camera, you must start an mjpg server on the RoboRIO. To install `mjpg-streamer`: +In order to run the camera, you must start an `mjpg-streamer` server on the RoboRIO. To install `mjpg-streamer`: 1. Download [this installer script](https://raw.githubusercontent.com/robotpy/robotpy-wpilib/master/installer/installer.py) from GitHub. This script is for downloading and installing packages to the RoboRIO. 2. While in the directory where you downloaded the installer script, run: @@ -57,13 +57,13 @@ While in the dashboard directory, run: This will start a Python server and open the dashboard application. Note that you don't have to close and reopen the application every time you make a change, you can just press `Ctrl+R` (`Cmd+R` on Mac) to refresh the application. ### Using dashboard through web browser -The less desirable, but perfectly functional method of viewing your dashboard is to use it like a webpage. This method will work even if you don't have the privileges to install `node.js` and `npm`. The standard toolbars from your browser will still be shown and will take up space on the screen, and the experience will be less fluid, but it will work. +The less desirable, but perfectly functional method of viewing your dashboard is to use it like a webpage. This method will work even if you don't have the privileges to install `node.js` and `npm`. The standard toolbars from your browser will still be shown and will take up space on the screen, and the experience will be a bit less fluid, but it will work. 1. Start the Python server independently: Windows: - start py -3 -m pynetworktables2js + py -3 -m pynetworktables2js Mac/Linux (using bash): @@ -81,8 +81,6 @@ It is recommended that while using the dashboard on your driver station, you clo * [Dustin Spicuzza](https://github.com/virtuald) leads the [RobotPy](https://github.com/robotpy) project mentored team 1418 through much of FRC Dashboard's genesis. ## Modifying -FRC Dashboard is designed to be modified for your team's purposes, but we have some restrictions we'd like you to follow when using this software. +FRC Dashboard is designed to be modified for your team's purposes, so you're allowed to do whatever you think is best for you. However, it would be good if you could fork this repository or copy it to another. This will allow you to easily pull updates when they occur, and if you fork it it helps us tell who's using it. -We'd like if you fork this repository to your team's organization (or wherever else you like) if you plan to use GitHub for development. This will allow us to be informed about who's using the software and will help you to easily apply updates should we issue them. You don't HAVE to do this, but we'd much prefer it to other methods, like copying the repository contents to your own. - -This software is licensed under the MIT license. Basically, modify as much as you like, as long as you give credit to the [original source](https://github.com/FRCDashboard/FRCDashboard) and don't hold us accountable for anything. More information in `LICENSE`. +This software is licensed under the MIT license. Basically, modify as much as you like, as long as you give credit where it's due and don't hold us accountable for anything. More information in `LICENSE`. diff --git a/main.js b/main.js index b5d5e1b..66f1c65 100644 --- a/main.js +++ b/main.js @@ -27,7 +27,7 @@ function createWindow() { mainWindow = new BrowserWindow({ width: 1366, height: 570, - // 1366x570 is a good standard height, but you may want to change this to fit your DriverStation computer's screen better. + // 1366x570 is a good standard height, but you may want to change this to fit your DriverStation's screen better. // It's best if the dashboard takes up as much space as possible without covering the DriverStation application. // The window is closed until the python server is ready show: false @@ -40,6 +40,7 @@ function createWindow() { mainWindow.loadURL('http://localhost:8888'); // Once the python server is ready, load window contents. + // TODO: fix this abnomination mainWindow.once('ready-to-show', function() { mainWindow.loadURL('http://localhost:8888'); mainWindow.once('ready-to-show', function() { @@ -68,9 +69,8 @@ app.on('ready', createWindow); app.on('window-all-closed', function() { // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q. - // For FRCDB, though? Screw the standard. - // That standard sucks for this application. - // So we're going to kill the application regardless. + // Not like we're creating a consumer application though. + // Let's just kill it anyway. // If you want to restore the standard behavior, uncomment the next line. // if (process.platform !== 'darwin') @@ -91,4 +91,4 @@ app.on('activate', function() { if (mainWindow === null) { createWindow(); } -}); \ No newline at end of file +}); diff --git a/package.json b/package.json index 914a8ac..9e9bc39 100644 --- a/package.json +++ b/package.json @@ -10,13 +10,13 @@ "type": "git", "url": "git+https://github.com/FRCDashboard/FRCDashboard" }, - "author": "FRCDashboard", + "author": "Erik Boesen", "license": "MIT", "bugs": { "url": "https://github.com/FRCDashboard/FRCDashboard/issues" }, "homepage": "http://frcdashboard.github.io", "devDependencies": { - "electron-prebuilt": "^1.2.0" + "electron": "^1.2.0" } } diff --git a/ui.js b/ui.js index 0bfa757..4653048 100644 --- a/ui.js +++ b/ui.js @@ -53,7 +53,7 @@ function onValueChanged(key, value, isNew) { // This switch statement chooses which UI element to update when a NetworkTables variable changes. switch (key) { - case '/SmartDashboard/drive/navX/yaw': // Gyro rotation + case '/SmartDashboard/drive/navx/yaw': // Gyro rotation ui.gyro.val = value; ui.gyro.visualVal = Math.floor(ui.gyro.val - ui.gyro.offset); if (ui.gyro.visualVal < 0) { // Corrects for negative values @@ -78,7 +78,7 @@ function onValueChanged(key, value, isNew) { ui.robotDiagram.arm.style.transform = 'rotate(' + armAngle + 'deg)'; break; // This button is just an example of triggering an event on the robot by clicking a button. - case '/SmartDashboard/exampleVariable': + case '/SmartDashboard/example_variable': if (value) { // If function is active: // Add active class to button. ui.example.button.className = 'active'; @@ -89,7 +89,7 @@ function onValueChanged(key, value, isNew) { ui.example.readout.innerHTML = 'Value is false'; } break; - case '/SmartDashboard/timeRunning': + case '/SmartDashboard/time_running': // When this NetworkTables variable is true, the timer will start. // You shouldn't need to touch this code, but it's documented anyway in case you do. var s = 135; @@ -211,7 +211,7 @@ function onValueChanged(key, value, isNew) { // The rest of the doc is listeners for UI elements being clicked on ui.example.button.onclick = function() { // Set NetworkTables values to the opposite of whether button has active class. - NetworkTables.setValue('/SmartDashboard/exampleVariable', this.className != 'active'); + NetworkTables.setValue('/SmartDashboard/example_variable', this.className != 'active'); }; // Reset gyro value to 0 on click @@ -219,7 +219,7 @@ ui.gyro.container.onclick = function() { // Store previous gyro val, will now be subtracted from val for callibration ui.gyro.offset = ui.gyro.val; // Trigger the gyro to recalculate value. - onValueChanged('/SmartDashboard/drive/navX/yaw', ui.gyro.val); + onValueChanged('/SmartDashboard/drive/navx/yaw', ui.gyro.val); }; // Open tuning section when button is clicked @@ -250,4 +250,4 @@ ui.autoSelect.onchange = function() { // Get value of arm height slider when it's adjusted ui.armPosition.oninput = function() { NetworkTables.setValue('/SmartDashboard/arm/encoder', parseInt(this.value)); -}; \ No newline at end of file +};