Skip to content
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

[WIP] Merge PR1040 #1733

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
735ff26
[jsk_tools] Add speak warnings node
iory Oct 29, 2018
e09d378
Add warn_stale option
iory May 12, 2022
b023a5d
Add is_leaf and filter function to jsk_tools'library
iory May 15, 2022
5c66bda
Refactor audible_warning
iory May 15, 2022
7db2502
Add prefix to speaking
iory May 15, 2022
f348c8d
Refactor AudibleWarning node
iory May 15, 2022
02c7aa1
[jsk_tools/audible_warning] Use priority queue instead of history
iory May 16, 2022
4d0a735
[jsk_tools/audible_warning] Enable run_stop to suppress audible warning
iory May 16, 2022
bbd8ee5
[jsk_tools/audible_warning] Add seconds_to_start_speaking option for …
iory May 16, 2022
776cd0a
[jsk_tools/audible_warning] Enable language specification
iory May 16, 2022
bbaeea4
[jsk_tools/audible_warning] Fixed namespace of diagnostics
iory May 16, 2022
9f74cfc
[jsk_tools/audible_warning] Fixed typo language to arg2 and set defau…
iory May 16, 2022
792511d
[jsk_tools/audible_warning] Wait until seconds_to_start_speaking the …
iory May 17, 2022
d8099ec
[jsk_tools/audible_warning] Output error name
iory May 17, 2022
a9b4189
[jsk_tools/audible_warning] Check status is leaf node
iory May 17, 2022
9ef4d45
[jsk_tools/audible_warning] Enable regex for blacklist
iory May 17, 2022
425e256
[jsk_tools/audible_warning] Add run_stop blacklist
iory May 17, 2022
266b93d
[jsk_tools/audible_warning] Enable blacklist message option
iory May 17, 2022
d79242b
[jsk_tools/audible_warning] Add blacklist messsage option
iory May 17, 2022
f050435
[jsk_tools/audible_warning] Add sample
iory May 17, 2022
d93ad7a
[jsk_tools/audible_warning] Add test
iory May 17, 2022
891e14c
[jsk_tools/diagnostics_utils] Import zip_longest for python2
iory May 17, 2022
4d107d9
[jsk_tools/audible_warning] Use LooseVersion for python2
iory May 17, 2022
1bae9ad
[jsk_tools/audible-warning] Set volume if it has volume property
iory May 17, 2022
c5eb67c
[jsk_tools/audible-warning] Fixed test name
iory May 17, 2022
d9014ea
[jsk_tools/audible_warning] Split sample diagnostics_analyzer
iory May 23, 2022
6332d99
[audible_warning] Add diagnostics_level_to_str
iory May 28, 2022
0e323e2
[audible_warning] Add dynamic reconfigure parameters
iory May 28, 2022
5085013
[audible_warning/sample] Fixed audible_warning node name
iory May 28, 2022
779e7f5
[audible_warning] Use dynamic reconfigure params
iory May 28, 2022
c273280
[audible_warning] Add inflection_utils for camel_to_snake case
iory Jun 3, 2022
a2ca202
[audible_warning] Add ignore after runstop time
iory May 28, 2022
30998f6
[audible_warning] Ignore if self.run_stop_(disabled|enabled)_time is …
iory Jun 3, 2022
661c97c
[audible_warning] Add docs for dynamic reconfigure's parameters
iory Jun 3, 2022
f10ab0d
[audible_warning] Move audible_warning.py to node_scripts.
iory Jun 6, 2022
6457e03
[audible_warning] Fixed lint test target path
iory Jun 6, 2022
09c87fe
[audible_warning] Fixed lint
iory Jun 6, 2022
03c579a
[audible_warning] Convert multiple space to one
iory Jun 7, 2022
186a8d4
[audible_warning] Convert colon symbol to english text
iory Jun 7, 2022
f2abb60
[audible_warning] Add publishing text
iory Jun 7, 2022
9eb2f1a
[audible_warning] Add AudibleWarningClient for reconfigure
iory Jun 8, 2022
63492ad
[audible_warning] Make speak_when_runstopped dynamic params
iory Jun 8, 2022
71436e8
[audible_warning] Don't add heap at first
iory Jun 8, 2022
84fab85
[audible_warning] Deserialize image
iory Jun 8, 2022
dff4406
[audible_warning] Fixed typo by adding ()
iory Jun 8, 2022
d053acf
[audible_warning] Add loginfo to display runstop state
iory Jun 8, 2022
218b6f7
[audible_warning] Add pseudo runstop publisher
iory Jun 8, 2022
4b9bd73
[audible_warning] Add prefix + error name to original text
iory Jun 14, 2022
ac2a857
[jsk_tools/audible_warning] Modified default speak rate to speed up.
iory Jul 6, 2022
3ce5ee9
[jsk_tools/audible_warning] Add space to published original text.
iory Jul 6, 2022
94b954f
[jsk_tools/audible_warning] Set wait_speak_duration_time to wait acti…
iory Jul 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions doc/jsk_tools/scripts/audible_warning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
audible\_warning.py
=======================

## What is this

This is a general node that subscribes to `/diagnostics_agg` to speak the error content.
Robots using diagnostics can use this node.

## Target Action

* `/robotsound` (`sound_play/SoundRequestAction`)

Target action name.

If it is a different server name, please remap it like `<remap from="/robotsound" to="/sound_play" />`.

## Subscribing Topics

* `/diagnostics_agg` (`diagnostic_msgs/DiagnosticArray`)

Aggregated diagnostics.


## Parameter

* `~speak_rate` (`Float`, default: `1.0 / 100.0`)

Rate of speak loop. If `~wait_speak` is `True`, wait until a robot finish speaking.

* `~speak_interval` (`Float`, default: `120.0`)

The same error will not be spoken until this number of seconds has passed.

* `~volume` (`Float`, default: `1.0`)

Volume of speaking.

* `~language` (`String`, default: `""`)

Language parameters for `arg2` in `sound_play/SoundRequestAction`.

* `~wait_speak` (`Bool`, default: `True`)

If `True`, wait until finish saying one error.

* `~seconds_to_start_speaking` (`Float`, default: `0.0`)

It is the time to wait for the node to speak after it has started.

This is useful for ignoring errors that occur when the robot starts.

* `~wait_speak_duration_time` (`Float`, default: `30.0`)

Waiting time in `robotsound` action.

* `~enable` (`Bool`, default: `True`)

If `True`, speak diagnositcs. If `False`, this node don't speak.

* `~speak_ok` (`Bool`, default: `False`)

If `True`, speak ok level diagnostics.

* `~speak_warn` (`Bool`, default: `True`)

If `True`, speak warning level diagnostics.

* `~speak_error` (`Bool`, default: `True`)

If `True`, speak error level diagnostics.

* `~speak_stale` (`Bool`, default: `True`)

If `True`, speak stale level diagnostics.

* `~speak_when_runstopped` (`Bool`, default: `True`)

If `True`, speak an error even if runstop is `True`.

* `~run_stop_topic` (`String`, default: `None`)

Subscribe this topic if this value is specified.

* `~run_stop_condition` (`String`, default: `m.data == True`)

Returning bool value condition using the given Python expression.
The Python expression can access any of the Python builtins plus:
``topic`` (the topic of the message), ``m`` (the message) and ``t`` (time of message).

For example, ``~run_stop_topic`` is ``robot_state (fetch_driver_msgs/RobotState)`` and if you want to check whether a runstop is a pressed, you can do the following.

```bash
run_stop_condition: "m.runstopped is True"
```

* `~ignore_time_after_runstop_is_enabled` (`Float`, default: `0.0`)

Time to ignore diagnostics after runstop is enabled.

* `~ignore_time_after_runstop_is_disabled` (`Float`, default: `0.0`)

Time to ignore diagnostics after runstop is disabled.

- `~blacklist` (`Yaml`, required)

User must always specify `name`. You can specify `message` as an option.

These values are matched using python regular expressions.

It is something like below:

```
<!-- speak warning -->
<node name="audible_warning"
pkg="jsk_tools" type="audible_warning.py"
output="screen" >
<remap from="/robotsound" to="/sound_play" />
<rosparam>
run_stop_topic: robot_state
run_stop_condition: "m.runstopped is True"
seconds_to_start_speaking: 30
blacklist:
- "/CPU/CPU Usage/my_machine CPU Usage"
- "/SoundPlay/sound_play: Node State"
- "/Other/jsk_joy_node: Joystick Driver Status"
- "/Other/Combined Gyro"
- "/Other/l515_head l515_head_realsense2_camera_color: Frequency Status"
- "/Other/l515_head l515_head_realsense2_camera_confidence: Frequency Status"
- "/Other/l515_head l515_head_realsense2_camera_depth: Frequency Status"
- "/Other/l515_head l515_head_realsense2_camera_infra: Frequency Status"
- "/Other/ukf_se: Filter diagnostic updater"
- "/Peripherals/PS3 Controller"
- "/Sensors/IMU/IMU 1 Gyro"
- "/Sensors/IMU/IMU 2 Gyro"
run_stop_blacklist:
- "\\w*_(mcb|breaker)"
- "/Motor Control Boards/.*"
- "/Breakers/.*"
</rosparam>
</node>
```

- `~run_stop_blacklist` (`Yaml`, optional)

This is valid when run_stop is `True`. Blacklist at run_stop.


## Usage

Listen warnings from diagnostics.

```bash
roslaunch jsk_tools sample_audible_warning.launch
```

![audible_warning](./images/audible_warning.jpg)
Binary file added doc/jsk_tools/scripts/images/audible_warning.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions jsk_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
cmake_minimum_required(VERSION 2.8.3)
project(jsk_tools)

find_package(catkin REQUIRED)
find_package(catkin REQUIRED
COMPONENTS
dynamic_reconfigure)
catkin_python_setup()
set(ROS_BUILD_TYPE RelWithDebInfo)

generate_dynamic_reconfigure_options(
cfg/AudibleWarning.cfg
)

catkin_package(
CATKIN_DEPENDS #
CATKIN_DEPENDS dynamic_reconfigure #
LIBRARIES #
INCLUDE_DIRS #
DEPENDS #
Expand All @@ -27,6 +34,7 @@ endforeach(exec)

if (CATKIN_ENABLE_TESTING)
find_package(roslint REQUIRED)
roslint_python(node_scripts/audible_warning.py)
roslint_python(src/jsk_tools/cltool.py)
roslint_python(src/test_topic_published.py)
roslint_python(src/test_rosparam_set.py)
Expand All @@ -49,6 +57,7 @@ if (CATKIN_ENABLE_TESTING)
# https://github.com/jsk-ros-pkg/jsk_common/pull/1293#issuecomment-164158260
jsk_tools_add_rostest(test/test_rosparam_set.test)
endif()
jsk_tools_add_rostest(test/test_audible_warning.test)
jsk_tools_add_rostest(test/test_stdout.test)
jsk_tools_add_rostest(test/test_rostopic_host_sanity.test)
jsk_tools_add_rostest(test/test_sanity_diagnostics.test)
Expand All @@ -74,7 +83,7 @@ install(DIRECTORY test
USE_SOURCE_PERMISSIONS
PATTERN "*.test" EXCLUDE
)
install(DIRECTORY src dot-files cmake launch sample
install(DIRECTORY src dot-files cmake launch sample node_scripts
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
USE_SOURCE_PERMISSIONS
)
Expand Down
26 changes: 26 additions & 0 deletions jsk_tools/cfg/AudibleWarning.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /usr/bin/env python


from dynamic_reconfigure.parameter_generator_catkin import *

PACKAGE = 'jsk_tools'

gen = ParameterGenerator()
speak_group = gen.add_group("speak flag")
speak_group.add("enable", bool_t, 0, "Flag of speak", True)
speak_group.add("speak_ok", bool_t, 0, "Speak ok level diagnostics", False)
speak_group.add("speak_stale", bool_t, 0, "Speak stale level diagnostics", True)
speak_group.add("speak_warn", bool_t, 0, "Speak warn level diagnostics", True)
speak_group.add("speak_error", bool_t, 0, "Speak error level diagnostics", True)
speak_group.add("speak_when_runstopped", bool_t, 0, "Speak when runstop is enabled", True)

gen.add("volume", double_t, 0, "Volume of sound.", 1.0, 0.0, 1.0)
gen.add("speak_interval", double_t, 0, "Volume of sound.", 120.0, 0.0, 3600.0)
gen.add("ignore_time_after_runstop_is_enabled", double_t, 0,
"Time to ignore diagnostics after runstop is enabled.",
0.0, 0.0, 3600.0)
gen.add("ignore_time_after_runstop_is_disabled", double_t, 0,
"Time to ignore diagnostics after runstop is disabled.",
0.0, 0.0, 3600.0)

exit(gen.generate(PACKAGE, PACKAGE, "AudibleWarning"))
Loading