GithubHelp home page GithubHelp logo

cornell-cup / cs-reminibot Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 8.0 166.54 MB

License: Apache License 2.0

Python 14.27% HTML 0.22% JavaScript 11.89% Shell 0.22% Makefile 2.56% C++ 6.69% CSS 1.05% CMake 1.25% C 59.29% Logos 0.01% kvlang 0.31% Jupyter Notebook 2.23%

cs-reminibot's People

Contributors

arklian avatar ashok-arun avatar ayang16 avatar azhuologist avatar chynu avatar corbinds avatar doanhtran avatar dtvirtue-zz avatar estherwang01 avatar jimmychen623 avatar jzhu2017 avatar kabirwalia8300 avatar kchiem12 avatar leotrj avatar linjing-liu avatar m-russ avatar mluo24 avatar ningning621 avatar rachelluuu avatar ruiqizhu26 avatar sanjana679 avatar sienna-hu avatar slawrence100 avatar sophiezheng0711 avatar swathi-parthibha avatar terencezhang29 avatar tl676 avatar trenton-lyke avatar virenvshah avatar wenyi-guo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cs-reminibot's Issues

GUIs should have their own ID? Should it be in the URL/handle?

Assuming the BaseStation will now start its own network, let's say that users can now go on their chromebooks and go to some url, maybe minibot.me/start to enter the ID of the BaseStation they want to connect to.

Should we assign each GUI to have its own ID which is reflected in the url? In other words, when they successfully connect, should a GUI with ID 3gsj8x go to minibot.me/session/3gsj8x? That way we can keep track of which GUI has which ID, thus what data to display at each GUI.

This question came up because we are not sure how to handle the different needs of numerous clients (Chromebook/GUI) connected to the same server (BaseStation). When it's just a matter of calling the render function of some HTTP get request, how would the server differentiate between the different data needs of the clients?

How to run Minibot from the PI

PYTHONPATH=/home/pi/cs-reminibot python3 /home/pi/cs-reminibot/minibot/main.py

copy and paste and smash enter on dat terminal

BaseStation should start its own network

Like the Access Point which Anmol developed in the past for our other pre-refactor repository, BaseStation should start its own network from which other MiniBots and GUIs should connect. This is infinitely more user friendly and avoids the confusion from having multiple BaseStations, connecting to the wrong one, etc.

Authentication(?) when connecting to BaseStation?

Should there be some form of "authentication" when connecting to the BaseStation?

E.g., when a user starts their GUI and wishes to connect to some BaseStation in their vicinity, the BaseStation must give the user some ID which they have to input into the GUI before they can establish a connection.

A semi-successful install guide for windows native / compilation of relevant GH issues

This is a troubleshooting guide for installing on windows native (as opposed to WSL/Ubuntu). Refer to README if you are installing on subsystem for linux.

Follow the general guide in the README, with the following additions:

  • When installing Python3, make sure to select "add to PATH" (if you're using an installer). Also (as of 1.29.22) do not install Python3.10. Use 3.9 or 3.8 for now.
  • When you deal with requirements.txt, you're likely going to run into issues involving pyaudio. Follow this guide to get pyaudio.
  • When you run npm install, you'll likely get some error about codemirror / react / codependencies. If this happens, ignore and rerun npm install --force

To run the basestation (branch/master):

  • It may run smoothly. Mine did not. This is a list of things I had to do:
  • pip install bcrypt / pip install flask_api / whatever the error messages say is missing. I had about 4 ish random installations to make for whatever reason
  • Comment out the if statement starting on line 84 of base_station.py (replace with self.sock.bind(server_address)) if you encounter issues involving WERKZEUG (comment if anyone finds a better fix for this)
  • '.' is not recognized as an internal or external command, operable program or batch file. in CMD --> run in bash instead (MINGW64 ended up working fine for me)
  • Command flask not found --> follow this guide
  • No gui updates on JS change --> follow this guide

Convert to websockets?

There has been discussion about changing the communication between the Pi and the BaseStation to be implemented using web sockets.

What if we did this for everything else, too? Replace HTTP with web sockets for all Module-to-BaseStation connections?

Command flask not found (Windows native)

If you're running into the error command flask not found when running bash ./run_BS.sh on Windows native:

Workaround solution (not automated yet):

  • Remove the last line of the run_BS.sh file (the line that reads flask run)
  • Run the command bash ./run_BS.sh
  • Run the command python -m flask run to start the GUI

(If you get an error related to EOL, edit with Notepad++>Edit>EOL conversion)

Programs with malfomed built-ins will not throw GUi-sided syntax errors

See this example program:

while True:
  bot.moooooooove_forward(100)

Expected Behavior: The Python error message box should show a syntax error for bot.moooooooove_forward(100).

Actual Behavior: The Base Station throws an error that is not caught and shown on the GUI.

127.0.0.1 - - [10/Nov/2020 16:47:56] "POST /code/ HTTP/1.1" 500 -
2020-11-10 16:47:56,285 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2020-11-10 16:47:56,285 INFO sqlalchemy.engine.base.Engine SELECT program.id AS program_id, program.code AS program_code, program.time AS program_time, program.email AS program_email, program.duration AS program_duration 
FROM program
2020-11-10 16:47:56,286 INFO sqlalchemy.engine.base.Engine ()
2020-11-10 16:47:56,286 INFO sqlalchemy.engine.base.Engine ROLLBACK
127.0.0.1 - - [10/Nov/2020 16:47:56] "GET /program/ HTTP/1.1" 200 -
Code len = 36
<class 'bot.pi_bot.PiBot'>
RUNNING SCRIPT
ERROR:tornado.application:Uncaught exception POST /start (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8080', method='POST', uri='/start', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tornado/web.py", line 1697, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "base_station_interface.py", line 172, in post
    self.send_program(bot, value)
  File "base_station_interface.py", line 235, in send_program
    func = function_map[match.group(2)]
KeyError: 'moave_forward'
ERROR:tornado.access:500 POST /start (127.0.0.1) 114.22ms

I suspect that this is because the base station, not the bot itself, encounters this error; to my knowledge, we don't have a way to communicate this back to the client yet.

A possible fix would be to check the server's response code and use that to show a message on the GUI.

Could not locate flask app

I found this issue while trying to recreate another issue. It was on a new clone in master and in a fresh virtual env - so I went through the steps of installation. See if anybody can reproduce or can suggest a solution.

================= MINIBOT CLIENT GUI =================
=========== STARTING BASESTATION ===============

  • Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.

[email protected] webpack
webpack

Webpack is watching the files…

  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
    Usage: flask run [OPTIONS]

Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.

webpack error

/Users/aarun/Desktop/cs-reminibot/static/gui/node_modules/webpack-cli/bin/cli.js:93
throw err;
^

TypeError: Cannot read property 'length' of undefined
at processConfiguredOptions (/Users/aarun/Desktop/cs-reminibot/static/gui/node_modules/webpack-cli/bin/utils/convert-argv.js:141:45)

No module pyaudio / unable to install pyaudio via pip on Windows native

Problem: pip install pyaudio does not work on Windows native + running the GUI results in a no module pyaudio error

Solution (manual installation, not automated yet):

  • Check Python version on your device
  • Download the corresponding .whl file for your Python version/32 vs 64bit from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio (for example, PyAudio‑0.2.11‑cp38‑cp38‑win_amd64.whl would be used for a device that's 64bit / python 3.8.x)
  • Place the .whl in Programs>python>python38 (or whatever you have)>scripts
  • Copy the filepath of the .whl file
  • run pip install [filepath from above]

If you run into the issue filename.whl is not supported wheel on this platform in the last step above, it is likely the result of one of two issues:

  • The .whl file doesn't match your python version
  • It isn't the right bit number (Note that 32 bit python can be run on 64 bit machines so make sure that isn't causing issues)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.