From 609ad33a3a00da601c6066707ab9ad180a2d754f Mon Sep 17 00:00:00 2001 From: Naoto Tsukamoto Date: Wed, 7 Jun 2023 14:26:20 +0900 Subject: [PATCH] [jsk_robot_startup/lifelog] Tweet randomly from uptime --- .../jsk_robot_startup/lifelog/tweet_client_uptime.l | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/jsk_robot_common/jsk_robot_startup/lifelog/tweet_client_uptime.l b/jsk_robot_common/jsk_robot_startup/lifelog/tweet_client_uptime.l index 1dc3caed3c..4313e8faf7 100755 --- a/jsk_robot_common/jsk_robot_startup/lifelog/tweet_client_uptime.l +++ b/jsk_robot_common/jsk_robot_startup/lifelog/tweet_client_uptime.l @@ -18,6 +18,13 @@ (unix::sleep 3) (ros::ros-info "Wait for /active_user/elapsed_time parameter ...")) +(cond + ((ros::has-param "/active_user/tweet_random_range") + (setq *tweet-random-range* (ros::get-param "/active_user/tweet_random_range"))) + (t + (setq *tweet-random-range* 600.0) + )) + (cond ((ros::has-param "/active_user/tweet_second") (setq *tweet-second* (ros::get-param "/active_user/tweet_second"))) @@ -34,9 +41,9 @@ (let ((st (ros::get-param "/active_user/start_time"))) (setq *waking-target-second* (+ (- (send (ros::time-now) :to-sec) st) - *waking-tweet-second*)))) + (+ *waking-tweet-second* (random *tweet-random-range*)))))) (t - (setq *waking-target-second* *waking-tweet-second*))) + (setq *waking-target-second* (+ *waking-tweet-second* (random *tweet-random-range*))))) (setq *volume* (ros::get-param "~volume" 1.0)) (setq *speak-enable* (ros::get-param "~speak_enable" t)) @@ -76,7 +83,7 @@ (let ((waking-time (- (send (ros::time-now) :to-sec) st))) (ros::ros-debug "~A waking ~A sec (~A)" *robot-name* waking-time *waking-target-second*) (when (> waking-time *waking-target-second*) - (incf *waking-target-second* *waking-tweet-second*) + (incf *waking-target-second* (+ *waking-tweet-second* (random *tweet-random-range*))) ;; tweet source of robot-interface (unless *src-lines* (let* ((dirname (ros::rospack-find "pr2eus"))