Skip to content
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
85 changes: 58 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
# mentorbot

Code for the FRC 1757 teaching platform robot

## Installation

### Visual Studio 2019 redistributable

[vc_redist.x64](https://aka.ms/vs/16/release/vc_redist.x64.exe)

### Python

[3.9.6 amd64](https://www.python.org/ftp/python/3.9.6/python-3.9.6-amd64.exe)

### VS Code

[VS Code](https://code.visualstudio.com)

### FRC Game Tools

[FRC Game Tools](https://www.ni.com/en-us/support/downloads/drivers/download.frc-game-tools.html#369633)

### FRC Radio Configuration Utility

[FRC Configuration Utility](https://firstfrc.blob.core.windows.net/frc2020/Radio/FRC_Radio_Configuration_20_0_0.zip)

### CTRE Phoenix

[Phoenix Tuner](https://github.com/CrossTheRoadElec/Phoenix-Releases/releases)

## Setup

### roboRIO

1. Image the roboRIO
[Imaging instructions](https://docs.wpilib.org/en/stable/docs/zero-to-robot/step-3/imaging-your-roborio.html)
1. Configure the roboRio
Expand All @@ -36,48 +44,71 @@ Code for the FRC 1757 teaching platform robot
| Subnet Mask | `255.255.255.0` |

### Run Phoenix Tuner

#### Update device firmware
* PDP
* FalconFX
* CANCoder

- PDP
- FalconFX
- CANCoder

#### Configure CAN devices
| Device | Class | Range | ID |
| - | - | - | - |
| robo_rio | core | 0 - 9 | master (no ID) |
| pdp | core | 0 - 9 | 0 |
| front_left_drive | motors | 10 - 29 | 10 |
| front_left_steer | motors | 10 - 29 | 11 |
| front_right_drive | motors | 10 - 29 | 12 |
| front_right_steer | motors | 10 - 29 | 13 |
| back_left_drive | motors | 10 - 29 | 14 |
| back_left_steer | motors | 10 - 29 | 15 |
| back_right_drive | motors | 10 - 29 | 16 |
| back_right_steer | motors | 10 - 29 | 17 |
| front_left_encoder | sensors | 40 - 59 | 40 |
| front_right_encoder | sensors | 40 - 59 | 41 |
| back_left_encoder | sensors | 40 - 59 | 42 |
| back_right_encoder | sensors | 40 - 59 | 43 |

| Device | Class | Range | ID |
| ------------------- | ------- | ------- | -------------- |
| robo_rio | core | 0 - 9 | master (no ID) |
| pdp | core | 0 - 9 | 0 |
| front_left_drive | motors | 10 - 29 | 10 |
| front_left_steer | motors | 10 - 29 | 11 |
| front_right_drive | motors | 10 - 29 | 12 |
| front_right_steer | motors | 10 - 29 | 13 |
| back_left_drive | motors | 10 - 29 | 14 |
| back_left_steer | motors | 10 - 29 | 15 |
| back_right_drive | motors | 10 - 29 | 16 |
| back_right_steer | motors | 10 - 29 | 17 |
| front_left_encoder | sensors | 40 - 59 | 40 |
| front_right_encoder | sensors | 40 - 59 | 41 |
| back_left_encoder | sensors | 40 - 59 | 42 |
| back_right_encoder | sensors | 40 - 59 | 43 |

#### Configure network devices
| Device | IP Address | Subnet Mask |
| - | - | - |
| OpenMesh radio | `10.17.57.1` | `???.???.???.???` |
| roboRIO | `10.17.57.2` | `255.255.255.000` |

| Device | IP Address | Subnet Mask |
| ----------------------- | ------------ | ----------------- |
| OpenMesh radio | `10.17.57.1` | `???.???.???.???` |
| roboRIO | `10.17.57.2` | `255.255.255.000` |
| Driver Station (laptop) | `10.17.57.5` | `255.000.000.000` |

### Install robotpy
* **IMPORTANT: Perform ALL operations in a python virtualenv**

### Automated Method

This MUST be done within bash

```bash
cd <path-to-mentorbot-repo>
./init.sh
```

this should (in theory) install everything required on your local system

### Manual Method

- **IMPORTANT: Perform ALL operations in a python virtualenv**

#### Create virtualenv (if not previously done)

Recommend placing the virtualenv in the `mentorbot` repo folder under `.venv` (to keep everything together) however the virtualenv is local to your system and should not be uploaded (ignored in `.gitignore`)

```bash
cd <path-to-mentorbot-repo>
py -3 -m venv ./.venv
```

#### Workflow

1. **Activate virtualenv**
(Virtualenv activation may differ depending on your operating system and terminal)
* Git Bash (Windows)
- Git Bash (Windows)
```bash
source <path-to-mentorbot-repo>/.venv/Scripts/activate
```
Expand Down Expand Up @@ -110,12 +141,12 @@ py -3 -m venv ./.venv
```
(examples: `robotpy`, `robotpy[ctre,navx]`, `robotpy[all]`) (see: [robotpy on pypi](https://pypi.org/project/robotpy/))
1. **Deploy robotpy program**
* To robot
- To robot
(must be connected to roboRIO)
```bash
python robot.py deploy
```
* To simulator
- To simulator
```bash
python robot.py sim
```
26 changes: 26 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

PY=$(case $(uname -s) in
Drawin* | Linux* ) echo "python";;
* ) echo "py";;
esac)

echo "Welcome to the automated Mentorbot installer, please ensure that python is installed"
read -p "Press enter to continue"

echo "creating python venv..."
$PY -m venv ./.venv

echo "sourcing new venv..."
case $(uname -s) in
Darwin* | Linux*) # https://docs.python.org/3/tutorial/venv.html
source ./.venv/bin/activate;;
*)
source ./.venv/Scripts/activate;;
esac

echo "installing robotpy..."
$PY -m pip install -U robotpy[all]

echo "complete!"