Skip to content
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

RL example: Platoon #1955

Merged
merged 35 commits into from
Apr 14, 2023
Merged

RL example: Platoon #1955

merged 35 commits into from
Apr 14, 2023

Conversation

Adaickalavan
Copy link
Member

  • Added baseline example, consisting of training, inference, and zoo agent registration, for the platooning task in Driving SMARTS 2023.3 benchmark.
  • Documented the challenge objective, desired inference code structure, and use of baseline example, for Driving SMARTS 2023.3 benchmark, i.e., platooning task.

Base automatically changed from driving-smarts-2023 to master April 11, 2023 17:24
docs/benchmarks/driving_smarts_2023_3.rst Outdated Show resolved Hide resolved
docs/benchmarks/driving_smarts_2023_3.rst Outdated Show resolved Hide resolved
docs/benchmarks/driving_smarts_2023_3.rst Outdated Show resolved Hide resolved
$ cd <path>/SMARTS
$ docker build --file=./examples/rl/platoon/train/Dockerfile --network=host --tag=platoon .
$ docker run --rm -it --network=host --gpus=all platoon
(container) $ cd /SMARTS/examples/rl/platoon
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth it to instead set WORKDIR /SMARTS/examples/rl/platoon at the end of the image?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the Dockerfile sets WORKDIR /SMARTS , which I try to make consistent across various dockerfiles. This helps when we have examples in different paths, as the dockerfile can be built similarly and we only need to alter the command issued.

I simply reiterated the full path here $ cd /SMARTS/examples/rl/platoon to avoid any confusion for the users.

agent_params = {
"top_down_rgb": interface.top_down_rgb,
"action_space_type": interface.action,
"num_stack": 3, # Number of frames to stack as input to policy network.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth it to integrate the frame stack as part of the agent interface? This seems to be a common case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we were to include frame stacking inside AgentInterface, we would then have to provide a standard way of stacking the observations. It may or may not fulfill the users' requirements. Users might only need selected (and/or processed) observations to be stacked, whereas our standard frame stacking would have stacked entire observations. Considering the endless possible user requirements, I guess it is better we leave it to the user.

Comment on lines +1 to +15
class ObjDict(dict):
def __getattr__(self, name):
if name in self:
return self[name]
else:
raise AttributeError("No such attribute: " + name)

def __setattr__(self, name, value):
self[name] = value

def __delattr__(self, name):
if name in self:
del self[name]
else:
raise AttributeError("No such attribute: " + name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fun I suppose, is this inspired by javascript?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is fun. ObjDict helps to access a key in a dictionary using . (similar to accessing attributes in a dataclass), instead of using string dict["key"]. I felt the former leads to nicer code and thus used it in the training script.

smarts/env/gymnasium/platoon_env.py Outdated Show resolved Hide resolved
docs/benchmarks/driving_smarts_2023_3.rst Outdated Show resolved Hide resolved
@Gamenot
Copy link
Collaborator

Gamenot commented Apr 12, 2023

Really only suggestions rather than requirements.

@Adaickalavan Adaickalavan merged commit 971446c into master Apr 14, 2023
@Adaickalavan Adaickalavan deleted the platoon-example branch April 14, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants