/chasing-targets-gym

Primary LanguagePythonMIT LicenseMIT

Chasing Targets Gym

PyPI - Package Version PyPI - Python Version PyPI - License codestyle

Introduction

This is a simple gym environment that sets up a set of robots and targets for them to chase. These targets are dumb, they simply move at a constant speed and bounce off the "limits" of the simulation environment. The intention is that the robots will chase after these targets, and switch to a new target after catching their current one. The targets are "transparent" and robots are free to ignore "avoiding them", the intention is that they avoid each other. An example of a simulation with robot controller is shown below.

misc/example_sim.gif

Usage

Since this uses the gymnasium, you can spin an environment up same as any other env, and you can use our optimized planner. A script is included that shows of this planner and environment when you install this library `chasing-targets-example --max-step=500`.

from gymnasium import Env, make
from chasing_targets_gym.planner import Planner

env: Env = make(
    "ChasingTargets-v0",
    render_mode="human",
    n_robots=10,
    n_targets=3,
    robot_radius=0.1,
    max_velocity=0.5,
    target_velocity_std=0.5,
    max_episode_steps=1000,
)

planner = Planner(
    env.get_wrapper_attr("robot_radius"),
    env.get_wrapper_attr("dt"),
    env.get_wrapper_attr("max_velocity"),
)

Installation

Either you can clone and pip install the source, or you can install via pypi.

git clone https://github.com/5had3z/chasing-targets-gym && cd chasing-targets-gym && pip3 install -e .

Otherwise install pypi package

pip3 install chasing-targets-gym

Some Credit

I was pointed to a basic environment here but it didn't really match what I wanted, so I made my own based off this.