Skip to content

Commit bc5e0ae

Browse files
committed
working setup
1 parent 867788e commit bc5e0ae

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

robot_nav/models/CNNTD3/att.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def train(
443443
# else:
444444
# bce_loss = torch.tensor(0.0, device=masked_weights.device)
445445

446-
bce_weight = 0.0
446+
bce_weight = 0.1
447447
av_critic_bce_loss.append(bce_loss)
448448

449449
critic_entropy_weight = 1 # or tuneable
@@ -473,7 +473,7 @@ def train(
473473
# else:
474474
# bce_loss = torch.tensor(0.0, device=masked_weights.device)
475475

476-
bce_weight = 0.0
476+
bce_weight = 0.1
477477
av_actor_bce_loss.append(bce_loss)
478478

479479
actor_Q, _, _, _, _, _ = self.critic(state, action)

robot_nav/multi_train2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def main(args=None):
5656
num_robots=sim.num_robots,
5757
device=device,
5858
save_every=save_every,
59-
load_model=True,
60-
model_name="phase2",
59+
load_model=False,
60+
model_name="phase1",
6161
load_model_name="phase1"
6262
) # instantiate a model
6363

robot_nav/sim2.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -249,23 +249,8 @@ def get_reward(goal, collision, action, closest_robots, distance):
249249
# return 2*action[0] - abs(action[1]) - cl_pen + r_dist
250250

251251
# phase1
252-
# if goal:
253-
# return 100.0
254-
# elif collision:
255-
# return -100.0
256-
# else:
257-
# r_dist = 1.5/distance
258-
# cl_pen = 0
259-
# for rob in closest_robots:
260-
# add = 1.5 - rob if rob < 1.5 else 0
261-
# cl_pen += add
262-
#
263-
# return action[0] - 0.5 * abs(action[1])-cl_pen + r_dist
264-
265-
266-
# phase2
267252
if goal:
268-
return 80.0
253+
return 100.0
269254
elif collision:
270255
return -100.0
271256
else:
@@ -275,5 +260,20 @@ def get_reward(goal, collision, action, closest_robots, distance):
275260
add = 1.5 - rob if rob < 1.5 else 0
276261
cl_pen += add
277262

278-
return -0.5*abs(action[1])-cl_pen
263+
return action[0] - 0.5 * abs(action[1])-cl_pen + r_dist
264+
265+
266+
# phase2
267+
# if goal:
268+
# return 80.0
269+
# elif collision:
270+
# return -100.0
271+
# else:
272+
# r_dist = 1.5/distance
273+
# cl_pen = 0
274+
# for rob in closest_robots:
275+
# add = 1.5 - rob if rob < 1.5 else 0
276+
# cl_pen += add
277+
#
278+
# return -0.5*abs(action[1])-cl_pen
279279

0 commit comments

Comments
 (0)