Conversation
There was a problem hiding this comment.
Hi @robobe. Thanks for your PR. This looks amazing. 😁
I hope I will find the time for a proper review soon. Just something I noticed:
- All source files are missing copyright headers
- Please update the package.xml and do what else is required for the buildfarm to run.
Co-authored-by: Christian Henkel <6976069+ct2034@users.noreply.github.com>
remove math case remove some of pylint warnings
todo: add regex for extract node name from diagnostic name
ct2034
left a comment
There was a problem hiding this comment.
Please move the work on diagnostics_tutorial to a separate PR, such that I can review the ros2diagnostics_cli separately. And if you are still working on this, please use the draft PR feature. Otherwise, this creates a lot of overhead. Some points:
- Please add your package under https://github.com/robobe/diagnostics/blob/98b78aaa544b5ad06b4810d61bd5394b425f2013/.github/workflows/lint.yaml#L38-L39 and https://github.com/robobe/diagnostics/blob/98b78aaa544b5ad06b4810d61bd5394b425f2013/.github/workflows/test.yaml#L19-L20 so that it is checked in the github ci.
- The package.xml needs some fields filled. The version must be the same as the other packages in this repo. You can add me as a maintainer and yourself as author if you like.
- Similar things apply to the setup.py
- I am not quite sure what the two verbs
showandlistdo. Both seem to have a functionality that I would callechoat least when compared to how thetopicverb does things. - What does the
worldverb do? It does not seem to be documented.
In general this seems very work in progress. Please make this a draft PR, then.
|
I was able to make it into a draft myself, nvm. Just click |
todo: add regex for extract node name from diagnostic name
Signed-off-by: Christian Henkel <christian.henkel2@de.bosch.com>
Signed-off-by: Christian Henkel <christian.henkel2@de.bosch.com>
Signed-off-by: Christian Henkel <christian.henkel2@de.bosch.com>
ct2034
left a comment
There was a problem hiding this comment.
Can you please describe the intended use case for the list and show verb? I feel like there is an overlap. In my opinion, two verbs are required:
list - it lists all available diagnostics sources and the exits
echo - it will run forever and echo all the diagnostics info on a specific source.
Basically similar to how theses two verbs work for the topic command right now
| base_dir = pathlib.Path(csv_file).parents[0] | ||
| folder_exists = pathlib.Path(base_dir).is_dir() | ||
| if not folder_exists: | ||
| raise Exception( |
There was a problem hiding this comment.
Please use a more specific exception type
| b'\x00': ('OK', GREEN + 'OK' + COLOR_DEFAULT), | ||
| b'\x01': ('WARN', YELLOW + 'WARN' + COLOR_DEFAULT), | ||
| b'\x02': ('ERROR', RED + 'ERROR' + COLOR_DEFAULT), | ||
| b'\x03': ('STALE', RED + 'STALE' + COLOR_DEFAULT), |
There was a problem hiding this comment.
Please use the constants declared in dagnostic_msgs.msg.DiagnosticStatus
There was a problem hiding this comment.
And you can also use f-strings here
| <test_depend>ament_flake8</test_depend> | ||
| <!-- <test_depend>ament_pep257</test_depend> --> | ||
| <test_depend>python3-pytest</test_depend> | ||
| <depend>ros2cli</depend> |
There was a problem hiding this comment.
All required packages from this repo must be declared here
| try: | ||
| self.csv = open_file_for_output(args.output) | ||
| except Exception as error: | ||
| print(str(error)) |
There was a problem hiding this comment.
| print(str(error)) | |
| print(error) |
| ] | ||
| if verbose: | ||
| kv: KeyValue | ||
| for kv in status.values: |
There was a problem hiding this comment.
| for kv in status.values: | |
| line.extend(kv.value for kv in status.values) |
| ) | ||
|
|
||
| def render(self, status: DiagnosticStatus, time_sec, verbose=False): | ||
| level_name, _ = convert_level_to_str(status.level) |
There was a problem hiding this comment.
I don't see how this is imported
| if not self.__levels: | ||
| return False |
There was a problem hiding this comment.
| if not self.__levels: | |
| return False | |
| return False if not self.__levels else level not in self.__levels |
|
|
||
| def add_common_arguments(parser: ArgumentParser): | ||
| """Add common arguments for csv and show verbs.""" | ||
| parser.add_argument('-1', '--once', action='store_true', help='run only once') |
There was a problem hiding this comment.
| parser.add_argument('-1', '--once', action='store_true', help='run only once') | |
| parser.add_argument( | |
| '-1', | |
| '--once', | |
| action='store_true', | |
| help='run only once') |
| """Add common arguments for csv and show verbs.""" | ||
| parser.add_argument('-1', '--once', action='store_true', help='run only once') | ||
| parser.add_argument( | ||
| '-f', '--filter', type=str, help='filter diagnostic status name' |
There was a problem hiding this comment.
| '-f', '--filter', type=str, help='filter diagnostic status name' | |
| '-f', | |
| '--filter', | |
| type=str, | |
| help='filter diagnostic status name' |
|
This looks useful - has there been movement on this? |
|
@robobe do you mind if I take over this PR if you're not interested/don't have the time? |
|
Hi @ct2034 will do when I get some time. |
|
Hi @ct2034 I have begun the work: https://github.com/russkel/diagnostics/tree/ros2cli_diagnostics I have addressed your suggestions and am going to do the following:
Are you able to change the repo of this PR or should I create a new one? |
|
Thanks for your work @russkel. I can not edit the branch this PR is from. Please create a new one. Than I can close this one |
Add ros2cli for diagnostics as alternative for diagnostics_analysis
The project add
diagnosticscommand to ROS2 cli with there verbs.check README.md for more