Skip to content

Running the basic example fails #4

@fred-labs

Description

@fred-labs

After installing with:

python -m venv .venv
source .venv/bin/activate
pip install magbotsim

Running https://github.com/ubi-coro/MagBotSim#reinforcement-learning-example fails with.

TypeError: only 0-dimensional arrays can be converted to Python scalars

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user1/git/magbotsim/basic_example.py", line 20, in <module>
    observation, info = env.reset(seed=42)
                        ^^^^^^^^^^^^^^^^^^
  File "/home/user1/git/magbotsim/.venv/lib/python3.12/site-packages/gymnasium/wrappers/common.py", line 146, in reset
    return super().reset(seed=seed, options=options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user1/git/magbotsim/.venv/lib/python3.12/site-packages/gymnasium/core.py", line 333, in reset
    return self.env.reset(seed=seed, options=options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user1/git/magbotsim/.venv/lib/python3.12/site-packages/gymnasium/wrappers/common.py", line 400, in reset
    return super().reset(seed=seed, options=options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user1/git/magbotsim/.venv/lib/python3.12/site-packages/gymnasium/core.py", line 333, in reset
    return self.env.reset(seed=seed, options=options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user1/git/magbotsim/.venv/lib/python3.12/site-packages/gymnasium/wrappers/common.py", line 293, in reset
    return env_reset_passive_checker(self.env, seed=seed, options=options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user1/git/magbotsim/.venv/lib/python3.12/site-packages/gymnasium/utils/passive_env_checker.py", line 185, in env_reset_passive_checker
    result = env.reset(**kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/user1/git/magbotsim/.venv/lib/python3.12/site-packages/magbotsim/rl_envs/basic_single_agent_env.py", line 161, in reset
    info = self._get_info(
           ^^^^^^^^^^^^^^^
  File "/home/user1/git/magbotsim/.venv/lib/python3.12/site-packages/magbotsim/rl_envs/object_manipulation/pushing/state_based_global_pushing_env.py", line 1062, in _get_info
    info_dict['object_geoms'] = self._geoms(name='object')
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user1/git/magbotsim/.venv/lib/python3.12/site-packages/magbotsim/rl_envs/object_manipulation/pushing/state_based_global_pushing_env.py", line 1023, in _geoms
    geoms[geom_idx, 0] = getattr(geom.type, "value", geom.type)
    ~~~~~^^^^^^^^^^^^^
ValueError: setting an array element with a sequence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions