forked from ros/diagnostics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/add-analyzers-through-parameters' into nobleo-ros2
- Loading branch information
Showing
17 changed files
with
186 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# Aggregator Example | ||
|
||
This is a simple example to show the diagnostic_aggregator in action. It involves one python script producing dummy diagnostic data ([example_pub.py](./example_pub.py)), and one diagnostic aggregator configuration ([example.yaml](./example.yaml)) that provides analyzers aggregating it. | ||
This is a simple example to show the diagnostic_aggregator and add_analyzer in action. It involves one python script producing dummy diagnostic data ([example_pub.py](./example_pub.py)), one diagnostic aggregator configuration ([example_analyzers.yaml](./example_analyzers.yaml)) and one add_analyzer configuration ([example_add_analyzers.yaml](./example_add_analyzers.yaml)). | ||
|
||
The aggregator will launch and load all the analyzers listed in ([example_analyzers.yaml](./example_analyzers.yaml)). Then the aggregator will be notified that there are additional analyzers that we also want to load in ([example_add_analyzers.yaml](./example_add_analyzers.yaml)). After this reload all analyzers will be active. | ||
|
||
Run the example with `ros2 launch diagnostic_aggregator example.launch.py` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/**: | ||
ros__parameters: | ||
optional: | ||
type: diagnostic_aggregator/GenericAnalyzer | ||
path: Optional | ||
contains: [ '/optional' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import os | ||
|
||
import unittest | ||
|
||
from launch import LaunchDescription | ||
from launch.actions import ExecuteProcess | ||
from launch.events import matches_action | ||
from launch.events.process import ShutdownProcess | ||
|
||
import launch_testing | ||
import launch_testing.actions | ||
import launch_testing.asserts | ||
import launch_testing.util | ||
import launch_testing_ros | ||
|
||
|
||
def generate_test_description(): | ||
os.environ['OSPL_VERBOSITY'] = '8' | ||
os.environ['RCUTILS_CONSOLE_OUTPUT_FORMAT'] = '{message}' | ||
|
||
aggregator_node = ExecuteProcess( | ||
cmd=[ | ||
"@AGGREGATOR_NODE@", | ||
"--ros-args", | ||
"--params-file", | ||
"@PARAMETER_FILE@" | ||
], | ||
name='aggregator_node', | ||
emulate_tty=True, | ||
output='screen') | ||
|
||
add_analyzer = ExecuteProcess( | ||
cmd=[ | ||
"@ADD_ANALYZER@", | ||
"--ros-args", | ||
"--params-file", | ||
"@ADD_PARAMETER_FILE@" | ||
], | ||
name='add_analyzer', | ||
emulate_tty=True, | ||
output='screen') | ||
|
||
launch_description = LaunchDescription() | ||
launch_description.add_action(aggregator_node) | ||
launch_description.add_action(add_analyzer) | ||
launch_description.add_action(launch_testing.util.KeepAliveProc()) | ||
launch_description.add_action(launch_testing.actions.ReadyToTest()) | ||
return launch_description, locals() | ||
|
||
class TestAggregator(unittest.TestCase): | ||
|
||
def test_processes_output(self, proc_output, aggregator_node): | ||
"""Check aggregator logging output for expected strings.""" | ||
|
||
from launch_testing.tools.output import get_default_filtered_prefixes | ||
output_filter = launch_testing_ros.tools.basic_output_filter( | ||
filtered_prefixes=get_default_filtered_prefixes() + ['service not available, waiting...'], | ||
filtered_rmw_implementation='@rmw_implementation@' | ||
) | ||
proc_output.assertWaitFor( | ||
expected_output=launch_testing.tools.expected_output_from_file(path="@EXPECTED_OUTPUT@"), | ||
process=aggregator_node, | ||
output_filter=output_filter, | ||
timeout=15 | ||
) | ||
|
||
import time | ||
time.sleep(1) | ||
|
||
@launch_testing.post_shutdown_test() | ||
class TestAggregatorShutdown(unittest.TestCase): | ||
|
||
def test_last_process_exit_code(self, proc_info, aggregator_node): | ||
launch_testing.asserts.assertExitCodes(proc_info, process=aggregator_node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
ros__parameters: | ||
path: BASIC | ||
prefix1: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
ros__parameters: | ||
path: TEST | ||
primary: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/**: | ||
ros__parameters: | ||
path: BASIC | ||
prefix0: | ||
type: diagnostic_aggregator/GenericAnalyzer | ||
path: Zeroth | ||
contains: [ | ||
'contain0a', | ||
'contain0b' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
ros__parameters: | ||
primary: | ||
type: 'diagnostic_aggregator/AnalyzerGroup' | ||
|
6 changes: 6 additions & 0 deletions
6
diagnostic_aggregator/test/expected_output/add_all_analyzers.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/BASIC/Zeroth | ||
prefix0 | ||
/BASIC/First | ||
prefix1 | ||
/BASIC/Third | ||
prefix3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
my_path: | ||
type: diagnostic_aggregator/GenericAnalyzer | ||
path: My Path | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
my_path: | ||
type: diagnostic_aggregator/GenericAnalyzer | ||
path: Header1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
analyzers: | ||
/**: | ||
ros__parameters: | ||
log_level: debug | ||
primary: | ||
|