-
Notifications
You must be signed in to change notification settings - Fork 20
Plotting Tool
Lets observing data plots in live mode or from a saved file
Make sure GAMS and MADARA are built with python
Tool is developed in Python and is using 'yaml' file for configs and plotting values
Create a yaml file to configure the tool. This will be passed to the tool input when starting
Key for data source is data_source. There are two types of data sources that can be used in yaml file:
stk files and live plot from a Knowledge Base.
Key to specify the file is stk_file. Simply path to the stk file needs to be specified
e.g.
data_source:
stk_file: '/path/to/mystk.stk'
schemas: '/path/to/schemas/folder'
Transport needs to be specified for real knowledge base with the following subkeys in transport key
transport:
transport_type: specifies transport type and can be ZMQ or UDP or MULTICAST or BROADCAST.
Currently only ZMQ and UDP were tested.
hosts: specifies KB hosts with ports, queue_length: transport queue lenght, read_threads: reading threads, read_thread_hertz: thread reading frequency, kb_name: name for knowledge base.
e.g.
data_source:
transport:
transport_type: ZMQ
hosts: ['tcp://127.0.0.1:52502', 'tcp://127.0.0.1:52500']
queue_length: 100000000
read_threads: 1
read_thread_hertz: 1000
kb_name: nothing
schemas: '/path/to/schemas/folder'
in both cases if there is capnp data which needs to be plotted its schemas folder needs to be specified.
There are 3 types of keys to be specified
-
If you want
Reference Framesto be plotted, you need to specify them underframe_typeskey. Specify name of the key, e.g.p1_base_link:and under itreference_frame:as an array, e.g.['p1_odom', 'p1_base_link'] -
If you want to 'Any' types to be plotted, use
any_typeskey. They are usually used forcapnptypes and are in maps. -
Other types can be specified directly without putting under mentioned above keys.
-
plot_<number>to specify certain subplots for the given key. For each axes you need to specify also the index and the name, e.g.0: 'x'and1: 'y'or0: 'x'-1: 'time'(-1 index means plotting the key against time), here first plots x against y. -
points_per_plotdefines the number of points to keep in the plot, and is defined as a number -
3Ddefines if the key needs to plotted as 3d or as 2d. If the value has more than 1 subvalues they all will be plotted against time. If3Dis set toTruethen the key will be attemped to plot in 3D graph. -
If the type is a map (it is appearing for capnp types defined in any_types), subplots can be specified with subkeys, e.g.
position.x: 'x'andposition.y: 'y'. In this case full path to the exact subkey in the map can be passed using., e.g.position.xsubkey forpose_in_mapkey points topose_in_map[position][x]in the map. If any of the values in the map is an array, it can be accessed by putting the index, e.g.'key1.key2.[3].key3', where [3] shows that key2 is an array where we take index 3. -
You can also leave the content empty and it will be plotted. If you don't mentioned the plot axes, all the keys are being plotted against time.
# config.yaml
data_source:
stk_file: '/media/sedrak/OS/SET/projects/test.stk'
schemas: '/media/sedrak/OS/SET/projects/capnp_schemas'
knowledge_record_subkeys:
# will plot 'sensors.imu.index' key against toi, as it is
sensors.imu.index:
# frames
frame_types:
# Default: Use if reference frame is geo and would like to plot full
# pose (position and orientation)
'p1_base_link':
# First entry should be upstream reference frame
'p1_base_link':
reference_frame: ['geo', 'p1_base_link']
points_per_plot: 200
#'p1_base_footprint':
# points_per_plot: 50
#3D: True
# Use if you would like to map specific position/orientation indices
# to x, y, or z axes. Value on lhs of colon indicates index of pose array
# and rhs indicates label for axis. Plot_1, etc. indicate subplots in figure
'p1_base_link':
reference_frame: ['p1_odom', 'p1_base_link']
plot_1:
0: 'x'
1: 'y'
plot_2:
-1: 'time'
0: 'x'
plot_3:
-1: 'time'
1: 'y'
plot_4:
2: 'z'
-1: 'time'
points_per_plot: 25
'p1_base_footprint':
3D: True
#Any data types
any_types:
'state_estimation.pose_graph.pose_in_map.1':
plot_1:
pose.position.x: 'x'
pose.position.y: 'y'
plot_2:
pose.position.x: 'x'
pose.position.z: 'z'
'state_estimation.pose_graph.pose_in_map.2':
3D: True
plot_1:
pose.position
After configuring the yaml file, you can run the plotting tool by calling: python $GAMS_ROOT/port/python/tools/plotting_sample.py <path_to_config.yaml>