Exploring the PlotJuggler Package

Implement PlotJuggler Package

Step1: Access PlotJuggler Website & Github

Link:
https://github.com/facontidavide/PlotJuggler?tab=readme-ov-file

Step2: Install Plot Juggler Package

Development Environment:
Set up on Ubuntu 22.03 OS, running in a virtual machine via VirtualBox
Integration is achieved using the ROS 2 Humble bridge

sudo apt install ros-humble-plotjuggler-ros

Rosbag_Visualize19

Step3: Run Plot Juggler Package

ros2 run plotjuggler plotjuggler

Rosbag_Visualize18

Step4: Plot Juggler Executed

Rosbag_Visualize20

Learn the Basics

Visualize Data

Create First Plot
(1) Open the application with the option “-t” to create some dummy data

ros2 run plotjuggler plotjuggler -t

PlotJuggler2
(2)A list of timeseries should be visible on the left panel (tree view_)
PlotJuggler1
(3)To plot a series, drag and drop into the plot area using the Left Mouse
PlotJuggler3
Plot _sin
PlotJuggler4
Additionally plot _cos
PlotJuggler4
Select, drag and drop Timeseries using left mouse
(4)Keep the CTRL key pressed to select multiple series
PlotJuggler6
Press CTRL key > Click on data_1 and data_2 >
Legend
(1)Click on the name of one of the series in the legend to hide it
PlotJuggler10
Initially, click on the legend entry named “data_1” to hide this series from the plot
PlotJuggler9
Click once more on “data_1” in the legend to make the series visible again in the plot
Multiple plots and tabs
(1) Split your view into multiple plots or create new tabs
PlotJuggler5
PlotJuggler7
PlotJuggler8
(2) Rename a plot or a tab double-clicking on its name
PlotJuggler9
Double Click on … > Enter name

Arrange data in multiple plots and tabs

Rearrange your plots
(1)You can rearrange the plot areas dragging them (use the name area)
PlotJuggler11
(2)Temporarily zoom one of the plot areas “fullscreen”
PlotJuggler12
Click on Full Screen

Zoom in multiple ways

Zoom
(1)Click with the Left Mouse to select an area to zoom in
(2)Using the Mouse Wheel you can zoom either the entire plot or a single axis
Example
PlotJuggler15
Zoom in Trigono
PlotJuggler16
Draw a box using right Mouse
Zoom out Trigono
PlotJuggler17
Right Click > Click button Zoom out
(3)Use the link button to zoom all the plots at once
Zoom out
PlotJuggler13
Zoom in
PlotJuggler14
The vertical “time tracker”
(1) Move the vertical tracker with the Shift Key + Left Mouse
PlotJuggler18
(2) Note as the values on the second column of the timeseries list are updated
PlotJuggler19
(3) Alternatively, move the time slider at the bottom
PlotJuggler21
Combine two timeseries in a XY Plot
(1)Select two timeseries keeping the CTRL Key pressed
PlotJuggler22
(2)Drag and drop them using the Right Mouse, instead of the Left one
PlotJuggler23
(3)Optionally, customize the order or/and the name of this new series
PlotJuggler24
Click on swap > OK
PlotJuggler25
For the top plot, it is presented in its original order, without any alterations. For the bottom plot, the order has been swapped for clarity and comparison purposes
Undo Redo
(1)CTRL+Z keys: Undo
PlotJuggler26
(2)CTRL+Shift+Z keys: Redo
PlotJuggler27
Curves Editor (appearance)
(1)Edit curves color, remove curves and show points
PlotJuggler28
Right click tab > Click on Edit curves…
PlotJuggler29
Click on trash can to delete a specific curve (data_10 curve deleted)
PlotJuggler31
Adjusted the color to pink for data_1 and purple for data_3
PlotJuggler32
Select line style (Chose Lines and Dots)
(2)The vertical limits can be useful to clamp the Y range(Preventing the spikes from excessively distorting the visualization or analysis of the data) in the presence of “spikes”
PlotJuggler33
Adjust Vertical limits (Max 3, Min -1)
PlotJuggler34
Click on Save Changes button

Save your layout to reuse it later

Save/Load the Layout
(1)Save the Layout
Use “layout” files to save the current state of PlotJuggler
PlotJuggler36
Click on PlotJuggler35 button
PlotJuggler38
Create a directory where you’d like to store the PlotJuggler files
PlotJuggler39
Select the directory where you’d like to save the file > Open > Name the file (Named it samplecurve1) > CLick Save button
(2)Load the Layout
PlotJuggler40
Click on PlotJuggler39 button > Navigate to the directory where you’d like to save the file > Select the xml file > Click the Open button
Reference: https://slides.com/davidefaconti/introduction-to-plotjuggler

Data Sources

Data Sources
(1)PlotJuggler can read data from file or live-streaming
PlotJuggler41
Click on PlotJuggler39 button > Navigate to the directory where you’d like to save the file > Select the xml file > Click the Open button
(2)All data sources are implemented through plugins
(3)You can add new plugins (yours or 3rd party) in the “Preferences” menu
PlotJuggler42
App > Preferences > Plugins > +

Load data from file

Example: load a CSV file
Will be asked to select the column with the time. Optionally, you can use the row number
(1)Each plugin has its own dialog and options
(2)For instance, try to load this CSV file
Download motor_data.csv file > Upload it to the preferred directory
PlotJuggler43
Click on PlotJuggler39 button in the Data box > Navigate to the directory where the motor_data.csv is stored > Select the csv file > Click the Open button
PlotJuggler44
Select a column to be used as X axis > Select the preferred column from Columns (t) > Ok
PlotJuggler45
Drag and drop Accel, Torque, and Velocity column using the Left Mouse

Use streaming plugins

Streaming
(1)PJ has several built-in streaming plugins (MQTT, UDP, Websockets)
(2)For testing purpose, start PJ with option “-t” and try the Dummy Streamer

ros2 run plotjuggler plotjuggler -t

(3)You can start, pause and stop the streamer. Change the buffer size if needed
PlotJuggler46
Change Streaming to Dummy Streamer
PlotJuggler47
Click on the start button > See the data_vect values change
PlotJuggler48
Press Shift and click on the columns you want to visualize > Drag and drop using the Left Mouse
PlotJuggler49
Increase Decrease buffer size > Streaming slows down
(4)Zoom and Time Tracker are active only when streaming is stopped or paused
PlotJuggler50
Click on stop to stop streaming
Streaming Format
(1) The built-in plugins recognize these formats: JSON, BSON, CBOR, MessagePack
(2) Check the Websocket example, publishing a simple JSON message
PlotJuggler51
Change Streaming to WebSocket Server
PlotJuggler52
Click on Start > Change Message Protocol to json > Click on ok
PlotJuggler53

sudo apt update
sudo apt install python3-pip
pip --version
pip install websocket-client
cd <Path where websocket_client.py exists>/
python3 websocket_client.py

PlotJuggler54
Streaming Starts
PlotJuggler55
Drag and drop sin and cos to the tab using the Left Mouse
(3) Sometimes, it is useful to clean the data buffer
Save the data source in the Layout
(1)When you save a Layout, check the option “Save data source” to reopen the last file or restart the last streaming plugin
PlotJuggler56
(2)Sometimes, you want to reuse the Layout on a different file
-In this case: Save the Layout with “Save data source” unchecked
PlotJuggler57
-Load the data file first > Open the Layout file
Reference: https://slides.com/davidefaconti/plotjuggler-data

Custom Plots, filters, and transformations

Reference: https://slides.com/davidefaconti/plotjuggler-transforms