Skip to main content

Human-like mouse path generation using PD control

Project description

Path Generator

Tests Coverage

A Python library for generating human-like mouse paths using PD (Proportional-Derivative) control.

Installation

Core Library

Install the core library (only requires numpy):

pip install git+https://github.com/sockheadrps/Path-Generator.git

With Windows Emulator

Install with pywin32 for high-performance cursor emulation (Windows only):

pip install "pathgenerator[windows] @ git+https://github.com/sockheadrps/Path-Generator.git"

With Server

Install with the optional FastAPI server:

pip install "pathgenerator[server] @ git+https://github.com/sockheadrps/Path-Generator.git"

Usage

Human Motion Parameters

  • mouse_velocity: Base movement velocity (unitless, 0.1-1.0).
  • kp_start/kp_end: PD controller correction strength.

Generating Paths

from pathgenerator import PDPathGenerator

gen = PDPathGenerator()
path, progress, steps, params = gen.generate_path(
    start_x=100.0, start_y=100.0,
    end_x=1800.0, end_y=900.0,
    mouse_velocity=0.65,
    noise=2.6,
    offset_x=0, offset_y=0  # Optional viewport offset
)

Executing Paths (Windows Only)

Use the PathEmulator to execute paths using win32api.

from pathgenerator import PDPathGenerator, PathEmulator

# Initialize emulator (requires pip install pathgenerator[windows])
emulator = PathEmulator()

# Get current mouse position
start_x, start_y = emulator.get_position()

gen = PDPathGenerator()
path, *_ = gen.generate_path(start_x, start_y, 500, 500)

# Execute path
emulator.execute_path(path, delay_between_points=0.01)

Server

To run the playground server:

python -m pathgenerator.server

Visit http://127.0.0.1:8001 in your browser.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pathgenerator-0.1.0.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pathgenerator-0.1.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file pathgenerator-0.1.0.tar.gz.

File metadata

  • Download URL: pathgenerator-0.1.0.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pathgenerator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 606c82be9e18395c30b50a9be496c697326625078f77bec8f78f235d93d79d02
MD5 7e96cd436b99701d0268f8e81db90a21
BLAKE2b-256 cd78e53dc2e781865f43d4693975dcb1b1654eb95f3daaaf2a7a07c7ba225dbc

See more details on using hashes here.

File details

Details for the file pathgenerator-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pathgenerator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pathgenerator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dee8db54e1f8d4091b8aeac38b145948e5e65eeeb64ec6b90b2d316c0353e204
MD5 65beca545a0f873d79b07686ef424971
BLAKE2b-256 bd0baed203cf5df5330b6cdc74bfe591eeadf7ef892f32342933e52eec398395

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page