Skip to content

Commit

Permalink
[jsk_robot_startup/lifelog] Tweet randomly from uptime
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmtnt7000 authored and sktometometo committed Jun 16, 2023
1 parent ea455c7 commit 609ad33
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions jsk_robot_common/jsk_robot_startup/lifelog/tweet_client_uptime.l
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand All @@ -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))
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit 609ad33

Please sign in to comment.