class documentation

class SoundRosWrapper(object):

Constructor: SoundRosWrapper(hardware_version, service_timeout)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method delete_sound Delete a sound on the RaspberryPi of the robot. If failed, raise NiryoRosWrapperException
Method get_sound_duration Returns the duration in seconds of a sound stored in the robot database raise SoundRosWrapperException if the sound doesn't exists
Method import_sound Delete a sound on the RaspberryPi of the robot. If failed, raise NiryoRosWrapperException
Method play Play a sound from the robot If failed, raise NiryoRosWrapperException
Method say Use gtts (Google Text To Speech) to interpret a string as sound Languages available are: - English: 0 - French: 1 - Spanish: 2 - Mandarin: 3 - Portuguese: 4
Method set_volume Set the volume percentage of the robot. If failed, raise NiryoRosWrapperException
Method stop Stop a sound being played. If failed, raise NiryoRosWrapperException
Property hardware_version Undocumented
Property sounds Get sound name list
Static Method __check_result_status Undocumented
Method __call_service Wait for the service called service_name Then call the service with args
Method __check_ned_2_version Undocumented
Method __classic_return_w_check Undocumented
Method __sound_database_callback Undocumented
Instance Variable __hardware_version Undocumented
Instance Variable __service_timeout Undocumented
Instance Variable __sound_duration Undocumented
Instance Variable __sounds Undocumented
def __init__(self, hardware_version='ned2', service_timeout=1):

Undocumented

def delete_sound(self, sound_name):

Delete a sound on the RaspberryPi of the robot. If failed, raise NiryoRosWrapperException

Parameters
sound_name:strname of the sound which needs to be deleted
Returns
(int, str)status, message
def get_sound_duration(self, sound_name):

Returns the duration in seconds of a sound stored in the robot database raise SoundRosWrapperException if the sound doesn't exists

Parameters
sound_name:strname of sound
Returns
floatsound duration in seconds
def import_sound(self, sound_name, sound_data):

Delete a sound on the RaspberryPi of the robot. If failed, raise NiryoRosWrapperException

Parameters
sound_name:strname of the sound which needs to be deleted
sound_data:strString containing the encoded data of the sound file (wav or mp3)
Returns
(int, str)status, message
def play(self, sound_name, wait_end=True, start_time_sec=0, end_time_sec=0):

Play a sound from the robot If failed, raise NiryoRosWrapperException

Parameters
sound_name:strName of the sound to play
wait_end:boolwait for the end of the sound before exiting the function
start_time_sec:floatstart the sound from this value in seconds
end_time_sec:floatend the sound at this value in seconds
Returns
(int, str)status, message
def say(self, text, language=0):

Use gtts (Google Text To Speech) to interpret a string as sound Languages available are: - English: 0 - French: 1 - Spanish: 2 - Mandarin: 3 - Portuguese: 4

Parameters
text:stringtext to speek < 100 char
language:intlanguage of the text
Returns
(int, str)status, message
def set_volume(self, sound_volume):

Set the volume percentage of the robot. If failed, raise NiryoRosWrapperException

Parameters
sound_volume:intvolume percentage of the sound (0: no sound, 100: max sound)
Returns
(int, str)status, message
def stop(self):

Stop a sound being played. If failed, raise NiryoRosWrapperException

Returns
(int, str)status, message
@property
hardware_version =

Undocumented

@property
sounds: list[string] =

Get sound name list

@staticmethod
def __check_result_status(result):

Undocumented

def __call_service(self, service_name, service_msg_type, *args):

Wait for the service called service_name Then call the service with args

Parameters
service_name
service_msg_type
*argsTuple of arguments
Returns
Response
Raises
NiryoRosWrapperExceptionTimeout during waiting of services
def __check_ned_2_version(self):

Undocumented

def __classic_return_w_check(self, result):

Undocumented

def __sound_database_callback(self, msg):

Undocumented

__hardware_version =

Undocumented

__service_timeout =

Undocumented

__sound_duration =

Undocumented

__sounds =

Undocumented