|
77 | 77 | <plugin ID="DataLoad CSV">
|
78 | 78 | <default time_axis="" delimiter="0"/>
|
79 | 79 | </plugin>
|
80 |
| - <plugin ID="DataLoad ROS2 bags"> |
| 80 | + <plugin ID="DataLoad ROS 2 bags"> |
81 | 81 | <use_header_stamp value="false"/>
|
82 | 82 | <discard_large_arrays value="true"/>
|
83 | 83 | <max_array_size value="100"/>
|
84 | 84 | <boolean_strings_to_number value="true"/>
|
85 | 85 | <remove_suffix_from_strings value="true"/>
|
86 | 86 | </plugin>
|
87 | 87 | <plugin ID="DataLoad ULog"/>
|
88 |
| - <plugin ID="ROS2 Topic Subscriber"> |
| 88 | + <plugin ID="ROS 2 Topic Subscriber"> |
89 | 89 | <use_header_stamp value="true"/>
|
90 | 90 | <discard_large_arrays value="true"/>
|
91 | 91 | <max_array_size value="100"/>
|
|
98 | 98 | <plugin ID="Fast Fourier Transform"/>
|
99 | 99 | <plugin ID="Quaternion to RPY"/>
|
100 | 100 | <plugin ID="Reactive Script Editor">
|
101 |
| - <library code="--[[ Helper function to create a series from arrays

 new_series: a series previously created with ScatterXY.new(name)
 prefix: prefix of the timeseries, before the index of the array
 suffix_X: suffix to complete the name of the series containing the X value. If [nil], use the index of the array.
 suffix_Y: suffix to complete the name of the series containing the Y value
 timestamp: usually the tracker_time variable
 
 Example:
 
 Assuming we have multiple series in the form:
 
 /trajectory/node.{X}/position/x
 /trajectory/node.{X}/position/y
 
 where {N} is the index of the array (integer). We can create a reactive series from the array with:
 
 new_series = ScatterXY.new("my_trajectory") 
 CreateSeriesFromArray( new_series, "/trajectory/node", "position/x", "position/y", tracker_time );
--]]

function CreateSeriesFromArray( new_series, prefix, suffix_X, suffix_Y, timestamp )
 
 --- clear previous values
 new_series:clear()
 
 --- Append points to new_series
 index = 0
 while(true) do

 x = index;
 -- if not nil, get the X coordinate from a series
 if suffix_X ~= nil then 
 series_x = TimeseriesView.find( string.format( "%s.%d/%s", prefix, index, suffix_X) )
 if series_x == nil then break end
 x = series_x:atTime(timestamp)	 
 end
 
 series_y = TimeseriesView.find( string.format( "%s.%d/%s", prefix, index, suffix_Y) )
 if series_y == nil then break end 
 y = series_y:atTime(timestamp)
 
 new_series:push_back(x,y)
 index = index+1
 end
end

--[[ Similar to the built-in function GetSeriesNames(), but select only the names with a give prefix. --]]

function GetSeriesNamesByPrefix(prefix)
 -- GetSeriesNames(9 is a built-in function
 all_names = GetSeriesNames()
 filtered_names = {}
 for i, name in ipairs(all_names) do
 -- check the prefix
 if name:find(prefix, 1, #prefix) then
 table.insert(filtered_names, name);
 end
 end
 return filtered_names
end

--[[ Modify an existing series, applying offsets to all their X and Y values

 series: an existing timeseries, obtained with TimeseriesView.find(name)
 delta_x: offset to apply to each x value
 delta_y: offset to apply to each y value 
 
--]]

function ApplyOffsetInPlace(series, delta_x, delta_y)
 -- use C++ indeces, not Lua indeces
 for index=0, series:size()-1 do
 x,y = series:at(index)
 series:set(index, x + delta_x, y + delta_y)
 end
end
"/> |
| 101 | + <library code="--[[ Helper function to create a series from arrays

 new_series: a series previously created with ScatterXY.new(name)
 prefix: prefix of the timeseries, before the index of the array
 suffix_X: suffix to complete the name of the series containing the X value. If [nil], use the index of the array.
 suffix_Y: suffix to complete the name of the series containing the Y value
 timestamp: usually the tracker_time variable
 
 Example:
 
 Assuming we have multiple series in the form:
 
 /trajectory/node.{X}/position/x
 /trajectory/node.{X}/position/y
 
 where {N} is the index of the array (integer). We can create a reactive series from the array with:
 
 new_series = ScatterXY.new("my_trajectory") 
 CreateSeriesFromArray( new_series, "/trajectory/node", "position/x", "position/y", tracker_time );
--]]

function CreateSeriesFromArray( new_series, prefix, suffix_X, suffix_Y, timestamp )
 
 --- clear previous values
 new_series:clear()
 
 --- Append points to new_series
 index = 0
 while(true) do

 x = index;
 -- if not nil, get the X coordinate from a series
 if suffix_X ~= nil then 
 series_x = TimeseriesView.find( string.format( "%s.%d/%s", prefix, index, suffix_X) )
 if series_x == nil then break end
 x = series_x:atTime(timestamp)	 
 end
 
 series_y = TimeseriesView.find( string.format( "%s.%d/%s", prefix, index, suffix_Y) )
 if series_y == nil then break end 
 y = series_y:atTime(timestamp)
 
 new_series:push_back(x,y)
 index = index+1
 end
end

--[[ Similar to the built-in function GetSeriesNames(), but select only the names with a give prefix. --]]

function GetSeriesNamesByPrefix(prefix)
 -- GetSeriesNames(9 is a built-in function
 all_names = GetSeriesNames()
 filtered_names = {}
 for i, name in ipairs(all_names) do
 -- check the prefix
 if name:find(prefix, 1, #prefix) then
 table.insert(filtered_names, name);
 end
 end
 return filtered_names
end

--[[ Modify an existing series, applying offsets to all their X and Y values

 series: an existing timeseries, obtained with TimeseriesView.find(name)
 delta_x: offset to apply to each x value
 delta_y: offset to apply to each y value 
 
--]]

function ApplyOffsetInPlace(series, delta_x, delta_y)
 -- use C++ indices, not Lua indices
 for index=0, series:size()-1 do
 x,y = series:at(index)
 series:set(index, x + delta_x, y + delta_y)
 end
end
"/> |
102 | 102 | <scripts/>
|
103 | 103 | </plugin>
|
104 | 104 | <plugin ID="CSV Exporter"/>
|
105 |
| - <plugin ID="ROS2 Topic Re-Publisher"/> |
| 105 | + <plugin ID="ROS 2 Topic Re-Publisher"/> |
106 | 106 | </Plugins>
|
107 | 107 | <!-- - - - - - - - - - - - - - - -->
|
108 | 108 | <previouslyLoaded_Datafiles/>
|
109 |
| - <previouslyLoaded_Streamer name="ROS2 Topic Subscriber"/> |
| 109 | + <previouslyLoaded_Streamer name="ROS 2 Topic Subscriber"/> |
110 | 110 | <!-- - - - - - - - - - - - - - - -->
|
111 | 111 | <customMathEquations/>
|
112 | 112 | <snippets/>
|
|
0 commit comments