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

Add docs for the comp-mode usb sticks #8

Open
wants to merge 3 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
22 changes: 22 additions & 0 deletions scripts/comp_usb_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python

import argparse
import json
import subprocess

parser = argparse.ArgumentParser()
parser.add_argument('mount_point', metavar='MOUNT_POINT')
args = parser.parse_args()

with open("{}/mode.json".format(args.mount_point)) as f:
data = json.load(f)
print(data)

if data["zone"] not in range(4):
exit("invalid zone")
if data["arena"] != "B":
exit("invalid arena")

print("Pass")

subprocess.check_call(['umount', args.mount_point])
64 changes: 64 additions & 0 deletions src/comp-mode-usb-sticks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Competition Mode USB stick check

## Equipment

* Internet access, or a copy of make-zip locally
* Laptop
* ODROID
* ODROID Power cable
* Power Board
* Battery
* USB stick
* Competition mode usb sticks
* USB hub
* USB A-B cable
* USB micro cable
* a power board power loop, or:
* wire
* 7mm CamCon
* Wire cutters

## Procedure

*Setup time*: 5 minutes

1. Make a power loop for the power board
1. Assemble the minimal kit into a kit
1. Put a robot.zip onto the USB stick with the following code in:
``` python
import time
from pprint import pprint
from sr.robot import Robot

R = Robot()

pprint({
'zone': R.zone,
'mode': R.mode,
})

if R.mode != 'comp':
# error that we're not in comp mode
R.power.beep(500, note='a')
exit("not comp mode")

for _ in range(R.zone + 1):
R.power.beep(200, note='d')
time.sleep(0.4)
```
1. Run that code, so you know what the error sounds like

*Execution time*: 20 seconds per USB stick.

1. Plug in a comp-mode stick to test
1. Run `./scripts/comp_usb_test.py /path/to/mount/point`.
1. Check that it prints the arena and zone the same as the physical label for
the USB stick
1. Check that it prints a success message
(if successful the script will unmount the stick, so it can be removed
immediately)

Also, to check that the sticks work in kit; for an example of each arena/corner:
1. Plug the comp-mode stick into the kit
1. Boot the kit, after the start button is pressed it should beep for one more
time than the number of the corner, i.e: corner 2 should beep three times