-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ros2cli diagnostics #301
Draft
robobe
wants to merge
25
commits into
ros:ros2
Choose a base branch
from
robobe:ros2cli_diagnostics
base: ros2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Ros2cli diagnostics #301
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0262e0b
ros2diagnostics cli init
f177bed
rename hello to diagnostics
c2a4669
add option with string
6c7269a
arg parse examples
871095d
add csv verb
e9f6803
version 0.0.1
c4fd102
Update ros2diagnostics_cli/package.xml
robobe c4175a7
clean test and scripts file
2b13ff7
add copyright
8124d08
fix: support python 3.8 remove match
064d3f3
format and run linters
c4c08f0
fix: suport python 3.8
d57f8c8
fix flake8 errors
deba6b3
init tutorials
2e23d8b
fix: handle name without clone task name separator
98b78aa
fix: extract node name
feacb0d
fix: handle name without clone task name separator
c77d4e4
fix: extract node name
ddfba3b
set version and license
e44dbbf
Merge branch 'ros2cli_diagnostics' of dia:robobe/diagnostics into ros…
82cc52b
remove diagnostic_tutorial from PR
64de761
Merge branch 'ros2' into pr/robobe/301
ct2034 b8ce45d
gh tests for the new package
ct2034 e6a8956
fixing flake8 errors
ct2034 c5bf964
fixing pep257 errors
ct2034 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,5 @@ jobs: | |
diagnostic_aggregator | ||
diagnostic_common_diagnostics | ||
diagnostic_updater | ||
ros2diagnostics_cli | ||
self_test |
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,152 @@ | ||
# ROS2 diagnostic cli | ||
|
||
ROS2 cli to analysis and monitor `/diagnostics` topic | ||
It's alternative to `diagnostic_analysis` project that not ported yet to ROS2. | ||
|
||
The project add `diagnostics` command to ROS2 cli with there verbs. | ||
|
||
- list | ||
- show | ||
- csv | ||
|
||
### list | ||
Monitor the current diagnostics_status message from `/diagnostics` topic group by Node name and print `diagnostics status` name | ||
|
||
```bash | ||
ros2 diagnostics list | ||
# Result | ||
--- time: 1682528234 --- | ||
diagnostic_simple: | ||
- DemoTask | ||
- DemoTask2 | ||
``` | ||
|
||
### show | ||
Monitor `/diagnostics` topic and print the diagnostics_status data can filter by level and node/status name | ||
|
||
```bash | ||
ros2 diagnostics show -h | ||
usage: ros2 diagnostics show [-h] [-1] [-f FILTER] [--verbose] [-l {info,warn,error}] | ||
|
||
Show diagnostics status item info | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
-1, --once run only once | ||
-f FILTER, --filter FILTER | ||
filter diagnostic status name | ||
--verbose, -v Display more info. | ||
-l {info,warn,error}, --levels {info,warn,error} | ||
levels to filter, can be multiple times | ||
``` | ||
|
||
#### demo | ||
|
||
```bash title="show all diagnostics status" | ||
ros2 diagnostics show | ||
# | ||
--- time: 1682528494 --- | ||
diagnostic_simple: DemoTask: WARN, running | ||
diagnostic_simple: DemoTask2: ERROR, bad | ||
--- time: 1682528495 --- | ||
diagnostic_simple: DemoTask: WARN, running | ||
diagnostic_simple: DemoTask2: ERROR, bad | ||
``` | ||
|
||
```bash title="filter by level" | ||
ros2 diagnostics show -l error | ||
--- time: 1682528568 --- | ||
diagnostic_simple: DemoTask2: ERROR, bad | ||
--- time: 1682528569 --- | ||
diagnostic_simple: DemoTask2: ERROR, bad | ||
--- time: 1682528570 --- | ||
``` | ||
|
||
```bash title="filter by name" | ||
ros2 diagnostics show -f Task2 | ||
# | ||
--- time: 1682528688 --- | ||
diagnostic_simple: DemoTask2: ERROR, bad | ||
--- time: 1682528689 --- | ||
diagnostic_simple: DemoTask2: ERROR, bad | ||
``` | ||
|
||
```bash title="verbose usage" | ||
ros2 diagnostics show -l warn -v | ||
# | ||
--- time: 1682528760 --- | ||
diagnostic_simple: DemoTask: WARN, running | ||
- key1=val1 | ||
- key2=val2 | ||
--- time: 1682528761 --- | ||
diagnostic_simple: DemoTask: WARN, running | ||
- key1=val1 | ||
- key2=val2 | ||
|
||
``` | ||
|
||
### csv | ||
Export `/diagnostics` topic to csv file | ||
|
||
**CSV headers**: | ||
- time (sec) | ||
- level | ||
- node name | ||
- diagnostics status name | ||
- message | ||
- hardware id | ||
- values from keyvalue field (only on verbose) | ||
|
||
|
||
```bash | ||
ros2 diagnostics csv --help | ||
usage: ros2 diagnostics csv [-h] [-1] [-f FILTER] [-l {info,warn,error}] [--output OUTPUT] [--verbose] | ||
|
||
export /diagnostics message to csv file | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
-1, --once run only once | ||
-f FILTER, --filter FILTER | ||
filter diagnostic status name | ||
-l {info,warn,error}, --levels {info,warn,error} | ||
levels to filter, can be multiple times | ||
--output OUTPUT, -o OUTPUT | ||
export file full path | ||
--verbose, -v export DiagnosticStatus values filed | ||
``` | ||
|
||
#### Demos | ||
|
||
```bash title="simple csv file" | ||
ros2 diagnostics csv -o /tmp/1.csv | ||
--- time: 1682529183 --- | ||
1682529183,WARN,diagnostic_simple,DemoTask,running, | ||
``` | ||
|
||
```bash title="show csv file" | ||
cat /tmp/1.csv | ||
|
||
1682529183,WARN,diagnostic_simple,DemoTask,running, | ||
1682529183,ERROR,diagnostic_simple,DemoTask2,bad, | ||
``` | ||
|
||
```bash title="filter by level" | ||
ros2 diagnostics csv -o /tmp/1.csv -l error | ||
``` | ||
|
||
```bash title="filter by name with regex" | ||
ros2 diagnostics csv -o /tmp/1.csv -f Task$ -v | ||
``` | ||
|
||
## Todo | ||
- More tests | ||
- Add unit test | ||
- DEB package and install tests | ||
- Ideas | ||
|
||
|
||
## Tests | ||
``` | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="2"> | ||
<name>ros2diagnostics_cli</name> | ||
<version>3.1.2</version> | ||
<description>diagnostic command for ROS2 command line, parse and show /diagnostics topic</description> | ||
<maintainer email="[email protected]"></maintainer> | ||
<maintainer email="[email protected]">Christian Henkel</maintainer> | ||
<license>BSD-3-Clause</license> | ||
|
||
<test_depend>ament_copyright</test_depend> | ||
<test_depend>ament_flake8</test_depend> | ||
<!-- <test_depend>ament_pep257</test_depend> --> | ||
<test_depend>python3-pytest</test_depend> | ||
<depend>ros2cli</depend> | ||
<depend>python3-yaml</depend> | ||
<export> | ||
<build_type>ament_python</build_type> | ||
</export> | ||
</package> |
Empty file.
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All required packages from this repo must be declared here