Skip to content

Commit 610a235

Browse files
authored
Merge pull request #30 from CMU-cabot/daisukes/add-restart-localization
implement restart localization function
2 parents cc6b4b6 + a9e5bbd commit 610a235

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def set_debug_mode():
7272
ble_hb_topic = roslibpy.Topic(client, '/cabot/ble_heart_beat', 'std_msgs/String')
7373
activity_log_topic = roslibpy.Topic(client, '/cabot/activity_log', 'cabot_msgs/Log')
7474
speak_service = roslibpy.Service(client, '/speak', 'cabot_msgs/Speak')
75+
restart_localization_service = roslibpy.Service(client, '/restart_localization', 'mf_localization_msgs/RestartLocalization')
7576

7677
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
7778
logger = logging.getLogger(__name__)
@@ -246,6 +247,12 @@ def callback(self, handle, value):
246247
lang = value[5:]
247248
event = NavigationEvent(subtype="language", param=lang)
248249
cabot_event_topic_pub.publish(roslibpy.Message({'data': str(event)}))
250+
if value.startswith("restart_localization"):
251+
def callback(response):
252+
logger.info(f"Localization restart: {response=}")
253+
request = roslibpy.ServiceRequest({})
254+
restart_localization_service.call(request, callback)
255+
249256

250257
def not_found(self):
251258
logger.error("%s is not implemented", self.uuid)

0 commit comments

Comments
 (0)