Skip to content

Commit

Permalink
Merge pull request #9 from Arena-Rosnav/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
ReykCS authored Oct 13, 2022
2 parents 1af3a40 + 7669886 commit c11ad89
Show file tree
Hide file tree
Showing 20 changed files with 406 additions and 203 deletions.
Binary file added agents/jackal_marl/best_model.zip
Binary file not shown.
25 changes: 25 additions & 0 deletions agents/jackal_marl/hyperparameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"agent_name": "AGENT_24_2022_02_04__11_28",
"robot": "jackal",
"actions_in_observationspace": true,
"reward_fnc": "rule_06",
"discrete_action_space": false,
"normalize": false,
"task_mode": "staged",
"train_max_steps_per_episode": 400,
"eval_max_steps_per_episode": 1100,
"goal_radius": 0.7,
"curr_stage": 1,
"batch_size": 38400,
"gamma": 0.99,
"n_steps": 3200,
"ent_coef": 0.005,
"learning_rate": 0.0003,
"vf_coef": 0.22,
"max_grad_norm": 0.5,
"gae_lambda": 0.95,
"m_batch_size": 15,
"n_epochs": 3,
"clip_range": 0.22,
"observation_space": ["laser_scan", "goal_in_robot_frame", "last_action"]
}
47 changes: 24 additions & 23 deletions agents/new_jackal/hyperparameters.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"agent_name": "AGENT_24_2022_02_04__11_28",
"robot": "jackal",
"actions_in_observationspace": true,
"reward_fnc": "rule_05",
"discrete_action_space": false,
"normalize": false,
"task_mode": "staged",
"train_max_steps_per_episode": 150,
"eval_max_steps_per_episode": 200,
"goal_radius": 0.7,
"curr_stage": 8,
"batch_size": 19200,
"gamma": 0.99,
"n_steps": 4800,
"ent_coef": 0.005,
"learning_rate": 0.0003,
"vf_coef": 0.22,
"max_grad_norm": 0.5,
"gae_lambda": 0.95,
"m_batch_size": 15,
"n_epochs": 3,
"clip_range": 0.22
}
"agent_name": "AGENT_24_2022_02_04__11_28",
"robot": "jackal",
"actions_in_observationspace": true,
"reward_fnc": "rule_05",
"discrete_action_space": false,
"normalize": false,
"task_mode": "staged",
"train_max_steps_per_episode": 150,
"eval_max_steps_per_episode": 200,
"goal_radius": 0.7,
"curr_stage": 8,
"batch_size": 19200,
"gamma": 0.99,
"n_steps": 4800,
"ent_coef": 0.005,
"learning_rate": 0.0003,
"vf_coef": 0.22,
"max_grad_norm": 0.5,
"gae_lambda": 0.95,
"m_batch_size": 15,
"n_epochs": 3,
"clip_range": 0.22,
"observation_space": ["laser_scan", "goal_in_robot_frame", "last_action"]
}
Binary file added agents/ridgeback_marl/best_model.zip
Binary file not shown.
25 changes: 25 additions & 0 deletions agents/ridgeback_marl/hyperparameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"agent_name": "ridgeback_2022_09_20__15_37",
"robot": "myrobot",
"actions_in_observationspace": true,
"reward_fnc": "rule_06",
"discrete_action_space": false,
"normalize": false,
"task_mode": "staged",
"train_max_steps_per_episode": 800,
"eval_max_steps_per_episode": 1100,
"goal_radius": 0.7,
"curr_stage": 1,
"batch_size": 57600,
"gamma": 0.99,
"n_steps": 4800,
"ent_coef": 0.005,
"learning_rate": 0.0003,
"vf_coef": 0.22,
"max_grad_norm": 0.5,
"gae_lambda": 0.95,
"m_batch_size": 16,
"n_epochs": 3,
"clip_range": 0.22,
"observation_space": ["laser_scan", "goal_in_robot_frame", "last_action"]
}
47 changes: 24 additions & 23 deletions agents/rto_tlabs/hyperparameters.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"agent_name": "AGENT_24_2022_02_04__11_36",
"robot": "rto_real",
"actions_in_observationspace": true,
"reward_fnc": "rule_05",
"discrete_action_space": false,
"normalize": false,
"task_mode": "staged",
"train_max_steps_per_episode": 120,
"eval_max_steps_per_episode": 170,
"goal_radius": 0.7,
"curr_stage": 10,
"batch_size": 19200,
"gamma": 0.99,
"n_steps": 2400,
"ent_coef": 0.005,
"learning_rate": 0.0003,
"vf_coef": 0.22,
"max_grad_norm": 0.5,
"gae_lambda": 0.95,
"m_batch_size": 15,
"n_epochs": 3,
"clip_range": 0.22
}
"agent_name": "AGENT_24_2022_02_04__11_36",
"robot": "rto_real",
"actions_in_observationspace": true,
"reward_fnc": "rule_05",
"discrete_action_space": false,
"normalize": false,
"task_mode": "staged",
"train_max_steps_per_episode": 120,
"eval_max_steps_per_episode": 170,
"goal_radius": 0.7,
"curr_stage": 10,
"batch_size": 19200,
"gamma": 0.99,
"n_steps": 2400,
"ent_coef": 0.005,
"learning_rate": 0.0003,
"vf_coef": 0.22,
"max_grad_norm": 0.5,
"gae_lambda": 0.95,
"m_batch_size": 15,
"n_epochs": 3,
"clip_range": 0.22,
"observation_space": ["laser_scan", "goal_in_robot_frame", "last_action"]
}
Binary file added agents/rto_tlabs_marl/best_model.zip
Binary file not shown.
25 changes: 25 additions & 0 deletions agents/rto_tlabs_marl/hyperparameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"agent_name": "AGENT_24_2022_02_04__11_36",
"robot": "rto_real",
"actions_in_observationspace": true,
"reward_fnc": "rule_06",
"discrete_action_space": false,
"normalize": false,
"task_mode": "staged",
"train_max_steps_per_episode": 400,
"eval_max_steps_per_episode": 1100,
"goal_radius": 0.7,
"curr_stage": 1,
"batch_size": 38400,
"gamma": 0.99,
"n_steps": 3200,
"ent_coef": 0.005,
"learning_rate": 0.0003,
"vf_coef": 0.22,
"max_grad_norm": 0.5,
"gae_lambda": 0.95,
"m_batch_size": 15,
"n_epochs": 3,
"clip_range": 0.22,
"observation_space": ["laser_scan", "goal_in_robot_frame", "last_action"]
}
8 changes: 5 additions & 3 deletions rosnav/model/agent_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,23 @@ def inner_wrapper(wrapped_class) -> Callable:
# end register()

@classmethod
def instantiate(cls, name: str, **kwargs) -> Union[Type[BaseAgent], Type[BasePolicy]]:
def instantiate(
cls, name: str, **kwargs
) -> Union[Type[BaseAgent], Type[BasePolicy]]:
"""Factory command to create the agent.
This method gets the appropriate agent class from the registry
and creates an instance of it, while passing in the parameters
given in ``kwargs``.
Args:
name (str): The name of the agent to create.
name (str): The name of the agent to create.agent_class
Returns:
An instance of the agent that is created.
"""
assert name in cls.registry, f"Agent '{name}' is not registered!"
agent_class = cls.registry[name]

if issubclass(agent_class, BaseAgent):
return agent_class(**kwargs)
else:
Expand Down
19 changes: 11 additions & 8 deletions rosnav/model/base_agent.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Type, List

from abc import ABC, abstractmethod
from enum import Enum
from torch.nn.modules.module import Module
from typing import List, Type

from stable_baselines3.common.torch_layers import BaseFeaturesExtractor
from torch.nn.modules.module import Module


class PolicyType(Enum):
Expand Down Expand Up @@ -47,14 +47,17 @@ def activation_fn(self) -> Type[Module]:
pass

def get_kwargs(self):
fe_kwargs = self.features_extractor_kwargs
fe_kwargs["robot_model"] = self.robot_model

kwargs = {
"features_extractor_class": self.features_extractor_class,
"features_extractor_kwargs": self.features_extractor_kwargs,
"features_extractor_kwargs": fe_kwargs,
"net_arch": self.net_arch,
"activation_fn": self.activation_fn,
}
if not kwargs['features_extractor_class']:
del kwargs['features_extractor_class']
if not kwargs['features_extractor_kwargs']:
del kwargs['features_extractor_kwargs']
if not kwargs["features_extractor_class"]:
del kwargs["features_extractor_class"]
if not kwargs["features_extractor_kwargs"]:
del kwargs["features_extractor_kwargs"]
return kwargs
47 changes: 46 additions & 1 deletion rosnav/model/custom_sb3_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class AGENT_6(BaseAgent):
net_arch = [128, 64, 64, dict(pi=[64, 64], vf=[64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_7")
class AGENT_7(BaseAgent):
Expand All @@ -23,6 +26,9 @@ class AGENT_7(BaseAgent):
net_arch = [128, 128, 128, dict(pi=[64, 64], vf=[64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_8")
class AGENT_8(BaseAgent):
Expand All @@ -32,6 +38,9 @@ class AGENT_8(BaseAgent):
net_arch = [64, 64, 64, 64, dict(pi=[64, 64], vf=[64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_9")
class AGENT_9(BaseAgent):
Expand All @@ -41,6 +50,9 @@ class AGENT_9(BaseAgent):
net_arch = [64, 64, 64, 64, dict(pi=[64, 64, 64], vf=[64, 64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_10")
class AGENT_10(BaseAgent):
Expand All @@ -50,6 +62,9 @@ class AGENT_10(BaseAgent):
net_arch = [128, 128, 128, 128, dict(pi=[64, 64, 64], vf=[64, 64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_11")
class AGENT_11(BaseAgent):
Expand All @@ -59,6 +74,9 @@ class AGENT_11(BaseAgent):
net_arch = [512, 512, 512, 512, dict(pi=[64, 64], vf=[64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_17")
class AGENT_17(BaseAgent):
Expand All @@ -68,6 +86,9 @@ class AGENT_17(BaseAgent):
net_arch = [dict(pi=[64, 64, 64], vf=[64, 64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_18")
class AGENT_18(BaseAgent):
Expand All @@ -77,6 +98,9 @@ class AGENT_18(BaseAgent):
net_arch = [128, dict(pi=[64, 64, 64], vf=[64, 64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_19")
class AGENT_19(BaseAgent):
Expand All @@ -86,6 +110,9 @@ class AGENT_19(BaseAgent):
net_arch = [dict(pi=[64, 64], vf=[64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_20")
class AGENT_20(BaseAgent):
Expand All @@ -95,6 +122,9 @@ class AGENT_20(BaseAgent):
net_arch = [dict(pi=[128], vf=[128])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_21")
class AGENT_21(BaseAgent):
Expand All @@ -104,6 +134,9 @@ class AGENT_21(BaseAgent):
net_arch = [dict(pi=[64, 64], vf=[64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_22")
class AGENT_22(BaseAgent):
Expand All @@ -113,6 +146,9 @@ class AGENT_22(BaseAgent):
net_arch = [dict(pi=[64, 64, 64], vf=[64, 64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_23")
class AGENT_23(BaseAgent):
Expand All @@ -122,6 +158,9 @@ class AGENT_23(BaseAgent):
net_arch = [128, dict(pi=[64, 64, 64], vf=[64, 64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_24")
class AGENT_24(BaseAgent):
Expand All @@ -131,11 +170,17 @@ class AGENT_24(BaseAgent):
net_arch = [128, dict(pi=[64, 64], vf=[64, 64])]
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model


@AgentFactory.register("AGENT_25")
class AGENT_25(BaseAgent):
type = PolicyType.MLP
features_extractor_class = None
features_extractor_kwargs = None
net_arch = [512, 256, dict(pi=[128], vf=[128])]
activation_fn = nn.ReLU
activation_fn = nn.ReLU

def __init__(self, robot_model: str = None):
self.robot_model = robot_model
Loading

0 comments on commit c11ad89

Please sign in to comment.