When running through a Jupyter notebook, it leaves the cozmo program running in the background, and that leads to clashes when you try to run a program more than once. You would need to restart the kernel between runs of cozmo.run_program. It would probably work better if there was a way to launch a notebook inside of a running cozmo thread like is done with ipython in the cli.py example, but I'm not sure if that would really be feasible. It'd also mean that your notebook wouldn't be portable to other people which would defeat the point.
I'd also note that it would still be rendered to an external window. If you were seeking to embed the viewer into the notebook that's most likely not possible. Jupyter renders in the browser, and the 3d viewer is using native OpenGL. Instead of using a viewer, It may be possible to render the camera feed to Jupyter because you can get raw frames with robot.add_event_handler(cozmo.world.EvtNewCameraImage, _callback_).
Not very well.
When running through a Jupyter notebook, it leaves the cozmo program running in the background, and that leads to clashes when you try to run a program more than once. You would need to restart the kernel between runs of
cozmo.run_program
. It would probably work better if there was a way to launch a notebook inside of a running cozmo thread like is done with ipython in thecli.py
example, but I'm not sure if that would really be feasible. It'd also mean that your notebook wouldn't be portable to other people which would defeat the point.I'd also note that it would still be rendered to an external window. If you were seeking to embed the viewer into the notebook that's most likely not possible. Jupyter renders in the browser, and the 3d viewer is using native OpenGL. Instead of using a viewer, It may be possible to render the camera feed to Jupyter because you can get raw frames with
robot.add_event_handler(cozmo.world.EvtNewCameraImage, _callback_)
.