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

(ros::time-now)を用いて一定時間ごとに文章をプリントするプログラム #625

Open
k-okada opened this issue Nov 26, 2019 · 1 comment

Comments

@k-okada
Copy link
Member

k-okada commented Nov 26, 2019

周期的な処理を行うため、ros::time-nowを利用し、一定時間ごとに文章をプリントするコードを書きたかったのですが、エラーが出てしまいました

どのようにすれば想定どおり動くでしょうか。

@k-okada
Copy link
Member Author

k-okada commented Nov 26, 2019

たとえば以下の例はどうでしょうか

(ros::roseus "test")

(setq termstart (ros::time-now))
(do-until-key
 (setq curtime (ros::time-now))
 (if (ros::time>= (ros::time- curtime termstart) (ros::time 5.0))
     (progn
       (format t "elapsed ~A sec ~%" (send (ros::time- curtime termstart) :to-sec))
       (setq termstart curtime))
   ))

あるいは

(ros::roseus "test")

(setq timestart (ros::time-now))
(do-until-key
 (when (> (send (ros::time- (ros::time-now) timestart) :to-sec) 3)
   (format t "elapsed ~A sec ~%" (send (ros::time- (ros::time-now) timestart) :to-sec))
   (setq timestart (ros::time-now))
   ))


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant