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 pathgenerator

With Windows Emulator

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

pip install pathgenerator[windows]

With Server

Install with the optional FastAPI server:

pip install pathgenerator[server]

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.1.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.1-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pathgenerator-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 9cfb774371cffd6930f7d15b6cae7a91dfde66d2a09c590d2016cfb32f7d198f
MD5 d0e6c33acf61cb31d5e3acac92e308b4
BLAKE2b-256 d889d166fa96c64bee2dd29a7052c82817b31f830a04276888c2bcd3371f5279

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pathgenerator-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f093e21ef03260e9f7521f2286993f2752a4128f85289e2b8b0e6ca656cab54
MD5 fc3a9ea149434dd6859ae7f1ef986c2c
BLAKE2b-256 49b3beffcd47338eb36df1937e98d4667140f67a36a3e263b00a8680624a59f3

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