DummyDevPackedVector4::DummyDevPackedVector4(const DeviceConfig & deviceConfig) {

    this->deviceDescriptor.setEntityID(deviceConfig.getEntityID());
    this->entityID = this->deviceDescriptor.getEntityID();

    map<string, Port> portMap;

    portMap["pv1"] = Port("pv1", "PackedVector4", Port::Source, "");

    DeviceType deviceType;
    deviceType.setPortMap(portMap);
    deviceType.setDeviceTypeName("DummyDevPackedVector4");
    deviceType.setDescription("");

    this->deviceDescriptor.setDeviceType(deviceType);

    std::map<std::string, int> nameChannelNrMap;
    int nr = 1;
    map<string, Port>::iterator i = portMap.begin();
    map<string, Port>::iterator e = portMap.end();
    while (i != e) {
        nameChannelNrMap[(*i).second.getName()] = nr;
        ++nr;
        ++i;
    }
    this->deviceDescriptor.setNameChannelNrMap(nameChannelNrMap);
}
Пример #2
0
  HapticDev::HapticDev(const DeviceConfig & deviceConfig)
  : udpReceiverSocket(inSerializedDataQueue) {
    
      this->deviceDescriptor.setEntityID(deviceConfig.getEntityID());
      this->entityID = this->deviceDescriptor.getEntityID();

    map<string, Port> portMap;

    portMap["HOUT1"] = Port("HOUT1", "HapticChannel", Port::Source);

    DeviceType deviceType;
    deviceType.setPortMap(portMap);
    deviceType.setDeviceTypeName(getDeviceName());
    deviceType.setDescription("HapticDevice");
    this->deviceDescriptor.setDeviceType(deviceType);

    std::map<std::string, int> nameChannelNrMap;
    int nr = 0;

    for (std::map<string, Port>::const_iterator i = portMap.begin(),
	   e = portMap.end(); i != e; ++nr, ++i)
      nameChannelNrMap[(*i).second.getName()] = nr;

    this->deviceDescriptor.setNameChannelNrMap(nameChannelNrMap);
}
Пример #3
0
DummyDevDA::DummyDevDA(const DeviceConfig & deviceConfig) {

    this->deviceDescriptor.setEntityID(deviceConfig.getEntityID());
    this->entityID = this->deviceDescriptor.getEntityID();
    //cout << "===> DummyDevDA: " << this->entityID << endl;

    map<string, Port> portMap;

    portMap["DO1"] = Port("DO1", "DigitalChannel", Port::Source);
    portMap["DO2"] = Port("DO2", "DigitalChannel", Port::Source);
    portMap["DO3"] = Port("DO3", "DigitalChannel", Port::Source);
    portMap["DO4"] = Port("DO4", "DigitalChannel", Port::Source);

    portMap["DI1"] = Port("DI1", "DigitalChannel", Port::Sink);
    portMap["DI2"] = Port("DI2", "DigitalChannel", Port::Sink);
    portMap["DI3"] = Port("DI3", "DigitalChannel", Port::Sink);
    portMap["DI4"] = Port("DI4", "DigitalChannel", Port::Sink);

    portMap["DIO1"] = Port("DIO1", "DigitalChannel", Port::SourceAndSink);
    portMap["DIO2"] = Port("DIO2", "DigitalChannel", Port::SourceAndSink);
    portMap["DIO3"] = Port("DIO3", "DigitalChannel", Port::SourceAndSink);
    portMap["DIO4"] = Port("DIO4", "DigitalChannel", Port::SourceAndSink);

    portMap["AO1"] = Port("AO1", "AnalogChannel", Port::Source);
    portMap["AO2"] = Port("AO2", "AnalogChannel", Port::Source);
    portMap["AO3"] = Port("AO3", "AnalogChannel", Port::Source);
    portMap["AO4"] = Port("AO4", "AnalogChannel", Port::Source);

    portMap["AI1"] = Port("AI1", "AnalogChannel", Port::Sink);
    portMap["AI2"] = Port("AI2", "AnalogChannel", Port::Sink);
    portMap["AI3"] = Port("AI3", "AnalogChannel", Port::Sink);
    portMap["AI4"] = Port("AI4", "AnalogChannel", Port::Sink);

    portMap["AIO1"] = Port("AIO1", "AnalogChannel", Port::SourceAndSink);
    portMap["AIO2"] = Port("AIO2", "AnalogChannel", Port::SourceAndSink);
    portMap["AIO3"] = Port("AIO3", "AnalogChannel", Port::SourceAndSink);
    portMap["AIO4"] = Port("AIO4", "AnalogChannel", Port::SourceAndSink);

    DeviceType deviceType;
    deviceType.setPortMap(portMap);
    deviceType.setDeviceTypeName(getDeviceName());
    deviceType.setDescription("Digital and Analog IO");
    this->deviceDescriptor.setDeviceType(deviceType);

    std::map<std::string, int> nameChannelNrMap;
    int nr = 1;
    map<string, Port>::iterator i = portMap.begin();
    map<string, Port>::iterator e = portMap.end();
    while (i != e) {
        nameChannelNrMap[(*i).second.getName()] = nr;
        ++nr;
        ++i;
    }

    this->deviceDescriptor.setNameChannelNrMap(nameChannelNrMap);
}
Matrix4CalibrationDev::Matrix4CalibrationDev(const DeviceConfig & deviceConfig) :
    senderThreadActive(false),
    receiverThreadActive(false),
    vec1Size(0),
    vec2Size(0),
    trackVectors(false),
    premultiply(false),
    useAverage(false) {

    this->deviceDescriptor.setEntityID(deviceConfig.getEntityID());
    this->entityID = this->deviceDescriptor.getEntityID();

    map<string, Port> portMap;
    map<string, int> namePortNrMap;
    
    addPort(Port("Vector1",               "Vector4",        Port::Sink, ""),    PortNR_Vector1,                 portMap, namePortNrMap);
    addPort(Port("Vector2",               "Vector4",        Port::Sink, ""),    PortNR_Vector2,                 portMap, namePortNrMap);
    addPort(Port("CalibratedMatrix",      "Matrix4",        Port::Source, ""),  PortNR_CalibratedMatrix,        portMap, namePortNrMap);
    addPort(Port("ApplyVectors",          "DigitalChannel", Port::Sink, ""),    PortNR_ApplyVectors,            portMap, namePortNrMap);
    addPort(Port("ClearVectors",          "DigitalChannel", Port::Sink, ""),    PortNR_ClearVectors,            portMap, namePortNrMap);
    addPort(Port("LoadCalibratedMatrix",  "DigitalChannel", Port::Sink, ""),    PortNR_LoadCalibratedMatrix,    portMap, namePortNrMap);
    addPort(Port("SaveCalibratedMatrix",  "DigitalChannel", Port::Sink, ""),    PortNR_SaveCalibratedMatrix,    portMap, namePortNrMap);
    addPort(Port("SendCalibratedMatrix",  "DigitalChannel", Port::Sink, ""),    PortNR_SendCalibratedMatrix,    portMap, namePortNrMap);
    addPort(Port("CalcCalibratedMatrix",  "DigitalChannel", Port::Sink, ""),    PortNR_CalcCalibratedMatrix,    portMap, namePortNrMap);

    DeviceType deviceType;
    deviceType.setPortMap(portMap);
    deviceType.setDeviceTypeName("Matrix4CalibrationDev");
    deviceType.setDescription("");

    this->deviceDescriptor.setDeviceType(deviceType);
    this->deviceDescriptor.setNameChannelNrMap(namePortNrMap);
    
    try {
        this->initialSend = deviceConfig.getParameterGroup().getInt("CalibratedMatrix|InitialSend") != 0;
        TFDEBUG("initialSend = " << this->initialSend);
        
        this->calibratedMatrixPath = deviceConfig.getParameterGroup().getString("CalibratedMatrix|Path");
        TFDEBUG("calibratedMatrixPath = " << this->calibratedMatrixPath);
        
        this->premultiply = deviceConfig.getParameterGroup().getInt("CalibratedMatrix|Pre-multiply") != 0;
        TFINFO("pre-multiply = " << this->premultiply);
        
        this->useAverage = deviceConfig.getParameterGroup().getInt("ApplyVectors|useAverage") != 0;
        TFINFO("useAverage = " << this->useAverage);
    }
    catch(Exception & e) {
        TFERROR(e.getFormattedString());
    }
}