Skip to content

Commit

Permalink
send task progress messages only once when in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
ReykCS committed Feb 13, 2023
1 parent bdcdd9c commit 80117c5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
5 changes: 4 additions & 1 deletion task_generator/robot_setup/rosnav_agents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ robots:
- model: jackal
planner: rosnav
amount: 3
agent: new_jackal
agent: jackal
- model: rto
planner: teb
amount: 3
# - model: jackal
# planner: rosnav
# amount: 1
Expand Down
9 changes: 5 additions & 4 deletions task_generator/scripts/task_generator_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ def _send_end_message_on_end(self, is_end):

rospy.loginfo("Shutting down. All tasks completed")

# Send this message 10 times to make sure it is received
for _ in range(10):
self.pub_scenario_finished.publish(Bool(True))
# Send Task finished to Backend
if rospy.get_param("/is_webapp_docker", False):
while self.pub_scenario_finished.get_num_connections() <= 0:
pass

rospy.sleep(0.1)
self.pub_scenario_finished.publish(Empty())

rospy.signal_shutdown("Finished all episodes of the current scenario")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, namespace):

self._goal_pub = rospy.Publisher(self._ns_prefix("/goal"), PoseStamped, queue_size=1, latch=True)

self._robot_name = rospy.get_param("robot_model")
self._robot_name = rospy.get_param("robot_model", "")

rospy.wait_for_service("/gazebo/spawn_urdf_model")
rospy.wait_for_service("/gazebo/set_model_state")
Expand Down
10 changes: 7 additions & 3 deletions training/scripts/train_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,15 @@ def main():

model.env.close()

publisher = rospy.Publisher("training_finished", Empty, queue_size=10)
# Send Task finished to Backend
if rospy.get_param("/is_webapp_docker", False):
publisher = rospy.Publisher("training_finished", Empty, queue_size=10)

while publisher.get_num_connections() <= 0:
pass

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


sys.exit()

Expand Down

0 comments on commit 80117c5

Please sign in to comment.