Skip to content

Commit 80117c5

Browse files
committed
send task progress messages only once when in docker
1 parent bdcdd9c commit 80117c5

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

task_generator/robot_setup/rosnav_agents.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ robots:
1212
- model: jackal
1313
planner: rosnav
1414
amount: 3
15-
agent: new_jackal
15+
agent: jackal
16+
- model: rto
17+
planner: teb
18+
amount: 3
1619
# - model: jackal
1720
# planner: rosnav
1821
# amount: 1

task_generator/scripts/task_generator_node.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,12 @@ def _send_end_message_on_end(self, is_end):
106106

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

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

113-
rospy.sleep(0.1)
114+
self.pub_scenario_finished.publish(Empty())
114115

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

task_generator/task_generator/simulators/gazebo_simulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, namespace):
2828

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

31-
self._robot_name = rospy.get_param("robot_model")
31+
self._robot_name = rospy.get_param("robot_model", "")
3232

3333
rospy.wait_for_service("/gazebo/spawn_urdf_model")
3434
rospy.wait_for_service("/gazebo/set_model_state")

training/scripts/train_agent.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,15 @@ def main():
7474

7575
model.env.close()
7676

77-
publisher = rospy.Publisher("training_finished", Empty, queue_size=10)
77+
# Send Task finished to Backend
78+
if rospy.get_param("/is_webapp_docker", False):
79+
publisher = rospy.Publisher("training_finished", Empty, queue_size=10)
80+
81+
while publisher.get_num_connections() <= 0:
82+
pass
7883

79-
for _ in range(10):
8084
publisher.publish(Empty())
81-
rospy.sleep(0.1)
85+
8286

8387
sys.exit()
8488

0 commit comments

Comments
 (0)