-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gymnasium interface changes #228
base: dev
Are you sure you want to change the base?
Conversation
} | ||
|
||
# Define objects to initialize in the environment | ||
objects = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs some more engineering. Perhaps objects that do not have worlds yet? Please prepare a short discussion of this kind of problem for the next pycram meeting
|
||
# Define default parameters for each action | ||
default_params = { | ||
"navigate": {"target_pose": Pose(position=[1.0, 2.0, 0.0], orientation=[0.0, 0.0, 0.0, 1.0])}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be function points in my opinion and not key-value stores
:type reward_function: callable | ||
""" | ||
|
||
def __init__(self, actions, default_params=None, objects=None, reward_function=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use function points instead, talk with @Leusmann how to do so
calculations. | ||
|
||
:param actions: List of valid action classes or functions (e.g., [NavigateAction, PickUpAction]). | ||
:type actions: list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annotate types in the constructor, not in the docstring.
""" | ||
Resets the environment. | ||
|
||
:return: The initial state of the environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this docstring should be inherited from the super class
def _place(self, params): | ||
""" | ||
Places an object at a target location. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
types 👏 in 👏 the 👏 signature 👏
def _open(self, params): | ||
""" | ||
Opens an object (e.g., a drawer or door). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
types 👏 in 👏 the 👏 signature 👏
""" | ||
Closes an object (e.g., a drawer or door). | ||
|
||
:param params: Parameters for the close action, including "handle_desig" and "arm". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
types 👏 in 👏 the 👏 signature 👏
Resets the simulation environment dynamically by clearing the world and adding new objects. | ||
|
||
:param objects: List of objects to be added to the environment. | ||
:type objects: list[dict] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
types 👏 in 👏 the 👏 signature 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally the structure here is very repetitive with pycram designators, this should not be
@@ -0,0 +1,2 @@ | |||
from gymnasium_interface.pycram_gym_env import PyCRAMGymEnv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this relative imports
@@ -0,0 +1,54 @@ | |||
import logging | |||
from gymnasium_interface.pycram_gym_env import PyCRAMGymEnv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make these relative imports
from pycram.datastructures.pose import Pose | ||
|
||
# Configure logging | ||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the logging from pycram.ros.logging instead of the Python logging
Handles task execution in a PyCRAM environment. This class integrates with BulletWorld | ||
for managing objects and robot tasks in the simulation. | ||
|
||
Attributes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use rst syntax for the doc string
@@ -0,0 +1,178 @@ | |||
from pycram.worlds.bullet_world import BulletWorld | |||
from pycram.world_concepts.world_object import Object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relative imports
from typing import Dict, List, Union | ||
|
||
# Configure logging | ||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use logging from pycram.ros.logging
self.clear_world() | ||
|
||
# Reload the apartment URDF | ||
self.apartment = Object("apartment", "environment", "apartment.urdf") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ObjectType.ENVIRONMENT instead of the string
else: | ||
raise ValueError(f"Unknown action: {action}") | ||
|
||
def _navigate(self, params: Dict[str, Pose]) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you execute the action directly?
This pull request introduces the gymnasium_interface module, which includes the following files:
**- example.py: An example file for using the Gymnasium interface.
These files are added as part of integrating the Gymnasium interface into the existing PyCRAM system. The new module will allow interaction with Gym environments, enabling reinforcement learning and other task execution capabilities.
Additionally, I have ensured that only the necessary files related to the Gymnasium interface have been pushed, without including the entire dev branch.