Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot save video in run_mpc.py file #2

Open
robopassio opened this issue May 7, 2021 · 0 comments
Open

Cannot save video in run_mpc.py file #2

robopassio opened this issue May 7, 2021 · 0 comments

Comments

@robopassio
Copy link

I can run the demo of run_deep_highmpc as well as saving the animation perfectly.
However, I cannot save the animation with the file run_mpc.py after uncommenting the following lines:

    # run_frame = partial(run_mpc, env)
    # ani = animation.FuncAnimation(sim_visual.fig, sim_visual.update, frames=run_frame,
    #         init_func=sim_visual.init_animate, interval=100, blit=True, repeat=False)
    
    # #
    # if args.save_video:
    #     writer = animation.writers["ffmpeg"]
    #     writer = writer(fps=10, metadata=dict(artist='Me'), bitrate=1800)
    #     ani.save("MPC_0.mp4", writer=writer)
    
    # plt.tight_layout()
    # plt.show()

The following error happened:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-d4934ae49ad0> in <module>
     21 writer = animation.writers["ffmpeg"]
     22 writer = writer(fps=10, metadata=dict(artist='Me'), bitrate=1800)
---> 23 ani.save("MPC_0.mp4", writer=writer)
     24 
     25 plt.tight_layout()

/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py in save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs, progress_callback)
   1147                 else:
   1148                     total_frames = sum(save_count_list)
-> 1149                 for data in zip(*[a.new_saved_frame_seq() for a in all_anim]):
   1150                     for anim, d in zip(all_anim, data):
   1151                         # TODO: See if turning off blit is really necessary

/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py in <listcomp>(.0)
   1147                 else:
   1148                     total_frames = sum(save_count_list)
-> 1149                 for data in zip(*[a.new_saved_frame_seq() for a in all_anim]):
   1150                     for anim, d in zip(all_anim, data):
   1151                         # TODO: See if turning off blit is really necessary

/usr/local/lib/python3.6/dist-packages/matplotlib/animation.py in new_saved_frame_seq(self)
   1704         else:
   1705             if self.save_count is not None:
-> 1706                 return itertools.islice(self.new_frame_seq(), self.save_count)
   1707 
   1708             else:

TypeError: 'NoneType' object is not iterable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant