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 develop/fetch branch #1765

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
d62207a
[jsk_tools] Add speak warnings node
iory Oct 29, 2018
83644d4
Add warn_stale option
iory May 12, 2022
3750577
Add is_leaf and filter function to jsk_tools'library
iory May 15, 2022
2ff889a
Refactor audible_warning
iory May 15, 2022
dd7ddf6
Add prefix to speaking
iory May 15, 2022
e189677
Refactor AudibleWarning node
iory May 15, 2022
e93e363
[jsk_tools/audible_warning] Use priority queue instead of history
iory May 16, 2022
3e45382
[jsk_tools/audible_warning] Enable run_stop to suppress audible warning
iory May 16, 2022
91ecd31
[jsk_tools/audible_warning] Add seconds_to_start_speaking option for …
iory May 16, 2022
2eb51a2
[jsk_tools/audible_warning] Enable language specification
iory May 16, 2022
aab38ff
[jsk_tools/audible_warning] Fixed namespace of diagnostics
iory May 16, 2022
003b586
[jsk_tools/audible_warning] Fixed typo language to arg2 and set defau…
iory May 16, 2022
03e2c6a
[jsk_tools/audible_warning] Wait until seconds_to_start_speaking the …
iory May 17, 2022
2fe97c2
[jsk_tools/audible_warning] Output error name
iory May 17, 2022
d65bacc
[jsk_tools/audible_warning] Check status is leaf node
iory May 17, 2022
793179b
[jsk_tools/audible_warning] Enable regex for blacklist
iory May 17, 2022
e9550ac
[jsk_tools/audible_warning] Add run_stop blacklist
iory May 17, 2022
917f853
[jsk_tools/audible_warning] Enable blacklist message option
iory May 17, 2022
3f9d7ab
[jsk_tools/audible_warning] Add blacklist messsage option
iory May 17, 2022
1f1e299
[jsk_tools/audible_warning] Add sample
iory May 17, 2022
f0aec04
[jsk_tools/audible_warning] Add test
iory May 17, 2022
9993337
[jsk_tools/diagnostics_utils] Import zip_longest for python2
iory May 17, 2022
27d2fe1
[jsk_tools/audible_warning] Use LooseVersion for python2
iory May 17, 2022
769ccc4
[jsk_tools/audible-warning] Set volume if it has volume property
iory May 17, 2022
9b24b9c
[jsk_tools/audible-warning] Fixed test name
iory May 17, 2022
188c2e8
[jsk_tools/audible_warning] Split sample diagnostics_analyzer
iory May 23, 2022
fb4536c
[jsk_tools] add rossetclient
sktometometo Jun 28, 2022
c6073bc
[audible_warning] Add diagnostics_level_to_str
iory May 28, 2022
012f514
[audible_warning] Add dynamic reconfigure parameters
iory May 28, 2022
7473d07
[audible_warning/sample] Fixed audible_warning node name
iory May 28, 2022
9bf9f1b
[audible_warning] Use dynamic reconfigure params
iory May 28, 2022
024f67b
[audible_warning] Add inflection_utils for camel_to_snake case
iory Jun 3, 2022
1ffabe7
[audible_warning] Add ignore after runstop time
iory May 28, 2022
b16778a
[audible_warning] Ignore if self.run_stop_(disabled|enabled)_time is …
iory Jun 3, 2022
b42daed
[audible_warning] Add docs for dynamic reconfigure's parameters
iory Jun 3, 2022
69757a4
[audible_warning] Move audible_warning.py to node_scripts.
iory Jun 6, 2022
78f3928
[audible_warning] Fixed lint test target path
iory Jun 6, 2022
8e119f6
[audible_warning] Fixed lint
iory Jun 6, 2022
1b10cb3
[audible_warning] Convert multiple space to one
iory Jun 7, 2022
a044fcd
[audible_warning] Convert colon symbol to english text
iory Jun 7, 2022
cf21b2c
[audible_warning] Add publishing text
iory Jun 7, 2022
42332db
[audible_warning] Add AudibleWarningClient for reconfigure
iory Jun 8, 2022
6d3d940
[audible_warning] Make speak_when_runstopped dynamic params
iory Jun 8, 2022
d38121c
[audible_warning] Don't add heap at first
iory Jun 8, 2022
d0c4d4e
[audible_warning] Deserialize image
iory Jun 8, 2022
2998324
[audible_warning] Fixed typo by adding ()
iory Jun 8, 2022
890dbc2
[audible_warning] Add loginfo to display runstop state
iory Jun 8, 2022
99c6aa9
[audible_warning] Add pseudo runstop publisher
iory Jun 8, 2022
5217806
[audible_warning] Add prefix + error name to original text
iory Jun 14, 2022
22c96e1
[jsk_tools/audible_warning] Modified default speak rate to speed up.
iory Jul 6, 2022
688ea1e
[jsk_tools/audible_warning] Add space to published original text.
iory Jul 6, 2022
22972c1
[jsk_tools/audible_warning] Set wait_speak_duration_time to wait acti…
iory Jul 6, 2022
c17036d
catch StopIteration when all images do not have stamp
knorth55 Sep 30, 2022
b302557
Merge pull request #1768 from knorth55/develop/fetch-jsk-rosbag-tools…
knorth55 Mar 20, 2023
deb6654
Merge branch 'master' into develop/fetch
knorth55 Mar 20, 2023
acd431e
auto lambda for c++14
knorth55 Mar 21, 2023
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"))
25 changes: 24 additions & 1 deletion jsk_tools/env-hooks/99.jsk_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ _update_prompt() {
export PS1="${WITHOUT_ROS_PROMPT}"
fi
elif [ "$master_host" != "" ]; then
local ros_prompt="[$ROS_MASTER_URI][$ROS_IP]"
if [[ "$ROS_HOSTNAME" != "" && "$ROS_IP" == "" ]]; then
local ros_prompt="[$ROS_MASTER_URI][$ROS_HOSTNAME]"
else
local ros_prompt="[$ROS_MASTER_URI][$ROS_IP]"
fi
if [ "$CATKIN_SHELL" = "bash" ]; then
export PS1="\[\033[00;31m\]$ros_prompt\[\033[00m\] ${WITHOUT_ROS_PROMPT}"
elif [ "$CATKIN_SHELL" = "zsh" ]; then
Expand Down Expand Up @@ -86,6 +90,7 @@ rossetip_dev() {

rossetip_addr() {
local target_host=${1-"133.11.216.211"}
echo "target_host: $target_host"
# Check if target_host looks like ip address or not
if [ "$(echo $target_host | sed -e 's/[0-9\.]//g')" != "" ]; then
target_host_ip=$(timeout 0.01 getent hosts ${target_host} | cut -f 1 -d ' ')
Expand Down Expand Up @@ -125,6 +130,24 @@ rossetip() {
fi
}

rossetclient() {
local client_interface=$1
if [[ $client_interface =~ [0-9]+.[0-9]+.[0-9]+.[0-9]+ ]]; then
export ROS_IP="$client_interface"
else
local addr_if_client_is_device=${LANC=C ip -o -4 a | grep lo\ \ \ | cut -d\ -f7 | cut -d\/ -f1}
if [[ $addr_if_client_is_device = "" ]]; then
export ROS_IP="$addr_if_client_is_device"
else
export ROS_HOSTNAME="$client_interface"
fi
fi
echo -e "\e[1;31mset ROS_IP to \"$ROS_IP\" and ROS_HOSTNAME to \"$ROS_HOSTNAME\"\e[m"
if [ "$NO_ROS_PROMPT" = "" ]; then
_update_prompt
fi
}

rosn() {
if [ "$1" = "" ]; then
select=$(rosnode list | percol | xargs -n 1 rosnode info | percol)
Expand Down
Loading