anki / cozmo-python-sdk

Anki Cozmo Python SDK
Other
661 stars 427 forks source link

can I use the viewer or 3d_viewer on Jupyter notebook?? #184

Closed rocknamx8 closed 6 years ago

shawnblakesley commented 6 years ago

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 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_).