Esempio n. 1
0
 def __init__(self, input_port_name, output_port_name, display_port_name):
     yarp.RFModule.__init__(self)
     # Prepare ports
     self._input_port = yarp.Port()
     self._input_port_name = input_port_name
     self._input_port.open(self._input_port_name)
     self._output_port = yarp.BufferedPortBottle()
     self._output_port_name = output_port_name
     self._output_port.open(self._output_port_name)
     self._display_port = yarp.Port()
     self._display_port_name = display_port_name
     self._display_port.open(self._display_port_name)
     # Prepare image buffers
     # Input
     self._input_buf_image = yarp.ImageRgb()
     self._input_buf_image.resize(320, 240)
     self._input_buf_array = np.zeros((240, 320, 3), dtype=np.uint8)
     self._input_buf_image.setExternal(self._input_buf_array,
                                       self._input_buf_array.shape[1], self._input_buf_array.shape[0])
     # Output
     self._display_buf_image = yarp.ImageRgb()
     self._display_buf_image.resize(320, 240)
     self._display_buf_array = np.zeros((240, 320, 3), dtype=np.uint8)
     self._display_buf_image.setExternal(self._display_buf_array,
                                         self._display_buf_array.shape[1], self._display_buf_array.shape[0])
     self._logger = yarp.Log()
Esempio n. 2
0
 def __init__(self):
     if YarpLogger._instance != None:
         raise Exception("This class is a singleton!")
     else:
         YarpLogger._instance = self
     self.__yarp_logger__ = yarp.Log("",0,"") #FIXME: without params I get segfault
     self.enable_logs()
Esempio n. 3
0
import scipy.io.wavfile as wavfile

import librosa
import sys
import yarp
import numpy as np
from CONFIG import *

import scipy

# subjects_dic = {0: 'NOEMIE', 1: 'BACKGROUND', 2: 'VALERIA', 3:'MELLY', 4: 'JONAS', 5: 'FABIO', 6: 'CARLO', 7: 'GIULIA',
#  8: 'MARCO', 9: 'FRANCESCO', 10: 'DARIO', 11: 'LINDA', 12: 'LUCA'}

os.environ["CUDA_VISIBLE_DEVICES"] = "-1"

yarpLog = yarp.Log()


class SpeakeRecognitionModule(yarp.RFModule):
    """
    Description:
        Class to recognize speaker from the audio

    Args:
        input_port  : Audio from remoteInterface

    """
    def __init__(self):
        yarp.RFModule.__init__(self)

        # handle port for the RFModule
Esempio n. 4
0
    V_rad = yarp.Vector(V.size(), 0.0)
    for i in range(V.size()):
        V_rad[i] = V[i] * icub.CTRL_DEG2RAD

    return V_rad


yarp.Network.init()
icub.init()

name = 'test'
robot = 'icubSim'
arm_name = 'left_arm'

# To use yarp log function
log = yarp.Log()

props = yarp.Property()
props.put("device", "remote_controlboard")
props.put("local", "/" + name + "/" + arm_name)
props.put("remote", "/" + robot + "/" + arm_name)

# create remote driver
_armDriver = yarp.PolyDriver(props)

# query motor control interfaces
_iPos = _armDriver.viewIPositionControl()
_iEnc_arm = _armDriver.viewIEncoders()

# retrieve number of joints
_jnts_arm = _iPos.getAxes()
Esempio n. 5
0
import yarp
import icubclient
import sys
import time


if __name__ == '__main__':
    yarp.Network.init()

    logger = yarp.Log()
    iCub = icubclient.ICubClient("AREiCubClientExample", "icubClient", "example_ARE.ini")

    rfClient = yarp.ResourceFinder()
    rfClient.setVerbose(True)
    rfClient.setDefaultContext("icubClient")
    rfClient.setDefaultConfigFile("example_ARE.ini")
    rfClient.configure(sys.argv)

    # we connect to both ARE and OPC
    if not iCub.connect():
        logger.error() << "[ARE_KARMAiCubClientExample] ARE and/or OPC seems unavailabe!"

    if rfClient.check("target"):
        target = rfClient.find("target").asString()
        logger.info() << "target name set to %s"
        logger.info() << target
    else:
        target = "octopus"
        logger.info() << "target name set to default, i.e. "
        logger.info() << target
Esempio n. 6
0
 def __init__(self, logtype=NONE):
     self.__logtype__ = logtype
     if not self.__logtype__ is YarpLogger.NONE:
         self.__yarp_logger__ = yarp.Log()