Skip to main content

Magentic robotics simulation including reinforcement learning environments based on MuJoCo

Project description

MagBotSim (Magnetic Robotics Simulation)

MagBotSim is a library for physics-based simulation environments for motion planning and object manipulation in the field of magnetic robotics. The main component of every environment is a magnetic levitation (MagLev) system, which consists of two basic components, as shown in the Figure above. Firstly, dynamically actuated shuttles as passive motor modules, so-called movers, consist of a housing and a complex permanent magnet structure based on Halbach arrays on the lower side of the mover. Secondly, static motor modules, so-called tiles, are the active component of the drive system. As shown in the Figure above, the tiles enable the coil-induced emission of electromagnetic fields (yellow) that interact with the mover's field (blue). During operation, the movers hover above the tiles and can be controlled in six dimensions by adjusting the currents in the coils contained in the tiles.

MagBotSim is designed to match real-world applications, so that control policies can be transferred to real MagLev systems without further training or calibration. Since the library is based on the MuJoCo physics engine, MagBotSim enables users to perform object manipulation tasks with MagLev systems. In addition, as reinforcement learning (RL) is frequently used in multi-agent path finding and object manipulation, MagBotSim includes basic environments with single-agent (Gymnasium) and multi-agent (PettingZoo Parallel API) RL APIs that can serve as starting points for developing new research-specific environments. However, MagBotSim can also be used without RL and provides several utilities, such as impedance control for the movers.

Installation

The MagBotSim package can be installed via PIP:

pip install magbotsim

To install optional dependencies, to build the documentation, or to run the tests, use:

pip install magbotsim[docs, tests]

Note: Depending on your shell (e.g. when using Zsh), you may need to use additional quotation marks:

pip install "magbotsim[docs, tests]"

Documentation

The documentation is available at: https://ubi-coro.github.io/MagBotSim/

License

MagBotSim is published under the GNU General Public License v3.0.

Reinforcement Learning Example

The following example shows how to use a trained policy with an environment that follows the Gymnasium API:

import gymnasium as gym
import magbotsim

gym.register_envs(magbotsim)

mover_params = {
    'shape': 'mesh',
    'mesh': {'mover_stl_path': 'beckhoff_apm4220_mover', 'bumper_stl_path': 'beckhoff_apm4220_bumper'},
    'mass': 0.639 - 0.034,
    'bumper_mass': 0.034,
}
env_kwargs = {
    'mover_params': mover_params,
    'initial_mover_zpos': 0.002,
    'render_mode': 'human',
    'render_every_cycle': True,
}

env = gym.make("StateBasedPushTEnv-v0", **env_kwargs)
observation, info = env.reset(seed=42)

for _ in range(0,100):
    terminated, truncated = False, False
    while not terminated and not truncated:
        action = env.action_space.sample()  # use custom policy instead
        observation, reward, terminated, truncated, info = env.step(action)

    observation, info = env.reset()
env.close()

Maintainer

MagBotSim is currently maintained by Lara Bergmann (@lbergmann1).

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

magbotsim-1.0.0.tar.gz (7.4 MB view details)

Uploaded Source

Built Distribution

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

magbotsim-1.0.0-py3-none-any.whl (7.5 MB view details)

Uploaded Python 3

File details

Details for the file magbotsim-1.0.0.tar.gz.

File metadata

  • Download URL: magbotsim-1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for magbotsim-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cbb82b9ca1b826e6e90db3b6b353b539667ccaedfe1acf57d4f8688be0e53388
MD5 e34fe801fdf0fc4e91f36a8a18f538b7
BLAKE2b-256 4a1bbcf18a0e7910b2ced4564d7e7a7467602571574a18d34723c41d301121c5

See more details on using hashes here.

File details

Details for the file magbotsim-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: magbotsim-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for magbotsim-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87e74c1fc869875ac340f3257703b5b24aca928b386ff607b806f2ff235fe922
MD5 73c1ceb32badf36d206bd871a9ca827d
BLAKE2b-256 fcf976df5a5e80d4d37867408c67048513085a5646aa3c8f8c6c61e19358fc73

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