Skip to content

Instantly share code, notes, and snippets.

@k-okada
Created April 28, 2022 10:14
Show Gist options
  • Save k-okada/c0ef7a3a2f4c0984cb014f1f25bad227 to your computer and use it in GitHub Desktop.
Save k-okada/c0ef7a3a2f4c0984cb014f1f25bad227 to your computer and use it in GitHub Desktop.
こんにちは
私はペッパーです
今日は東京大学からやってきました
とても楽しかったです.
また,あいましょう.
#!/usr/bin/env roseus
(ros::roseus "speech_from_file")
(ros::advertise "/speech" std_msgs::string 1)
(unix::sleep 1) ;; wait for subscriber,
(dolist (file '("1.txt" "2.txt" "3.txt"))
(format t ";; Read ~A~%" file)
(with-open-file
(f file :direction :input)
(let (buf (contents ""))
(while (setq buf (read-line f nil nil))
(setq contents (concatenate string contents buf)))
(format t ";; <~A>~%" contents)
(ros::publish "/speech" (instance std_msgs::String :data contents))
(ros::spin-once)
(unix::sleep (max (/ (length contents) 12) 3))
)))
(exit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment