14 lines
364 B
Python
14 lines
364 B
Python
import numpy as np
|
|
|
|
class ConstantVelocityPolicy:
|
|
def __init__(self, target_speed=50):
|
|
self.step_num = 0
|
|
|
|
def act(self):
|
|
self.step_num += 1
|
|
# 简单的前进策略:直行 + 较大油门
|
|
steering = 0.0 # 直行
|
|
throttle = 0.5 # 中等油门,让车辆有明显运动
|
|
|
|
return [steering, throttle]
|