diff --git a/jsk_fetch_robot/jsk_fetch.rosinstall.melodic b/jsk_fetch_robot/jsk_fetch.rosinstall.melodic
index d7ca64262f..3cdd4ee529 100644
--- a/jsk_fetch_robot/jsk_fetch.rosinstall.melodic
+++ b/jsk_fetch_robot/jsk_fetch.rosinstall.melodic
@@ -5,10 +5,12 @@
# https://github.com/PR2/app_manager/pull/50
# In order to run multiple app_managers in one master, we need this PR
# https://github.com/PR2/app_manager/pull/54
+# This PR add run_name entry to specif node name when we use run entry
+# https://github.com/PR2/app_manager/pull/64
- git:
local-name: PR2/app_manager
- uri: https://github.com/knorth55/app_manager.git
- version: fetch15
+ uri: https://github.com/tkmtnt7000/app_manager.git
+ version: add-run-name-entry-fetch15
# we need this for proximity sensors
- git:
local-name: RoboticMaterials/FA-I-sensor
diff --git a/jsk_fetch_robot/jsk_fetch_startup/CMakeLists.txt b/jsk_fetch_robot/jsk_fetch_startup/CMakeLists.txt
index 96d03f10ea..41d435037b 100644
--- a/jsk_fetch_robot/jsk_fetch_startup/CMakeLists.txt
+++ b/jsk_fetch_robot/jsk_fetch_startup/CMakeLists.txt
@@ -11,6 +11,7 @@ endif()
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
+ dynamic_reconfigure
roscpp
std_msgs
sensor_msgs
@@ -24,10 +25,16 @@ find_package(catkin REQUIRED COMPONENTS
)
find_package(Boost REQUIRED COMPONENTS)
+generate_dynamic_reconfigure_options(
+ cfg/TimeSignal.cfg
+)
+
###################################
## catkin specific configuration ##
###################################
-catkin_package()
+catkin_package(
+ CATKIN_DEPENDS dynamic_reconfigure
+)
catkin_add_env_hooks(99.jsk_fetch_startup SHELLS bash zsh sh
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)
diff --git a/jsk_fetch_robot/jsk_fetch_startup/apps/time_signal/time_signal.app b/jsk_fetch_robot/jsk_fetch_startup/apps/time_signal/time_signal.app
index 6137ee226b..e82fe5629f 100644
--- a/jsk_fetch_robot/jsk_fetch_startup/apps/time_signal/time_signal.app
+++ b/jsk_fetch_robot/jsk_fetch_startup/apps/time_signal/time_signal.app
@@ -1,6 +1,8 @@
display: Speak time signal
platform: fetch
run: jsk_fetch_startup/time_signal.py
+run_name: "time_signal"
+# run_name needs https://github.com/PR2/app_manager/pull/64
interface: jsk_fetch_startup/time_signal.interface
icon: jsk_fetch_startup/time_signal.png
timeout: 120
diff --git a/jsk_fetch_robot/jsk_fetch_startup/cfg/TimeSignal.cfg b/jsk_fetch_robot/jsk_fetch_startup/cfg/TimeSignal.cfg
new file mode 100644
index 0000000000..e22d48bc1e
--- /dev/null
+++ b/jsk_fetch_robot/jsk_fetch_startup/cfg/TimeSignal.cfg
@@ -0,0 +1,11 @@
+#! /usr/bin/env python
+
+
+from dynamic_reconfigure.parameter_generator_catkin import *
+
+PACKAGE = 'jsk_fetch_startup'
+
+gen = ParameterGenerator()
+gen.add("volume", double_t, 0, "Volume of sound.", 1.0, 0.0, 1.0)
+
+exit(gen.generate(PACKAGE, PACKAGE, "TimeSignal"))
diff --git a/jsk_fetch_robot/jsk_fetch_startup/package.xml b/jsk_fetch_robot/jsk_fetch_startup/package.xml
index 70d3f9eda9..f83da9e637 100644
--- a/jsk_fetch_robot/jsk_fetch_startup/package.xml
+++ b/jsk_fetch_robot/jsk_fetch_startup/package.xml
@@ -12,7 +12,9 @@
catkin
fetch_teleop
+ dynamic_reconfigure
+ dynamic_reconfigure
image_proc
jsk_fetch_accessories
jsk_fetch_diagnosis
diff --git a/jsk_fetch_robot/jsk_fetch_startup/scripts/time_signal.py b/jsk_fetch_robot/jsk_fetch_startup/scripts/time_signal.py
index 321714985a..083e12c658 100755
--- a/jsk_fetch_robot/jsk_fetch_startup/scripts/time_signal.py
+++ b/jsk_fetch_robot/jsk_fetch_startup/scripts/time_signal.py
@@ -8,12 +8,14 @@
import sys
import urllib2
+from dynamic_reconfigure.server import Server
+from jsk_fetch_startup.cfg import TimeSignalConfig as Config
from sound_play.msg import SoundRequestAction
from sound_play.msg import SoundRequestGoal
class TimeSignal(object):
- def __init__(self):
+ def __init__(self, volume=1.0):
self.client_en = actionlib.SimpleActionClient(
'/sound_play', SoundRequestAction)
self.client_jp = actionlib.SimpleActionClient(
@@ -23,6 +25,8 @@ def __init__(self):
self.now_hour = self.now_time.hour
self.now_minute = self.now_time.minute
self.day = self.now_time.strftime('%a')
+ self.volume = volume
+ self.srv = Server(Config, self.config_callback)
reload(sys)
sys.setdefaultencoding('utf-8')
api_key_file = rospy.get_param(
@@ -35,7 +39,7 @@ def speak(self, client, speech_text, lang=None):
sound_goal = SoundRequestGoal()
sound_goal.sound_request.sound = -3
sound_goal.sound_request.command = 1
- sound_goal.sound_request.volume = 1.0
+ sound_goal.sound_request.volume = self.volume
if lang is not None:
sound_goal.sound_request.arg2 = lang
sound_goal.sound_request.arg = speech_text
@@ -153,6 +157,20 @@ def _get_weather_forecast(self, lang='en'):
forecast_text += " The wind speed is {} meter per second.".format(wind_speed)
return forecast_text
+ def _set_volume(self, volume):
+ '''
+ Set speak volume between 0.0 and 1.0
+ '''
+ volume = min(max(0.0, volume), 1.0)
+ if self.volume != volume:
+ self.volume = volume
+ rospy.loginfo("time_signal's volume was set to {}".format(
+ self.volume))
+
+ def config_callback(self, config, level):
+ self._set_volume(config.volume)
+ return config
+
if __name__ == '__main__':
rospy.init_node('time_signal')
diff --git a/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_lower.l b/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_lower.l
index 48c236a58c..6696fe3f16 100755
--- a/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_lower.l
+++ b/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_lower.l
@@ -11,4 +11,5 @@
(ros::set-dynamic-reconfigure-param "/tweet_client_uptime" "volume" :double 0.2)
(ros::set-dynamic-reconfigure-param "/tweet_client_warning" "volume" :double 0.2)
(ros::set-dynamic-reconfigure-param "/tweet_client_worktime" "volume" :double 0.2)
+(ros::set-dynamic-reconfigure-param "/time_signal" "volume" :double 0.2)
(exit)
diff --git a/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_reset.l b/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_reset.l
index a57c51c262..315e9151af 100755
--- a/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_reset.l
+++ b/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_reset.l
@@ -11,4 +11,5 @@
(ros::set-dynamic-reconfigure-param "/tweet_client_uptime" "volume" :double 1.0)
(ros::set-dynamic-reconfigure-param "/tweet_client_warning" "volume" :double 1.0)
(ros::set-dynamic-reconfigure-param "/tweet_client_worktime" "volume" :double 1.0)
+(ros::set-dynamic-reconfigure-param "/time_signal" "volume" :double 1.0)
(exit)
diff --git a/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_zero.l b/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_zero.l
index e0bb7d2c43..39c58b530e 100755
--- a/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_zero.l
+++ b/jsk_robot_common/jsk_robot_startup/lifelog/auto_speak_volume_zero.l
@@ -11,4 +11,5 @@
(ros::set-dynamic-reconfigure-param "/tweet_client_uptime" "volume" :double 0.0)
(ros::set-dynamic-reconfigure-param "/tweet_client_warning" "volume" :double 0.0)
(ros::set-dynamic-reconfigure-param "/tweet_client_worktime" "volume" :double 0.0)
+(ros::set-dynamic-reconfigure-param "/time_signal" "volume" :double 0.0)
(exit)