Link:
https://github.com/facontidavide/PlotJuggler?tab=readme-ov-file
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
ros2 run plotjuggler plotjuggler
Create First Plot
(1) Open the application with the option “-t” to create some dummy data
ros2 run plotjuggler plotjuggler -t
(2)A list of timeseries should be visible on the left panel (tree view_)
(3)To plot a series, drag and drop into the plot area using the Left Mouse
Plot _sin
Additionally plot _cos
Select, drag and drop Timeseries using left mouse
(4)Keep the CTRL key pressed to select multiple series
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
Initially, click on the legend entry named “data_1” to hide this series from the plot
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
(2) Rename a plot or a tab double-clicking on its name
Double Click on … > Enter name
Rearrange your plots
(1)You can rearrange the plot areas dragging them (use the name area)
(2)Temporarily zoom one of the plot areas “fullscreen”
Click on Full Screen
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
Zoom in Trigono
Draw a box using right Mouse
Zoom out Trigono
Right Click > Click button Zoom out
(3)Use the link button to zoom all the plots at once
Zoom out
Zoom in
The vertical “time tracker”
(1) Move the vertical tracker with the Shift Key + Left Mouse
(2) Note as the values on the second column of the timeseries list are updated
(3) Alternatively, move the time slider at the bottom
Combine two timeseries in a XY Plot
(1)Select two timeseries keeping the CTRL Key pressed
(2)Drag and drop them using the Right Mouse, instead of the Left one
(3)Optionally, customize the order or/and the name of this new series
Click on swap > OK
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
(2)CTRL+Shift+Z keys: Redo
Curves Editor (appearance)
(1)Edit curves color, remove curves and show points
Right click tab > Click on Edit curves…
Click on trash can to delete a specific curve (data_10 curve deleted)
Adjusted the color to pink for data_1 and purple for data_3
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”
Adjust Vertical limits (Max 3, Min -1)
Click on Save Changes button
Save/Load the Layout
(1)Save the Layout
Use “layout” files to save the current state of PlotJuggler
Click on button
Create a directory where you’d like to store the PlotJuggler files
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
Click on
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
(1)PlotJuggler can read data from file or live-streaming
Click on
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
App > Preferences > Plugins > +
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
Click on
button in the Data box > Navigate to the directory where the motor_data.csv is stored > Select the csv file > Click the Open button
Select a column to be used as X axis > Select the preferred column from Columns (t) > Ok
Drag and drop Accel, Torque, and Velocity column using the Left Mouse
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
Change Streaming to Dummy Streamer
Click on the start button > See the data_vect values change
Press Shift and click on the columns you want to visualize > Drag and drop using the Left Mouse
Increase Decrease buffer size > Streaming slows down
(4)Zoom and Time Tracker are active only when streaming is stopped or paused
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
Change Streaming to WebSocket Server
Click on Start > Change Message Protocol to json > Click on ok
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
Streaming Starts
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
(2)Sometimes, you want to reuse the Layout on a different file
-In this case: Save the Layout with “Save data source” unchecked
-Load the data file first > Open the Layout file
Reference: https://slides.com/davidefaconti/plotjuggler-data
Reference: https://slides.com/davidefaconti/plotjuggler-transforms