-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
jsk_robot_common/jsk_robot_startup/apps/check_use_sim_time/check_use_sim_time.app
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,5 @@ | ||
display: Check /use_sim_time param | ||
platform: all | ||
launch: jsk_robot_startup/check_use_sim_time.xml | ||
interface: jsk_robot_startup/check_use_sim_time.interface | ||
icon: jsk_robot_startup/check_use_sim_time.png |
2 changes: 2 additions & 0 deletions
2
jsk_robot_common/jsk_robot_startup/apps/check_use_sim_time/check_use_sim_time.interface
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,2 @@ | ||
published_topics: {} | ||
subscribed_topics: {} |
Binary file added
BIN
+25.9 KB
jsk_robot_common/jsk_robot_startup/apps/check_use_sim_time/check_use_sim_time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions
53
jsk_robot_common/jsk_robot_startup/apps/check_use_sim_time/check_use_sim_time.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,53 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import actionlib | ||
import rospy | ||
import sys | ||
|
||
from sound_play.msg import SoundRequestAction | ||
from sound_play.msg import SoundRequestGoal | ||
|
||
|
||
class CheckUseSimTime(object): | ||
def __init__(self): | ||
self.warning = rospy.get_param('~warning', True) | ||
self.override = rospy.get_param('~override', True) | ||
self.client_jp = actionlib.SimpleActionClient( | ||
'/robotsound_jp', SoundRequestAction) | ||
|
||
def run(self): | ||
use_sim_time = rospy.get_param('/use_sim_time', None) | ||
if use_sim_time: | ||
if self.warning: | ||
self._speak( | ||
self.client_jp, | ||
'use sim timeパラメータがTrueで設定されています', | ||
'jp') | ||
if self.override: | ||
if self.warning: | ||
self._speak( | ||
self.client_jp, | ||
'use sim timeパラメータをFalseに上書きます', | ||
'jp') | ||
rospy.set_param('/use_sim_time', False) | ||
|
||
def _speak(self, client, speech_text, lang=None): | ||
client.wait_for_server(timeout=rospy.Duration(1.0)) | ||
sound_goal = SoundRequestGoal() | ||
sound_goal.sound_request.sound = -3 | ||
sound_goal.sound_request.command = 1 | ||
sound_goal.sound_request.volume = 1.0 | ||
if lang is not None: | ||
sound_goal.sound_request.arg2 = lang | ||
sound_goal.sound_request.arg = speech_text | ||
client.send_goal(sound_goal) | ||
client.wait_for_result() | ||
return client.get_result() | ||
|
||
|
||
if __name__ == '__main__': | ||
rospy.init_node('check_use_sim_time') | ||
app = CheckUseSimTime() | ||
app.run() | ||
sys.exit(0) |
3 changes: 3 additions & 0 deletions
3
jsk_robot_common/jsk_robot_startup/apps/check_use_sim_time/check_use_sim_time.xml
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,3 @@ | ||
<launch> | ||
<node name="check_use_sim_time" pkg="jsk_robot_startup" type="check_use_sim_time.py" output="screen"/> | ||
</launch> |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
apps: | ||
- app: jsk_robot_startup/personal_use | ||
display: Personal use | ||
- app: jsk_robot_startup/check_use_sim_time | ||
display: Check /use_sim_time param |