JackM323 b537677277 Complete Restructered Robot Code
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
2026-07-30 21:14:50 +02:00
2026-07-30 17:23:36 +02:00
2026-07-29 19:23:45 +02:00
2026-07-29 19:23:45 +02:00
2026-07-30 21:14:50 +02:00
2026-07-30 21:14:50 +02:00
2026-07-30 21:14:50 +02:00
2026-07-30 17:23:36 +02:00
2026-07-29 19:23:45 +02:00
2026-07-29 22:35:41 +02:00
2026-07-29 22:35:41 +02:00
2026-07-30 17:23:36 +02:00
2026-07-30 17:23:50 +02:00
2026-07-30 21:14:50 +02:00
2026-07-30 21:14:50 +02:00
2026-07-30 17:23:36 +02:00
2026-07-30 17:23:36 +02:00
2026-07-30 17:23:36 +02:00
2026-07-30 21:14:50 +02:00
2026-07-30 21:14:50 +02:00

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 pygame compatibility
  • Required Python packages:
    • numpy
    • pygame
    • ikpy
    • pybullet
    • pyserial
    • matplotlib

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 = True to enable PyBullet simulation
  • sim = False to use hardware control
  • arduinoConnection = True to use Arduino
  • arduinoConnection = False to use ESP32
  • port and baudrate for Arduino
  • esp32_ip and esp32_port for ESP32
  • urdf_path = "JackBotUrdf.urdf"

Project structure

  • main.py — main application entry point
  • Controller.py — Pygame-based controller and input display
  • kinematics.py — IKPy forward/inverse kinematics
  • simulation.py — PyBullet simulation wrapper
  • GlobalVariables.py — shared runtime state and comms
  • DataTypes.py — typed arrays and control intent
  • RobotState/idle.py — idle robot state
  • RobotState/walking.py — walking robot state
  • EspCommunication.py — ESP32 communication
  • ArduinoCommunication.py — Arduino communication
  • JackBotUrdf.urdf — robot model file

Notes

  • GlobalVariables.py initializes either Simulation() or the selected hardware comm class.
  • DataTypes.py declares PosArray, DegArray, RadArray, RobotCommand, and ControlIntent.
  • Controller.py updates gv.vector_dirmov and gv.robot_state from joystick input.
  • kinematics.py loads leg chains from JackBotUrdf.urdf and computes IK.

Troubleshooting

  • If pygame installation fails on Windows, use Python 3.12 and upgrade pip setuptools wheel first.
  • If python is not found on Windows, install Python and enable "Add Python to PATH".
  • If the program crashes on startup, verify JackBotUrdf.urdf path and config.py settings.

Suggested improvements

  • Add a requirements.txt or pyproject.toml.
  • Add a LICENSE file before sharing the project.
  • Document hardware wiring and packet formats for ESP32/Arduino.
S
Description
Running Hexapod to annoy my cat
Readme 2.6 MiB
Languages
Python 100%