Skip to content

Commit 577c73b

Browse files
authored
Fix system monitor launch (#611)
2 parents e541749 + 2fd7ed4 commit 577c73b

File tree

4 files changed

+83
-99
lines changed

4 files changed

+83
-99
lines changed

bitbots_misc/system_monitor/config/plotjuggler_layout.xml

Lines changed: 79 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,120 @@
11
<?xml version='1.0' encoding='UTF-8'?>
2-
<root version="2.3.8">
3-
<tabbed_widget name="Main Window" parent="main_window">
4-
<plotmatrix rows="2" columns="1" tab_name="CPU">
5-
<plot row="0" col="0">
6-
<range top="100.000000" bottom="0.000000" left="0.000000" right="8.029071"/>
7-
<limitY max="100" min="0"/>
8-
<curve custom_transform="noTransform" name="/system_workload/cpus.0/cpu_usage" B="180" G="119" R="31"/>
9-
<curve custom_transform="noTransform" name="/system_workload/cpus.1/cpu_usage" B="40" G="39" R="214"/>
10-
<curve custom_transform="noTransform" name="/system_workload/cpus.2/cpu_usage" B="56" G="201" R="26"/>
11-
<curve custom_transform="noTransform" name="/system_workload/cpus.3/cpu_usage" B="14" G="127" R="255"/>
12-
<curve custom_transform="noTransform" name="/system_workload/cpus.4/cpu_usage" B="193" G="76" R="241"/>
13-
<curve custom_transform="noTransform" name="/system_workload/cpus.5/cpu_usage" B="189" G="103" R="148"/>
14-
<curve custom_transform="noTransform" name="/system_workload/cpus.6/cpu_usage" B="207" G="190" R="23"/>
15-
<curve custom_transform="noTransform" name="/system_workload/cpus.7/cpu_usage" B="34" G="189" R="188"/>
16-
<transform value="noTransform"/>
17-
</plot>
18-
<plot row="1" col="0">
19-
<range top="279.000000" bottom="1.000000" left="0.000000" right="8.029071"/>
20-
<limitY min="1"/>
21-
<curve custom_transform="noTransform" name="/system_workload/running_processes" B="180" G="119" R="31"/>
22-
<transform value="noTransform"/>
23-
</plot>
24-
</plotmatrix>
25-
<plotmatrix rows="1" columns="1" tab_name="Memory">
26-
<plot row="0" col="0">
27-
<range top="16662851584.000000" bottom="0.000000" left="0.000000" right="0.518927"/>
28-
<limitY min="0"/>
29-
<curve custom_transform="noTransform" name="/system_workload/memory_total" B="40" G="39" R="214"/>
30-
<curve custom_transform="noTransform" name="/system_workload/memory_used" B="180" G="119" R="31"/>
31-
<transform value="noTransform"/>
32-
</plot>
33-
</plotmatrix>
34-
<plotmatrix rows="1" columns="1" tab_name="Network">
35-
<plot row="0" col="0">
36-
<range top="24198.000000" bottom="0.000000" left="0.000000" right="4.023767"/>
37-
<limitY min="0"/>
38-
<curve custom_transform="noTransform" name="/system_workload/network_interfaces.0/rate_received_bytes" B="180" G="119" R="31"/>
39-
<curve custom_transform="noTransform" name="/system_workload/network_interfaces.0/rate_sent_bytes" B="40" G="39" R="214"/>
40-
<curve custom_transform="noTransform" name="/system_workload/network_interfaces.1/rate_received_bytes" B="56" G="201" R="26"/>
41-
<curve custom_transform="noTransform" name="/system_workload/network_interfaces.1/rate_sent_bytes" B="14" G="127" R="255"/>
42-
<transform value="noTransform"/>
43-
</plot>
44-
</plotmatrix>
45-
<currentPlotMatrix index="0"/>
2+
<root>
3+
<tabbed_widget parent="main_window" name="Main Window">
4+
<Tab tab_name="tab2" containers="1">
5+
<Container>
6+
<DockSplitter count="3" sizes="0.332999;0.334002;0.332999" orientation="-">
7+
<DockArea name="...">
8+
<plot flip_x="false" style="Lines" flip_y="false" mode="TimeSeries">
9+
<range right="1730744413.650088" bottom="-0.211458" left="1730744393.723256" top="8.669791"/>
10+
<limitY/>
11+
<curve color="#bcbd22" name="/system_workload/cpu_usage_overall"/>
12+
</plot>
13+
</DockArea>
14+
<DockArea name="...">
15+
<plot flip_x="false" style="Lines" flip_y="false" mode="TimeSeries">
16+
<range right="1730744413.650088" bottom="3674476441.600006" left="1730744393.723256" top="138214342758.399994"/>
17+
<limitY/>
18+
<curve color="#1f77b4" name="/system_workload/memory_used"/>
19+
<curve color="#d62728" name="/system_workload/memory_total"/>
20+
</plot>
21+
</DockArea>
22+
<DockArea name="...">
23+
<plot flip_x="false" style="Lines" flip_y="false" mode="TimeSeries">
24+
<range right="1730744413.650088" bottom="576.850000" left="1730744393.723256" top="583.150000"/>
25+
<limitY/>
26+
<curve color="#1ac938" name="/system_workload/running_processes"/>
27+
</plot>
28+
</DockArea>
29+
</DockSplitter>
30+
</Container>
31+
</Tab>
32+
<currentTabIndex index="0"/>
4633
</tabbed_widget>
47-
<use_relative_time_offset enabled="1"/>
34+
<use_relative_time_offset enabled="0"/>
4835
<!-- - - - - - - - - - - - - - - -->
4936
<!-- - - - - - - - - - - - - - - -->
5037
<Plugins>
5138
<plugin ID="DataLoad CSV">
52-
<default time_axis=""/>
39+
<parameters delimiter="0" time_axis=""/>
5340
</plugin>
54-
<plugin ID="DataLoad ROS bags">
41+
<plugin ID="DataLoad MCAP"/>
42+
<plugin ID="DataLoad ROS2 bags">
5543
<use_header_stamp value="false"/>
56-
<use_renaming_rules value="true"/>
5744
<discard_large_arrays value="true"/>
5845
<max_array_size value="100"/>
46+
<boolean_strings_to_number value="true"/>
47+
<remove_suffix_from_strings value="true"/>
48+
<selected_topics value=""/>
5949
</plugin>
6050
<plugin ID="DataLoad ULog"/>
61-
<plugin ID="ROS Topic Subscriber">
62-
<use_header_stamp value="false"/>
63-
<use_renaming_rules value="true"/>
51+
<plugin ID="ROS2 Topic Subscriber">
52+
<use_header_stamp value="true"/>
6453
<discard_large_arrays value="true"/>
6554
<max_array_size value="100"/>
55+
<boolean_strings_to_number value="true"/>
56+
<remove_suffix_from_strings value="true"/>
57+
<selected_topics value="/system_workload"/>
58+
</plugin>
59+
<plugin ID="UDP Server"/>
60+
<plugin ID="WebSocket Server"/>
61+
<plugin ID="ZMQ Subscriber"/>
62+
<plugin ID="Fast Fourier Transform"/>
63+
<plugin ID="Quaternion to RPY"/>
64+
<plugin ID="Reactive Script Editor">
65+
<library code="--[[ Helper function to create a series from arrays&#xa;&#xa; new_series: a series previously created with ScatterXY.new(name)&#xa; prefix: prefix of the timeseries, before the index of the array&#xa; suffix_X: suffix to complete the name of the series containing the X value. If [nil], use the index of the array.&#xa; suffix_Y: suffix to complete the name of the series containing the Y value&#xa; timestamp: usually the tracker_time variable&#xa; &#xa; Example:&#xa; &#xa; Assuming we have multiple series in the form:&#xa; &#xa; /trajectory/node.{X}/position/x&#xa; /trajectory/node.{X}/position/y&#xa; &#xa; where {N} is the index of the array (integer). We can create a reactive series from the array with:&#xa; &#xa; new_series = ScatterXY.new(&quot;my_trajectory&quot;) &#xa; CreateSeriesFromArray( new_series, &quot;/trajectory/node&quot;, &quot;position/x&quot;, &quot;position/y&quot;, tracker_time );&#xa;--]]&#xa;&#xa;function CreateSeriesFromArray( new_series, prefix, suffix_X, suffix_Y, timestamp )&#xa; &#xa; --- clear previous values&#xa; new_series:clear()&#xa; &#xa; --- Append points to new_series&#xa; index = 0&#xa; while(true) do&#xa;&#xa; x = index;&#xa; -- if not nil, get the X coordinate from a series&#xa; if suffix_X ~= nil then &#xa; series_x = TimeseriesView.find( string.format( &quot;%s.%d/%s&quot;, prefix, index, suffix_X) )&#xa; if series_x == nil then break end&#xa; x = series_x:atTime(timestamp)&#x9; &#xa; end&#xa; &#xa; series_y = TimeseriesView.find( string.format( &quot;%s.%d/%s&quot;, prefix, index, suffix_Y) )&#xa; if series_y == nil then break end &#xa; y = series_y:atTime(timestamp)&#xa; &#xa; new_series:push_back(x,y)&#xa; index = index+1&#xa; end&#xa;end&#xa;&#xa;--[[ Similar to the built-in function GetSeriesNames(), but select only the names with a give prefix. --]]&#xa;&#xa;function GetSeriesNamesByPrefix(prefix)&#xa; -- GetSeriesNames(9 is a built-in function&#xa; all_names = GetSeriesNames()&#xa; filtered_names = {}&#xa; for i, name in ipairs(all_names) do&#xa; -- check the prefix&#xa; if name:find(prefix, 1, #prefix) then&#xa; table.insert(filtered_names, name);&#xa; end&#xa; end&#xa; return filtered_names&#xa;end&#xa;&#xa;--[[ Modify an existing series, applying offsets to all their X and Y values&#xa;&#xa; series: an existing timeseries, obtained with TimeseriesView.find(name)&#xa; delta_x: offset to apply to each x value&#xa; delta_y: offset to apply to each y value &#xa; &#xa;--]]&#xa;&#xa;function ApplyOffsetInPlace(series, delta_x, delta_y)&#xa; -- use C++ indeces, not Lua indeces&#xa; for index=0, series:size()-1 do&#xa; x,y = series:at(index)&#xa; series:set(index, x + delta_x, y + delta_y)&#xa; end&#xa;end&#xa;"/>
66+
<scripts/>
6667
</plugin>
67-
<plugin ID="ROS /rosout Visualization" status="idle"/>
68-
<plugin ID="ROS Topic Re-Publisher" status="idle"/>
68+
<plugin ID="CSV Exporter"/>
69+
<plugin ID="ROS2 Topic Re-Publisher"/>
6970
</Plugins>
7071
<!-- - - - - - - - - - - - - - - -->
7172
<previouslyLoaded_Datafiles/>
72-
<previouslyLoaded_Streamer name="ROS Topic Subscriber"/>
73+
<previouslyLoaded_Streamer name="ROS2 Topic Subscriber"/>
7374
<!-- - - - - - - - - - - - - - - -->
7475
<customMathEquations/>
7576
<snippets>
76-
<snippet name="1st_derivative" language="JS">
77+
<snippet name="1st_derivative">
7778
<global>var prevX = 0
7879
var prevY = 0</global>
79-
<equation>dx = time - prevX
80-
dy = value - prevY
81-
prevX = time
82-
prevY = value
83-
84-
return dy/dx</equation>
80+
<function></function>
81+
<linked_source></linked_source>
8582
</snippet>
86-
<snippet name="1st_order_lowpass" language="JS">
83+
<snippet name="1st_order_lowpass">
8784
<global>var prevY = 0
8885
var alpha = 0.1</global>
89-
<equation>prevY = alpha * value + (1.-alpha) * prevY
90-
91-
return prevY</equation>
86+
<function></function>
87+
<linked_source></linked_source>
9288
</snippet>
93-
<snippet name="2D_velocity" language="JS">
89+
<snippet name="2D_velocity">
9490
<global>var prev_x = 0
9591
var prev_y = 0
9692
var prev_t = 0</global>
97-
<equation>X = $$your_odometry/position/x$$
98-
Y = $$your_odometry/position/y$$
99-
100-
var dist = sqrt( (X-prev_x)*(X-prev_x) + (Y-prev_y)*(Y-prev_y) )
101-
var dT = time - prev_t
102-
103-
prev_x = X
104-
prev_y = Y
105-
prev_t = time
106-
107-
return dist / dT</equation>
93+
<function></function>
94+
<linked_source></linked_source>
10895
</snippet>
109-
<snippet name="average_two_curves" language="JS">
96+
<snippet name="average_two_curves">
11097
<global></global>
111-
<equation>a = $$PLOT_A$$
112-
b = $$PLOT_B$$
113-
114-
return (a+b)/2</equation>
98+
<function></function>
99+
<linked_source></linked_source>
115100
</snippet>
116-
<snippet name="integral" language="JS">
101+
<snippet name="integral">
117102
<global>var integral = 0</global>
118-
<equation>integral += value
119-
return integral</equation>
103+
<function></function>
104+
<linked_source></linked_source>
120105
</snippet>
121-
<snippet name="rad_to_deg" language="JS">
106+
<snippet name="rad_to_deg">
122107
<global></global>
123-
<equation>return value*180/3.1417</equation>
108+
<function></function>
109+
<linked_source></linked_source>
124110
</snippet>
125-
<snippet name="remove_offset" language="JS">
111+
<snippet name="remove_offset">
126112
<global>var is_first = true
127113
var first_value = 0</global>
128-
<equation>if (is_first)
129-
{
130-
is_first = false
131-
first_value = value
132-
}
133-
134-
return value - first_value</equation>
114+
<function></function>
115+
<linked_source></linked_source>
135116
</snippet>
136-
<snippet name="yaw_from_quaternion" language="JS">
117+
<snippet name="yaw_from_quaternion">
137118
<global>// source: https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
138119

139120
function quaternionToYaw(x, y, z, w)
@@ -145,7 +126,8 @@ function quaternionToYaw(x, y, z, w)
145126

146127
return yaw
147128
}</global>
148-
<equation>return quaternionToYaw(x, y, z, w);</equation>
129+
<function></function>
130+
<linked_source></linked_source>
149131
</snippet>
150132
</snippets>
151133
<!-- - - - - - - - - - - - - - - -->
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<launch>
2-
<node pkg="plotjuggler" exec="plotjuggler" name="$(anon plotjuggler)" output="screen" required="true"
2+
<node pkg="plotjuggler" exec="plotjuggler" name="$(anon plotjuggler)" output="screen"
33
args="--layout $(find-pkg-share system_monitor)/config/plotjuggler_layout.xml"/>
44
</launch>

bitbots_misc/system_monitor/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<depend>python3-psutil</depend>
2020
<depend>bitbots_docs</depend>
2121
<depend>rclpy</depend>
22-
<depend>bitbots_msgs</depend>
22+
<depend>bitbots_msgs</depend>
2323

2424
<export><build_type>ament_python</build_type>
2525
</export>

bitbots_misc/system_monitor/setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
("share/" + package_name, ["package.xml"]),
1212
("share/ament_index/resource_index/packages", ["resource/" + package_name]),
1313
("share/" + package_name + "/config", glob.glob("config/*.yaml")),
14+
("share/" + package_name + "/config", glob.glob("config/*.rviz")),
15+
("share/" + package_name + "/config", glob.glob("config/*.xml")),
1416
("share/" + package_name + "/launch", glob.glob("launch/*.launch")),
1517
],
1618
install_requires=[

0 commit comments

Comments
 (0)