Chart Helpers in the Artefacts Toolkit

The Artefacts Toolkit Chart helpers are designed to help you with visualising data received from topics while running tests.

Import with:

from artefacts_toolkit.chart import make_chart

Functions

Function Reference

make_chart

Creates an interactive HTML chart based on data from two provided topics.

make_chart(
    filepath,
    topic_x,
    topic_y,
    field_unit=None,
    output_dir="output",
    chart_name="chart",
    file_type="rosbag"
)

Parameters

Parameter Type Description Default
filepath str Path to the data file (rosbag) Required
topic_x str Topic name for x-axis. Use “Time” to plot against time Required
topic_y str Topic name for y-axis. Use “Time” to plot against time Required
field_unit str Unit of measurement for the field data (e.g., “m/s”, “rad”) None
output_dir str Directory where the chart will be saved "output"
chart_name str Name of the generated chart file "chart"
file_type str Type of data file. Currently supports “rosbag” "rosbag"

Returns

None: Creates an html chart <chart_name>.html at output_dir but doesn’t return any value.

Example

The following example adds the make_chart function post shutdown, i.e after the test has completed and rosbag saved.

# my_test_file.launch.py
# test code

...

@launch_testing.post_shutdown_test()
class TestProcOutputAfterShutdown(unittest.TestCase):
    def test_exit_code(self, rosbag_filepath):
        make_chart(
            rosbag_filepath,
            "/odom.pose.pose.position.x",
            "/odom.pose.pose.position.y",
            field_unit="m",
            chart_name="odometry_position",
        )

Producing the following chart:

Example Chart

Last modified April 24, 2025: toolkit alerts (3d7b4d1)