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

Add speak-en-jp to switch language by speak_language rosparam and add test codes. #263

Closed
wants to merge 1 commit into from

Conversation

snozawa
Copy link
Contributor

@snozawa snozawa commented Nov 24, 2016

Add new feature for speak.l.

I'd like to switch speak-en and speak-jp online: (demos for japanese guests and english guests).
I added speak-en-jp function and usage is:

(speak-en-jp "Hello world" "こんにちわ")

We need to write both japanese and english in speaking codes.
We can switch language by changing speak_language ros param.

Currently this is used in hrp2 73B2 demo and I copied the function into pr2eus.

@k-okada
Copy link
Member

k-okada commented Nov 24, 2016

  1. better to use `&rest args'
  2. consider Chinese support, https://github.com/jsk-ros-pkg/jsk_robot/blob/master/jsk_naoqi_robot/jsk_201504_miraikan/euslisp/mirai-demo-20150413.l#L32 can be written with this feature, how about (speak "Hello"), (speak "こんにちは"), (spaak '(("en" . "Hello") ("jp" . "こんにちは") (”zn-CN" . "你好")
  3. better to have function that if we call (speak "hello"), but speak_language is "jp", then we use speak-google to speak in Japanese

…e by speak_language rosparam and add test codes
@snozawa
Copy link
Contributor Author

snozawa commented Nov 24, 2016

Thanks!

better to use `&rest args'

I re-write the code to use &rest args.

consider Chinese support, https://github.com/jsk-ros-pkg/jsk_robot/blob/master/jsk_naoqi_robot/jsk_201504_miraikan/euslisp/mirai-demo-20150413.l#L32 can be written with this feature, how about (speak "Hello"), (speak "こんにちは"), (spaak '(("en" . "Hello") ("jp" . "こんにちは") (”zn-CN" . "你好")

Thats nice idea!
I re-write the code to support (spaak '(("en" . "Hello") ("jp" . "こんにちは") (”zn-CN" . "你好")) style and (speak "Heloo") style.

better to have function that if we call (speak "hello"), but speak_language is "jp", then we use speak-google to speak in Japanese

If adequate speech string is specified from arguments, use speak-google.

(setq speach-string-candidates (list (cons "en" speach-string-candidates))))
;; Check speak_language
(let* ((lang (or (ros::get-param "speak_language") "en"))
(speak-string (cdr (assoc lang speach-string-candidates :test #'string=)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for me, using intern seems suitable for this case.

12.eusgl$ (functionp (intern "SPEAK-JP"))
t
13.eusgl$ (functionp (intern "SPEAK-CN"))
nil
14.eusgl$ (functionp (intern "SPEAK-EN"))
t

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is reflected on #383

(setq speak-string (cdr (assoc "en" speach-string-candidates :test #'string=)))
(setq speak-func #'speak-google))
;; Check speak-xx function existence.
(unless speak-func
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you can not find speak-func, use google, this is why we choose "en" instead of "english"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is reflected on #383

@pazeshun
Copy link
Collaborator

@k-okada
This PR is moved to #383 and is being improved by @iory .
I think we can close this and release 0.3.14, unless you think #383 is required for 0.3.14.

@k-okada k-okada closed this Feb 12, 2019
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

Successfully merging this pull request may close these issues.

4 participants