tests.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:dynamic-walking 作者: stephane-caron 项目源码 文件源码
def test_discretization(nmpc, nb_steps):
    dT = nmpc.preview.dT
    pylab.ion()
    pylab.clf()
    ax = pylab.subplot(311)
    ax.set_color_cycle(['r', 'g', 'b'])
    pylab.plot(
        [sum(dT[:i]) for i in xrange(len(dT))],
        nmpc.preview.P, marker='o')
    pylab.plot(
        pylab.linspace(0., sum(dT), nb_steps + 1),
        [x[0:3] for x in nmpc.preview.discretize(nb_steps)],
        marker='s', linestyle='--')
    ax = pylab.subplot(312)
    ax.set_color_cycle(['r', 'g', 'b'])
    pylab.plot(
        [sum(dT[:i]) for i in xrange(len(dT))],
        nmpc.preview.V, marker='o')
    pylab.plot(
        pylab.linspace(0., sum(dT), nb_steps + 1),
        [x[3:6] for x in nmpc.preview.discretize(nb_steps)],
        marker='s', linestyle='--')
    ax = pylab.subplot(313)
    ax.set_color_cycle(['r', 'g', 'b'])
    pylab.plot(
        [sum(dT[:i]) for i in xrange(len(dT))],
        nmpc.preview.Z, marker='o')
    pylab.plot(
        pylab.linspace(0., sum(dT), nb_steps + 1),
        [x[6:9] for x in nmpc.preview.discretize(nb_steps)],
        marker='s', linestyle='--')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号