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

Sync frontend team with master #573

Merged
merged 76 commits into from Apr 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
cdf62a6
test scripts for gps
MichaelLally Apr 19, 2020
a54d8d9
test scripts for gps
MichaelLally Apr 19, 2020
0d32f55
add gpsmon functionality
MichaelLally Apr 19, 2020
a27538b
typo fixed
MichaelLally Apr 19, 2020
0e1f6db
attempting to print raw GPS NMEA sentences
MichaelLally Apr 19, 2020
836525d
iterative change
MichaelLally Apr 19, 2020
34b26fc
iterative change
MichaelLally Apr 19, 2020
3e8f8a5
iterative change
MichaelLally Apr 19, 2020
90e0c5c
added missing transceiver test
ab7289 Apr 19, 2020
1bd1ca3
Send timezone-aware date string
alldne Apr 20, 2020
929ba2c
Move data_str_with_current_timezone to Utils module
alldne Apr 21, 2020
50648d4
added comm_pi tests
ab7289 Apr 21, 2020
3b448a3
added lan server tests
ab7289 Apr 21, 2020
15e0187
Merge pull request #520 from gcivil-nyu-org/frontend-team
sunnybansal Apr 21, 2020
9086335
added runServer method tests
ab7289 Apr 21, 2020
a6b1826
removed dead code
ab7289 Apr 21, 2020
4514a5f
Merge pull request #512 from gcivil-nyu-org/tests/transmission
ab7289 Apr 21, 2020
39488fc
added lan_client tests
ab7289 Apr 21, 2020
b5b3e1f
minor touch ups
ab7289 Apr 21, 2020
710e8c8
added lan_client tests
ab7289 Apr 21, 2020
048e46e
Merge pull request #515 from gcivil-nyu-org/tests/lan_client
ab7289 Apr 21, 2020
8e34e5a
Merge pull request #522 from gcivil-nyu-org/tests/lan_server
ab7289 Apr 21, 2020
8be03d9
Merge pull request #524 from gcivil-nyu-org/master
ab7289 Apr 21, 2020
d1b29c4
Merge pull request #523 from gcivil-nyu-org/hardware-team
iamvibhorsingh Apr 21, 2020
cdc64c8
Delete an unused file
alldne Apr 21, 2020
97f0bd6
Move tests to hardware/tests/tests_utils.py
alldne Apr 21, 2020
4194ad6
Merge pull request #501 from gcivil-nyu-org/backend/fix-timezone
alldne Apr 21, 2020
d03b08c
Merge branch 'backend-team' into backend/sync
alldne Apr 21, 2020
52c56b6
Merge pull request #526 from gcivil-nyu-org/backend/sync
iamvibhorsingh Apr 21, 2020
f680be1
Add stringtype=unspecified to the template
alldne Apr 21, 2020
fa263e8
Update README.md
alldne Apr 21, 2020
d6a5596
Merge pull request #527 from gcivil-nyu-org/backend-team
iamvibhorsingh Apr 21, 2020
28fbdea
Created module for gps reader
yashasvid Apr 21, 2020
d7508ad
Resolved black and flake8 errors
yashasvid Apr 21, 2020
a18fb58
Merge branch 'hardware-team' into gps-test
yashasvid Apr 21, 2020
51600e3
Fixed radio transceiver bug
PrabhanshuAttri Apr 21, 2020
ea15b44
Merge pull request #530 from gcivil-nyu-org/sync/master
PrabhanshuAttri Apr 21, 2020
fc6f35d
Added env vars and fixes
PrabhanshuAttri Apr 21, 2020
b083283
added GPSReader functionality to main control file
MichaelLally Apr 22, 2020
3bd8091
added GPSReader functionality to main control file
MichaelLally Apr 22, 2020
81643a8
Merge pull request #528 from gcivil-nyu-org/backend/sync-jsonb
VentusXu09 Apr 22, 2020
f249472
Merge branch 'backend-team' of github.com:gcivil-nyu-org/spring2020-c…
PrabhanshuAttri Apr 22, 2020
e45dd09
Merge branch 'backend-team' of https://github.com/gcivil-nyu-org/spri…
VentusXu09 Apr 22, 2020
abddeba
Merge pull request #533 from gcivil-nyu-org/backend/sync-master
jackxujh Apr 22, 2020
3457d74
Merge pull request #529 from gcivil-nyu-org/gps-test
MichaelLally Apr 22, 2020
de7b5dc
removed unused code
ab7289 Apr 22, 2020
604f2fc
Merge pull request #534 from gcivil-nyu-org/backend-team
iamvibhorsingh Apr 22, 2020
6e8c0d1
Merge pull request #536 from gcivil-nyu-org/remote-dead-code
ab7289 Apr 23, 2020
f6301a9
Merge branch 'feat/hardware-entry' of github.com:gcivil-nyu-org/sprin…
PrabhanshuAttri Apr 24, 2020
af47aff
fixed lan client issue and add show logs to env
PrabhanshuAttri Apr 24, 2020
5ae2753
Added sensor keys and commpi transmission env vars
PrabhanshuAttri Apr 24, 2020
4bec3cb
deleted unnecessary code and env rearranged
PrabhanshuAttri Apr 24, 2020
dfa2ac6
added entry point for each hardware
PrabhanshuAttri Apr 24, 2020
b58a44d
deleted unnecessary code and fixes
PrabhanshuAttri Apr 24, 2020
4b33529
style fixes and clean up
PrabhanshuAttri Apr 24, 2020
9788ba5
Merge branch 'master' of github.com:gcivil-nyu-org/spring2020-cs-gy-9…
PrabhanshuAttri Apr 24, 2020
14f7f18
Merge branch 'hardware-team' of github.com:gcivil-nyu-org/spring2020-…
PrabhanshuAttri Apr 24, 2020
497272a
Added code for local django app
PrabhanshuAttri Apr 24, 2020
670e245
fixed formatting issues
PrabhanshuAttri Apr 24, 2020
d74383d
Fixing tests
PrabhanshuAttri Apr 24, 2020
87c35e1
Fixing tests
PrabhanshuAttri Apr 24, 2020
ba9aa69
slimmed down the docker build and updated the docker test to better i…
ab7289 Apr 25, 2020
4138262
removed some comments
ab7289 Apr 25, 2020
3a18682
Fixed tests
PrabhanshuAttri Apr 25, 2020
7d95938
fixed flake8 issue
PrabhanshuAttri Apr 25, 2020
dcd193c
Renamed LAN Server to Web Server
PrabhanshuAttri Apr 25, 2020
f44a650
Added env fix
PrabhanshuAttri Apr 25, 2020
2cf84be
Merge pull request #563 from gcivil-nyu-org/sync/hardware
ab7289 Apr 25, 2020
c3c9370
Merge pull request #562 from gcivil-nyu-org/hardware-docker
ab7289 Apr 25, 2020
2564591
new PR template
MichaelLally Apr 25, 2020
b6743db
new PR template
MichaelLally Apr 25, 2020
03000d2
Merge pull request #565 from gcivil-nyu-org/pr-template
ab7289 Apr 25, 2020
b70574d
renamed lan client test class
PrabhanshuAttri Apr 25, 2020
3143a2c
Merge branch 'hardware-team' of github.com:gcivil-nyu-org/spring2020-…
PrabhanshuAttri Apr 25, 2020
4b87749
Merge pull request #557 from gcivil-nyu-org/feat/hardware-entry
PrabhanshuAttri Apr 25, 2020
f795cc8
Merge pull request #564 from gcivil-nyu-org/hardware-team
VentusXu09 Apr 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions .dockerignore
@@ -0,0 +1,29 @@
# ignore everything
*

# except the hardware directory
!hardware

# things we want to ignore in the file directory
**/__pycache__
**/*.pyc
**/*.pyo
**/*.pyd
**/.Python
**/.env
**/pip-log.txt
**/pip-delete-this-directory.txt
**/.tox
**/.coverage
**/.coveragerc
**/.coverage.*
**/.cache
**/nosetests.xml
**/coverage.xml
**/*,cover
**/*.log

# things we want to specifically include
!pi_requirements.txt
!Dockerfile

3 changes: 2 additions & 1 deletion .flake8
Expand Up @@ -3,5 +3,6 @@ max-line-length = 119
exclude =
.git,
__pycache__,
venv
venv,
pi_venv
**/migrations
27 changes: 27 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,27 @@
## Title
_Give a self-explanatory title_

## Description
_If this fixes a bug or resolves an issue, provide a link to that issue. Give a detailed description that answers:_
- _what is the purpose of this PR?_
- _what is the original vs the new behaviour?_
- _what bug does this PR attempt to fix?_
- _what is documented in the new documentation?_

## Types of Changes
_Put an `x` in the boxes that apply_

- [ ] Feature (non-breaking change which adds functionality)
- [ ] Bug Fix (non-breaking change that fixes an issue)
- [ ] Breaking Change (feature/fix that causes existing features to not work as expected)
- [ ] Documentation

## Checklist

- [ ] I have read the [contribute]contributing<link> doc
- [ ] Classes, scripts, and environment variables follow existing naming convention
- [ ] Lint and Unit tests pass locally
- [ ] New features on hardware have been tested on a local Raspberry Pi
- [ ] Mention new programs/binaries if any must be installed along with this change
- [ ] Mention new environment variables if any have been added to hardware/env file
- [ ] Test coverage should not drop more than 3%
14 changes: 7 additions & 7 deletions .travis.yml
Expand Up @@ -62,18 +62,18 @@ jobs:
services:
- docker

before_script:
install:
- docker pull nyumotorsportstelemetryorg/mercury || true

script:
# prepare qemu for arm emulation on x64 hardware
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
# build image
# - docker build -t gcivil-nyu-org/spring2020-cs-gy-9223-class .
- docker build --pull --cache-from nyumotorsportstelemetryorg/mercury --tag nyumotorsportstelemetryorg/mercury .
# basic help world test to see if it's working
- docker run nyumotorsportstelemetryorg/mercury grep -q "Hello, Docker!" hello.txt
# - black --check --exclude "migrations/" hardware
- docker run -d --name test_pi nyumotorsportstelemetryorg/mercury

script:
# insure that the server started up as expected
- docker ps -a
- docker ps | grep -q test_pi

after_script:
- docker images
Expand Down
20 changes: 17 additions & 3 deletions Dockerfile
@@ -1,14 +1,28 @@
FROM raspbian/stretch

ENV PYTHONUNBUFFERED 1

# install common build dependencies and clean up afterwards
RUN apt-get update && apt-get install -y --no-install-recommends \
raspi-config \
python3-pip \
python3-sense-emu \
sense-emu-tools \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir ~/Downloads
RUN mkdir hardware

# copy setup scripts
COPY ./hardware .
COPY ./hardware/setup/raspberrypi-common.sh .

# run setup
RUN bash ./setup/raspberrypi-common.sh
RUN bash ./raspberrypi-common.sh

COPY ./hardware/pi_requirements.txt .
RUN sudo python3 -m pip install pip --upgrade --force
RUN sudo pip3 install -r pi_requirements.txt

COPY ./hardware hardware/

RUN echo "Hello, Docker!" > hello.txt
CMD [ "python3", "-m", "hardware.main" ]
13 changes: 10 additions & 3 deletions hardware/CommunicationsPi/comm_pi.py
@@ -1,10 +1,13 @@
import os
from http.server import BaseHTTPRequestHandler
from hardware.CommunicationsPi.radio_transceiver import Transceiver

transceiver = Transceiver()


class CommPi(BaseHTTPRequestHandler):
def __init__(self, *args, **kwargs):
self.transceiver = Transceiver()
super().__init__(*args, **kwargs)

def _set_response(self):
self.send_response(200)
self.send_header("Content-type", "text/html")
Expand All @@ -23,5 +26,9 @@ def do_POST(self):
self.wfile.write("POST request for {}".format(self.path).encode("utf-8"))

def send_data(self, payload):
transceiver.send(payload)
if os.environ.get("ENABLE_INTERNET_TRANSMISSION"):
print("transmit via internet")
if os.environ.get("ENABLE_RADIO_TRANSMISSION"):
print("transmit via radio")
self.transceiver.send(payload)
return
143 changes: 0 additions & 143 deletions hardware/CommunicationsPi/find_port.py

This file was deleted.

17 changes: 8 additions & 9 deletions hardware/CommunicationsPi/lan_server.py
Expand Up @@ -3,19 +3,20 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
from hardware.Utils.utils import get_logger

log = get_logger("LAN_SERVER_LOG_FILE")


class Server(BaseHTTPRequestHandler):
def __init__(self, *args, **kwargs):
self.log = get_logger("LAN_SERVER_LOG_FILE")
super().__init__(*args, **kwargs)

def _set_response(self):
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()

def do_GET(self):
global log

log.info(
self.log.info(
"GET request,\nPath: %s\nHeaders:\n%s\n"
+ str(self.path)
+ str(self.headers)
Expand All @@ -24,19 +25,18 @@ def do_GET(self):
self.wfile.write("GET request for {}".format(self.path).encode("utf-8"))

def do_POST(self):
global log

content_length = int(
self.headers["Content-Length"]
) # <--- Gets the size of data
post_data = self.rfile.read(content_length) # <--- Gets the data itself
log.info(
self.log.info(
"POST request,\nPath: %s\nHeaders:\n%s\n\nBody:\n%s\n"
+ str(self.path)
+ str(self.headers)
+ post_data.decode("utf-8")
)
log.info("data: " + str(post_data))
self.log.info("data: " + str(post_data))

self._set_response()
self.wfile.write("POST request for {}".format(self.path).encode("utf-8"))
Expand All @@ -45,11 +45,10 @@ def do_POST(self):
def runServer(
server_class=HTTPServer, handler_class=Server, log_file_name=None, port=None
):
global log
log = (
get_logger("LAN_SERVER_LOG_FILE")
if log_file_name is None
else get_logger(log_file_name, log_file_name)
else get_logger(log_file_name)
)

port = int(os.environ["LAN_PORT"]) if port is None else port
Expand Down