Starting with Stretch Body 0.4.26 and Stretch Factory v0.3.15 we have introduced a new debugging tool for Stretch Body called Robot Trace.
Note: This tool is recommended for advanced users only
The Robot Trace tool periodically logs Stretch Body status data to disk in the background. This data can then be inspected and plotted offline. The Trace tool can be useful to capture and analyze events when debugging transient issues and behavior with the robot.
For example, if the robot powers down unexpectedly during an experiment, you might look at the trace and plot the battery voltage and current at the time of the shutdown.
The trace function is turned off by default. To turn it on, update your ‘~/stretch_user/<robot_name>/stretch_user_params.yaml’ with:
robot:
use_trace: 1
Now, whenever an instance of the Robot class is created a thread will be spawned that logs data to disk. The data is timestamped and stored under ~/stretch_user/log/trace
. The amount of trace data logged to disk is bounded in a FIFO type queue.
ls ~/stretch_user/log/trace/
trace_stretch-re1-1021_20230308102045_00000.yaml
...
By default the robot status data that is logged is defined in robot_trace.py. The YAML trace files contain a series of entries like this:
trace_0000:
arm.motor.effort_pct: 0.0
arm.pos: -0.019642551395004437
arm.vel: 0.000298045866133731
base.left_wheel.effort_pct: 0.0
base.left_wheel.pos: 0.15481062233448029
base.left_wheel.vel: 0.018910381942987442
base.right_wheel.effort_pct: 0.0
base.right_wheel.pos: 0.3108431398868561
base.right_wheel.vel: 0.0069570220075547695
lift.motor.effort_pct: 12.49999116448795
lift.pos: 0.5268116892742208
lift.vel: 0.000220643355869542
pimu.charger_connected: false
pimu.cpu_temp: 40.0
pimu.current: 2.5582551079637863
pimu.low_voltage_alert: false
pimu.runstop_event: true
pimu.voltage: 12.420293092727661
timestamp: 1678299646.3529084
You can add your own call back function if you’d like to trace additional data.
Run the tool `REx_trace_robot.py’ to plot the data. You can see here that there is a menu to let you select a sensor value and time series to plot:
Plotting looks like:
Happy debugging!