You know some birds are not meant to be caged, their feathers are just too bright.
你知道有些鸟儿是注定不会被关在牢笼里的,它们的每一片羽毛都闪耀着自由的光辉。--Shawshank Redemption 肖申克的救赎
🏰代码及环境配置:请参考 https://www.helloxiaobai.cn/article/bmp
本节提供了自行车模型的代码测试.
python3 tests/basic/kinematic_test.py
1.1.c.1 自行车模型实现
以后轴中心为参考点的自行车模型状态转移函数如下,更新了distance距离之后的状态
def bicycle_model(point, distance):
next_point = copy.deepcopy(point)
next_point.x += distance * cos(point.theta)
next_point.y += distance * sin(point.theta)
next_point.theta += normallization(distance * tan(point.steer) / WHEEL_BASE)
return next_point
tests\basic\kinematic_test.py
调用了这个函数,展示了模型效果
1.1.c.2 代码测试
(1)前轮偏角固定,车辆走出一道圆弧:
for t in np.arange(0, total_t, delta_t):
new_p = bicycle_model(points[-1], points[-1].v * delta_t)
points.append(new_p)
(2)前轮偏角逐渐变化:
for t in np.arange(0, total_t, delta_t):
new_p = points[-1]
if t < 3:
new_p.steer = max(new_p.steer - 0.01, -MAX_STEER)
else:
new_p.steer = min(new_p.steer + 0.02, MAX_STEER)
new_p = bicycle_model(new_p, new_p.v * delta_t)
points.append(new_p)
🏎️自动驾驶小白说官网:https://www.helloxiaobai.cn
🐮GitHub代码仓:https://github.com/Hello-Xiao-Bai/Planning-XiaoBai!
🌠代码配合官网教程食用更佳!
🚀知乎,微信,知识星球全平台同号!