diff --git a/jsk_naoqi_robot/naoqieus/naoqi-interface.l b/jsk_naoqi_robot/naoqieus/naoqi-interface.l index 0d79f568b9..cf5cb57405 100644 --- a/jsk_naoqi_robot/naoqieus/naoqi-interface.l +++ b/jsk_naoqi_robot/naoqieus/naoqi-interface.l @@ -254,10 +254,11 @@ (setq wait t)) ;; set volume and language (when volume - (send self :set-master-volume (round (* volume 100)))) + (unless (send self :set-master-volume (round (* volume 100))) + (error "Invalid volume argument"))) (when lang (unless (send self :set-language lang) - (ros::ros-error ":speak :lang ~A must be English or Japanese" lang))) + (error "Invalid language argument"))) ;; send speech request (send speech_msg :data str) (ros::publish (format nil "~A/speech" group-namespace) speech_msg) @@ -345,10 +346,15 @@ (:set-master-volume (volume) (let ((ret (instance nao_interaction_msgs::SetAudioMasterVolumeRequest :init))) - (ros::wait-for-service (format nil "~A/naoqi_driver/set_volume" group-namespace)) - (send ret :master_volume :data volume) - (ros::service-call (format nil "~A/naoqi_driver/set_volume" group-namespace) ret) - )) + (if (<= 0 volume 100) + (progn + (ros::wait-for-service (format nil "~A/naoqi_driver/set_volume" group-namespace)) + (send ret :master_volume :data volume) + (ros::service-call (format nil "~A/naoqi_driver/set_volume" group-namespace) ret) + t) + (progn + (ros::ros-error ":set-master-volume ~A must be between 0 and 100." volume) + nil)))) (:get-master-volume () (let ((ret (instance nao_interaction_msgs::GetAudioMasterVolumeRequest :init)) @@ -432,6 +438,8 @@ (ros::wait-for-service (format nil "~A/naoqi_driver/set_language" group-namespace)) (send ret :data language) (setq res (ros::service-call (format nil "~A/naoqi_driver/set_language" group-namespace) ret)) + (if (not (send res :success)) + (ros::ros-error ":speak :lang ~A must be English or Japanese" language)) (send res :success)) ) (:get-language