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

[jsk_robot_startup] add check_use_sim_time app #1381

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
published_topics: {}
subscribed_topics: {}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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)
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>
2 changes: 2 additions & 0 deletions jsk_robot_common/jsk_robot_startup/apps/robot_apps.installed
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