cornell-cup / cs-reminibot Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
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?
PYTHONPATH=/home/pi/cs-reminibot python3 /home/pi/cs-reminibot/minibot/main.py
copy and paste and smash enter on dat terminal
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.
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.
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:
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):
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 reasonself.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 Problem: The web gui is blank and app.bundle.js is not found
Solution: For the first time running the basestation, navigate to static/gui and run "npm run webpack &" in cmd
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?
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):
bash ./run_BS.sh
python -m flask run
to start the GUI(If you get an error related to EOL, edit with Notepad++>Edit>EOL conversion)
On some Windows systems, attempting to start the base station, modify code, and perform a hard refresh on a browser does not show the new changes.
Problem: During "npm install" step, react@[email protected] gives out peer error about react dependency version
Solution: run "npm install --force" instead of npm install
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.
No. Don't like that. Fix please.
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 ===============
[email protected] webpack
webpack
Webpack is watching the files…
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.
/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)
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):
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:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.