high_mpc
high_mpc copied to clipboard
Cannot save video in run_mpc.py file
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