Skip to content

MrRoush/robotics-github-classroom-program

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

41 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Robotics Classroom Program

A polished, browser-based coding environment for high-school introductory robotics courses.
No installation. No admin passwords. No server required. Just open index.html in any browser.


โœจ Features

Feature Details
๐Ÿงฉ Visual Blockly Editor Drag-and-drop blocks with simplified, student-friendly Dobot commands
๐Ÿ Python Editor Full-featured Monaco editor (VS Code engine) with syntax highlighting
โšก Event Sheet "When [Event] โ†’ Do [Action]" visual programming like Construct/GDevelop
๐Ÿค– Robot Simulator On-screen animated robot arm to visualize programs before running
๐Ÿ”— GitHub Classroom Auto-pull assignments, save & push code โ€” all via GitHub API
๐Ÿ‘ฉโ€๐Ÿซ Teacher Dashboard View all student repos, track progress, open any student's code
๐ŸŽฎ VEX Upload Drag & drop VEX blocks or Python files directly to GitHub repos
๐Ÿง  AI Robot Blocks Color detection, object detection, face detection, line-following

๐Ÿš€ Getting Started (Students)

Step 1 โ€” Open the App

Option A (Recommended): Double-click index.html to open it in your browser.
Option B: Open any browser and go to File โ†’ Open File โ†’ index.html.

๐Ÿ’ก No download, no installation, no admin password needed!

Step 2 โ€” Get a GitHub Token

  1. Go to github.com/settings/tokens/new
  2. Give it a name like "Robotics Class"
  3. Check repo and read:org scopes
  4. Click Generate token and copy the token (starts with ghp_)

Step 3 โ€” Sign In

  1. Paste your token into the login screen
  2. Select Student or Teacher role
  3. Click Connect & Enter ๐Ÿš€

๐Ÿ’ป Using the Code Editor

The editor has three coding modes โ€” switch between them with the tabs at the top:

๐Ÿงฉ Visual Blocks (Blockly)

  • Drag blocks from the left panel into the workspace
  • Categories: Movement, Gripper, Speed, Actions, AI Features, VEX Robot, Control, Numbers
  • Click Generate Python to convert your blocks to Python code

๐Ÿ Python Code

  • Full Python editor powered by Monaco (VS Code engine)
  • Syntax highlighting, autocomplete, and line numbers
  • Press Ctrl+S to save directly to GitHub

โšก Event Sheet

  • Click Add Event to choose what triggers your code (button press, timer, AI detectionโ€ฆ)
  • Click Add Action to choose what the robot does
  • Click Generate Python to see the equivalent Python code

๐Ÿค– Supported Robots

Robot Blocks Python AI Features
Dobot Magician โœ… โœ… โž–
Dobot AI Starter โœ… โœ… โœ… Color, Object, Face, Line
Dobot Magician + AI Kit โœ… โœ… โœ… Full AI suite
VEX IQ / V5 โœ… โœ… โž–

Simplified Robot Commands (for beginners)

Instead of complex coordinate commands, students use plain-English blocks:

Block What it does
Move Forward 50 mm Move the arm toward you
Move Up 20 mm Raise the arm
Grab (Suction ON) Pick up an object using suction
Release Let go of the object
Set Speed: Slow Make movements slow and safe
Wait 1 seconds Pause before the next step
AI: Detect Color Use the camera to see what color an object is

๐Ÿ”— GitHub Classroom Integration

Students

  • View assignments on the Dashboard โ€” all your GitHub repos appear automatically
  • Open a repo โ†’ browse files โ†’ open and edit code
  • Save with Ctrl+S โ†’ your code is pushed to GitHub instantly
  • No git commands needed โ€” everything is automatic

Teachers

  • Switch to Teacher role when logging in
  • Go to Student Progress to select your classroom (GitHub Organization)
  • See all student repos, last-updated time, and open any repo to review code
  • Click View Code on any student to open their repo in the editor

๐ŸŽฎ VEX Upload

  1. Go to VEX Upload in the sidebar
  2. Enter the target repository (username/repo-name)
  3. Drag & drop your VEX file (.vex, .v5python, .py)
  4. Click Upload to GitHub โ€” done!

Supported VEX file types: .vex, .v5python, .py, .txt, .xml


๐Ÿ Running Code on a Real Robot

The visual editor generates Python code you can run on a real Dobot in two ways:

Option A โ€” Local Bridge (Recommended): Run from the Browser

The Local Bridge lets you click a button in the web IDE and have code execute on the robot immediately โ€” no terminal required.

Step 1 โ€” Install bridge dependencies

pip install -r requirements-bridge.txt
# or manually:
pip install flask flask-socketio pydobot pyserial

Step 2 โ€” Start the bridge

python bridge.py

You should see:

====================================================
  Robotics Classroom โ€” Local Bridge
  Listening on  http://127.0.0.1:5000
  Press Ctrl+C to stop
====================================================

Step 3 โ€” Connect from the IDE

  1. Open the IDE and navigate to the Editor view.
  2. Click ๐Ÿ”Œ Connect to Bridge in the toolbar.
  3. The button turns green when connected.
  4. Write or generate your Python code.
  5. Click ๐Ÿค– Run on Robot โ€” output streams live into the Robot Terminal panel.

โน Stop: Click the Stop button in the terminal header to terminate the program at any time.

Browser compatibility note

The bridge connects via ws://127.0.0.1:5000 even when the IDE is served from an HTTPS host like GitHub Pages. Modern browsers permit this because 127.0.0.1 is treated as a secure context:

  • Chrome 94+ / Edge: Allowed. The bridge also sends Access-Control-Allow-Private-Network: true to satisfy Chrome's Private Network Access preflight.
  • Firefox: Allowed โ€” no special action needed.
  • Safari: May block. Enable Develop โ†’ Disable Cross-Origin Restrictions in Safari's menu bar, or open the IDE locally over HTTP.

Option B โ€” Manual: Download and Run in Terminal

Save your .py file from the editor and run it:

pip install pydobot
python my_program.py

If no robot is connected, the wrapper runs in simulation mode and prints every command โ€” great for testing at home!

Requirements for real robot

  • Windows 10/11 (Dobot USB driver)
  • Python 3.8+
  • pip install pydobot pyserial
  • Dobot Magician USB cable connected

๐Ÿ“ Project Structure

robotics-github-classroom-program/
โ”œโ”€โ”€ index.html              โ† Open this in your browser!
โ”œโ”€โ”€ bridge.py               โ† Local Python bridge server (run to control real robot)
โ”œโ”€โ”€ requirements-bridge.txt โ† Python deps for bridge.py
โ”œโ”€โ”€ css/
โ”‚   โ””โ”€โ”€ styles.css          โ† All styling
โ”œโ”€โ”€ js/
โ”‚   โ”œโ”€โ”€ app.js              โ† Main application controller
โ”‚   โ”œโ”€โ”€ bridge.js           โ† Local bridge WebSocket client
โ”‚   โ”œโ”€โ”€ github-api.js       โ† GitHub API integration
โ”‚   โ”œโ”€โ”€ blockly-setup.js    โ† Blockly + Dobot custom blocks
โ”‚   โ”œโ”€โ”€ event-sheet.js      โ† Event sheet coding interface
โ”‚   โ””โ”€โ”€ robot-simulator.js  โ† On-screen robot simulator
โ”œโ”€โ”€ dobot_wrapper/
โ”‚   โ”œโ”€โ”€ __init__.py         โ† Python package entry point
โ”‚   โ””โ”€โ”€ robot.py            โ† DobotRobot class (simplified API)
โ””โ”€โ”€ examples/
    โ”œโ”€โ”€ 01_basic_movements.py
    โ”œโ”€โ”€ 02_pick_and_place_loop.py
    โ”œโ”€โ”€ 03_ai_color_sorting.py
    โ””โ”€โ”€ 04_vex_basic_drive.py

๐Ÿ”’ Security & Privacy

  • Your GitHub token is stored only in your browser's localStorage โ€” never sent to any server
  • All GitHub API calls go directly from your browser to api.github.com
  • The local bridge never receives GitHub tokens โ€” it only receives Python code for execution
  • The bridge binds to 127.0.0.1 only โ€” not accessible from outside your computer
  • No data is collected or stored anywhere else

๐Ÿ› ๏ธ Troubleshooting

Problem Solution
Blockly doesn't load Check internet connection (needed to load Blockly from CDN)
"Login Failed" Check your GitHub token has repo scope
Can't see assignments Make sure you're a member of the GitHub Classroom organization
Monaco editor not loading Check internet connection; a fallback text editor will be used instead
File not saving Make sure your token has repo (write) permission
"Bridge Not Found" Make sure python bridge.py is running on your computer
Bridge connects but robot doesn't move Check the COM port in Settings matches your robot's actual port
Bridge works on Chrome but not Safari Enable Develop โ†’ Disable Cross-Origin Restrictions in Safari

๐Ÿ“š Example Programs

See the examples/ folder:

  • 01_basic_movements.py โ€” Introduction to robot movements
  • 02_pick_and_place_loop.py โ€” Using loops to move multiple objects
  • 03_ai_color_sorting.py โ€” AI-powered color detection and sorting
  • 04_vex_basic_drive.py โ€” VEX V5 driving in a square

๐Ÿซ For Teachers โ€” Setting Up GitHub Classroom

  1. Create a GitHub Organization for your class (e.g., mr-smith-robotics-2025)
  2. Go to classroom.github.com and create a classroom
  3. Create assignments โ€” each student gets their own repo automatically
  4. Students use this app to log in, see their repos, and code right away
  5. Teachers can monitor all student repos from the Student Progress dashboard

Built for introductory robotics โ€” simple enough for day one, powerful enough for advanced projects.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors