当我学习教程 9 时,我对 rl_actions 感到困惑。因为在程序上,rl_actions是没有初始化和定义的。为什么 _apply_rl_actions 函数和 compute_reward 函数都有一个 'rl_actions' 参数?我还检查了车辆内核代码,关于 apply_acceleration 函数。原来的一个是:
def apply_acceleration(self, veh_ids, acc):
"""See parent class."""
# to hand the case of a single vehicle
if type(veh_ids) == str:
veh_ids = [veh_ids]
acc = [acc]
for i, vid in enumerate(veh_ids):
if acc[i] is not None and vid in self.get_ids():
this_vel = self.get_speed(vid)
next_vel = max([this_vel + acc[i] * self.sim_step, 0])
self.kernel_api.vehicle.slowDown(vid, next_vel, 1e-3)