Module moog.physics

Physics

The MOOG Environment class takes a moog.physics.physics keyword argument that satisfies the API defined in AbstractPhysics and implements forces on and continuous motion of sprites.

In this directory, the physics.py file contains a Physics class that composes forces, allows multiple updates per environment step, and is suitable for most tasks.

However, for maze-based environments please use the MazePhysics class in maze_physics.py, which constrains sprite motion to a gridworld maze. See the pacman.py for an example.

In this directory are also a variety of forces. These can be configured and combined to simulate many sprite dynamics, though, as with all MOOG components, your are welcome to implment custom forces if those provided are insufficient for your task. If you do so, be sure to inherit from AbstractNewtonianForce if your force is Newtonian or AbstractForce otherwise, both of which are in the abstract_force.py file.

Expand source code
""".. include:: README.md"""

from .abstract_force import AbstractForce
from .abstract_force import AbstractNewtonianForce
from .abstract_physics import AbstractPhysics
from .collisions import Collision
from .constant_speed import ConstantSpeed
from .distance_fn_force import DistanceForce
from .distance_fn_force import linear_force_fn
from .distance_fn_force import spring_force_fn
from .friction import Drag
from .friction import KineticFriction
from .gravity import DownGravity
from .gravity import Gravity
from .maze_walk import DeterministicMazeWalk
from .maze_walk import RandomMazeWalk
from .maze_physics import MazePhysics
from .physics import Physics
from .random_force import RandomForce
from .tether_physics import Tether
from .tether_physics import TetherZippedLayers

Sub-modules

moog.physics.abstract_force

Abstract force classes …

moog.physics.abstract_physics

Abstract physic class.

moog.physics.collisions

Collision forces …

moog.physics.constant_speed

Constant speed corrective physics …

moog.physics.distance_fn_force

Two-body distance-based forces.

moog.physics.friction

Friction forces …

moog.physics.gravity

Gravity forces.

moog.physics.maze_physics

Maze physics …

moog.physics.maze_walk

Maze walk classes …

moog.physics.physics

Physics class …

moog.physics.random_force

Random force.

moog.physics.tether_physics

Rigid tether physics …