b5376772773d899d0c29c0d6c1e75adfc9c42cad
Robot into its own Class instead of lose Global Variables that cause circular imports StateClass usage instead of the old RobotState.py New Input Class for Controller and randome intputs
JackBot — Hexapod Control & Simulation
JackBot is a Python project for controlling and simulating a six-legged hexapod robot. It uses IKPy for inverse kinematics, PyBullet for optional simulation, and can send joint commands to ESP32 or Arduino hardware.
Requirements
- Python 3.12 is safest for
pygamecompatibility - Required Python packages:
numpypygameikpypybulletpyserialmatplotlib
Setup
Linux (Bash)
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
Windows (PowerShell)
python3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
If PowerShell blocks activation:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned
.\.venv\Scripts\Activate.ps1
Run
From the repository root:
python main.py
If Linux breaks with
ExampleBrowserThreadFunc started
X11 functions dynamically loaded using dlopen/dlsym OK!
cannot connect to X server
run:
export DISPLAY=:0
python main.py
Configuration
Edit config.py before running:
sim = Trueto enable PyBullet simulationsim = Falseto use hardware controlarduinoConnection = Trueto use ArduinoarduinoConnection = Falseto use ESP32portandbaudratefor Arduinoesp32_ipandesp32_portfor ESP32urdf_path = "JackBotUrdf.urdf"
Project structure
main.py— main application entry pointController.py— Pygame-based controller and input displaykinematics.py— IKPy forward/inverse kinematicssimulation.py— PyBullet simulation wrapperGlobalVariables.py— shared runtime state and commsDataTypes.py— typed arrays and control intentRobotState/idle.py— idle robot stateRobotState/walking.py— walking robot stateEspCommunication.py— ESP32 communicationArduinoCommunication.py— Arduino communicationJackBotUrdf.urdf— robot model file
Notes
GlobalVariables.pyinitializes eitherSimulation()or the selected hardware comm class.DataTypes.pydeclaresPosArray,DegArray,RadArray,RobotCommand, andControlIntent.Controller.pyupdatesgv.vector_dirmovandgv.robot_statefrom joystick input.kinematics.pyloads leg chains fromJackBotUrdf.urdfand computes IK.
Troubleshooting
- If
pygameinstallation fails on Windows, use Python 3.12 and upgradepip setuptools wheelfirst. - If
pythonis not found on Windows, install Python and enable "Add Python to PATH". - If the program crashes on startup, verify
JackBotUrdf.urdfpath andconfig.pysettings.
Suggested improvements
- Add a
requirements.txtorpyproject.toml. - Add a
LICENSEfile before sharing the project. - Document hardware wiring and packet formats for ESP32/Arduino.
Description
Languages
Python
100%