Skip to content

Commit

Permalink
added more params for webapp | removed accidental merge conflict relicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ReykCS committed Jan 29, 2023
1 parent 0391449 commit faf9ffb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 31 deletions.
12 changes: 11 additions & 1 deletion arena_bringup/launch/start_arena.launch
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,21 @@
<!-- FOR WEBAPP -->
<arg name="is_webapp_docker" default="false" />
<arg name="task_id" default="" />
<arg name="app_token" default="" />
<arg name="app_token_key" default="" />
<arg name="task_finished_url" default="" />

<param name="task_id" value="$(arg task_id)" />
<param name="app_token" value="$(arg app_token)" />
<param name="app_token_key" value="$(arg app_token_key)" />
<param name="task_finished_url" value="$(arg task_finished_url)" />

<node name="finished_task_publisher" type="finish_task_publisher" pkg="arena-utils" if="$(eval arg('is_webapp_docker') == true)" />
<node name="task_progress_publisher" type="task_progress_publisher.py" pkg="task_progress_publisher" if="$(eval arg('is_webapp_docker') == true)" />
<!-- -->

<arg name="desired_resets" default="2" />
<param name="desired_resets" value="$(arg desired_resets)" />


<!-- ___________ ARGS ___________ -->
<!-- You can launch a single robot and his local_planner with arguments -->
Expand Down
10 changes: 8 additions & 2 deletions arena_bringup/launch/start_training.launch
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
<!-- FOR WEBAPP -->
<arg name="is_webapp_docker" default="false" />
<arg name="task_id" default="" />
<arg name="app_token" default="" />
<arg name="app_token_key" default="" />
<arg name="task_finished_url" default="" />

<param name="task_id" value="$(arg task_id)" />
<param name="app_token" value="$(arg app_token)" />
<param name="app_token_key" value="$(arg app_token_key)" />
<param name="task_finished_url" value="$(arg task_finished_url)" />

<node name="finished_task_publisher" type="finish_task_publisher" pkg="arena-utils" if="$(eval arg('is_webapp_docker') == true)" />
<node name="task_progress_publisher" type="task_progress_publisher.py" pkg="arena-utils" if="$(eval arg('is_webapp_docker') == true)" />
<!-- -->


<arg name="model" default="burger" doc="model type [burger, jackal, ridgeback, agvota, rto, rto_real]"/>

<!-- Here are the argument that may be frequently changed -->
Expand Down
31 changes: 3 additions & 28 deletions training/scripts/train_agent.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
#!/usr/bin/env python
<<<<<<< HEAD
import sys, rospy, time
=======
from typing import Type, Union

import os, sys, rospy, time

from std_msgs.msg import Empty

from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import SubprocVecEnv, DummyVecEnv
from stable_baselines3.common.callbacks import (
EvalCallback,
StopTrainingOnRewardThreshold,
)
from stable_baselines3.common.policies import ActorCriticPolicy, BasePolicy
>>>>>>> dev

from rosnav.model.agent_factory import AgentFactory
from tools.argsparser import parse_training_args
from tools.general import *
Expand Down Expand Up @@ -61,6 +47,8 @@ def main():
eval_cb = init_callbacks(config, train_env, eval_env, PATHS)
model = get_ppo_instance(config, train_env, PATHS, AgentFactory)

rospy.on_shutdown(model.env.close())

# start training
start = time.time()
try:
Expand All @@ -72,30 +60,17 @@ def main():
except KeyboardInterrupt:
print("KeyboardInterrupt..")

<<<<<<< HEAD
rospy.on_shutdown(model.env.close())
print(f"Time passed: {time.time()-start}s. \n Training script will be terminated..")
=======
model.learn(
total_timesteps=n_timesteps,
callback=eval_cb,
reset_num_timesteps=True,
)

# update the timesteps the model has trained in total
# update_total_timesteps_json(n_timesteps, PATHS)
print(f"Time passed: {time.time()-start}s. \n Training script will be terminated..")

model.env.close()
print(f"Time passed: {time.time()-start}s")
print("Training script will be terminated")

publisher = rospy.Publisher("training_finished", Empty, queue_size=10)

for _ in range(10):
publisher.publish(Empty())
rospy.sleep(0.1)

>>>>>>> dev
sys.exit()


Expand Down

0 comments on commit faf9ffb

Please sign in to comment.