Having got a thing together that lets me use some magic to load a V-REP robot simulator scene, connect to it and control a robot contained inside it, I also started to wonder about we could build instrumentation on the Jupyter notebook client side.
The V-REP simulator itself has graph objects that can record and display logged data within the simulator:
But we can also capture data from the simulator as part of the Python control loop running via a notebook.
(I’m not sure if streaming data from the simulator is possible, or how to go about either setting that up in the simulator connection or rendering it in the notebook?)
So here’s my quick starter for 10 getting a simple data display running in a notebook using IPython widgets.
So here’s a simple text display to give a real time (ish) view of a couple of sensor values:
As the robot runs, the widget values update in real-time-ish .
I couldn’t figure out offhand how to generate a live-updating chart, and couldn’t quickly see how to return data from inside the magic cell as part of the magic function. (In fact, I’m not convinced I understand at all the scoping in there!)
But it seems as if we set a
global variable inside the magic cell, we can get data out and plot it when the simulation is stopped:
Example notebook here.
If anyone can show me how to create and update a live chart, that would be fantastic:-)