Jupyter notebook tutorials

Hello Stretch Community!

My name is Aarju Goyal, I recently graduated from University Of Southern California with my Master’s degree in Computer Science and I’ve had the amazing opportunity to intern at Hello Robot this Summer.

I’ve been working on a couple of projects this summer and I would like to share one of them here- Jupyter notebook tutorials. The tutorials are meant to provide the Stretch community with detailed explanations and insights on the functions and API of Stretch body. The Python Jupyter notebooks run in a browser and allow the reader to interact with Stretch easily and efficiently.

There are currently two new tutorials available; both are available in stretch_body->docs currently in the develop branch.

  • Stretch Body: Commanding Motions: This tutorial is written by @bshah, and explains how to use the stretch_body.robot.Robot class to interact with Stretch (e.g. starting, homing, stowing, retrieving status, & stopping). The notebook continues to use other classes within Stretch Body to command motion to Stretch’s lift, arm, base, and other joints.
  • Stretch Body PIMU (Power and IMU): This tutorial is written by me, and goes into more detail of the PIMU (Power and IMU board in Stretch’s mobile base). The PIMU board is accessed through the PIMU class, and the tutorial goes into detail about the Utility functions that would be helpful during the development/factory stage of a Stretch based project. The tutorial then provides new functions to visualize the status values from the PIMU board. The functions can also take any transformation functions that should be applied to the status values. Visualizing the status values can provide insight into if the IMU sensors are responding in the expected way.

Here are some snippets:

As shown below, the tutorial follows the format of a brief description of a value/function followed by a code cell on how to use it.

As explained before, the PIMU tutorial shows how to visualize status values. The visualization functions - plot_values and plot_values_4 can take arguments like run_time, num_points, yrange and functions. Details about the arguments are given in the tutorial. Following is an example of why the PIMU voltage is important followed by it’s visualization.

I would like to sincerely thank @aedsinger and @bshah or their guidance on designing the tutorial as well as helping me understand Stretch Body better so that I could make a helpful tutorial. I hope the tutorials prove to be helpful to the Stretch community.


Aarju Goyal


Hi @Aarju,

Thank you for sharing this fantastic resource. Since stretch_body package directly interacts with the stretch hardware, did you run these notebooks after ssh-ing into the stretch robot server?

Is there a way where by using ROS Remote master or by some other approach, we can run jupyter notebooks on a computer (fyi which is already connected to Stretch RE1 using ROS Remote master)?

Hello, welcome to the forum @anant! When Aarju and I were collaborating on these notebooks, we would use SSH tunnels to run the notebooks remotely. A SSH tunnel connects the Jupyter server running on the robot to a port on your computer, allowing you to open the notebook in your own browser. These instructions from the Jupyter docs show the steps needed to set up a SSH tunnel.