tResult StateControllerNew::Init(cFilter::tInitStage eStage, IException **__exception_ptr)
{
    RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr));

    if (StageFirst == eStage)
    {
        RETURN_IF_FAILED(CreateDescriptions(__exception_ptr));
        RETURN_IF_FAILED(CreateInputPins(__exception_ptr));
        RETURN_IF_FAILED(CreateOutputPins(__exception_ptr));
    }
    else if (StageNormal == eStage)
    {
        controllerMode = static_cast<tControllerMode::ControllerModeEnum>(GetPropertyInt(CONTROLLER_MODE_PROPERTY));
        logger.Log(cString::Format("StateController running in %s mode.", tControllerMode::ToString(controllerMode).c_str()).GetPtr());

        if (tControllerMode::Manual == controllerMode && waitTimer == NULL)
        {
            tInt waitTime = 500 * 1000; // 500ms interval
            waitTimer = _kernel->TimerCreate(tTimeStamp(waitTime), 0, static_cast<IRunnable *>(this), NULL, NULL, 0, 0,
                                             cString::Format("%s.timer", OIGetInstanceName()));
        }
    }
    else if (StageGraphReady == eStage)
    {
        currentManeuverID = 0;
        sectionListIndex = -1;
        maneuverListIndex = -1;
        SetState(tCarState::Startup);
    }

    RETURN_NOERROR;
}
Exemplo n.º 2
0
tResult pylonDetection::CreateOutputPins(__exception)
{
    //debug image otput pin
    RETURN_IF_FAILED(m_outputPin_debugImage.Create("debug_image", adtf::IPin::PD_Output  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_debugImage));

    //depth depth output pin
    RETURN_IF_FAILED(m_outputPin_depthImage.Create("depth_image_out", adtf::IPin::PD_Output  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_depthImage));

    //Pylon Info output pin
    cObjectPtr<IMediaDescriptionManager> pDescManager;
    RETURN_IF_FAILED(_runtime->GetObject(OID_ADTF_MEDIA_DESCRIPTION_MANAGER,IID_ADTF_MEDIA_DESCRIPTION_MANAGER,(tVoid**)&pDescManager,__exception_ptr));
    tChar const * strDesc = pDescManager->GetMediaDescription("tPylonInfo");
    if(!strDesc) LOG_ERROR(cString(OIGetInstanceName()) + ": Could not load mediadescription tPylonInfo, check path");
    RETURN_IF_POINTER_NULL(strDesc);
    cObjectPtr<IMediaType> pType = new cMediaType(0, 0, 0, "tPylonInfo", strDesc, IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(m_outputPin_PylonInfo.Create("PylonInfo", pType, this));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_PylonInfo));
    RETURN_IF_FAILED(pType->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescPylonInfo));
 
    //Lane Info
    tChar const * strDescLaneInfoValue = pDescManager->GetMediaDescription("tLaneInfo");
    RETURN_IF_POINTER_NULL(strDescLaneInfoValue);
    cObjectPtr<IMediaType> pTypeLaneInfoValue = new cMediaType(0, 0, 0, "tLaneInfo", strDescLaneInfoValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);
    RETURN_IF_FAILED(pTypeLaneInfoValue->GetInterface(IID_ADTF_MEDIA_TYPE_DESCRIPTION, (tVoid**)&m_pCoderDescLaneInfo));

    RETURN_IF_FAILED(m_oLaneDataOutputPin.Create("laneInfo", pTypeLaneInfoValue  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_oLaneDataOutputPin));

    //acceleration pin
    tChar const * strDescSignalValue = pDescManager->GetMediaDescription("tSignalValue");
    RETURN_IF_POINTER_NULL(strDescSignalValue);
    cObjectPtr<IMediaType> pTypeSignalValue = new cMediaType(0, 0, 0, "tSignalValue", strDescSignalValue,IMediaDescription::MDF_DDL_DEFAULT_VERSION);

    RETURN_IF_FAILED(m_outputPin_speed.Create("accelerate", pTypeSignalValue  , static_cast<IPinEventSink*> (this)));
    RETURN_IF_FAILED(RegisterPin(&m_outputPin_speed));

    RETURN_NOERROR;
}
cMarkerDetectFilter::cMarkerDetectFilter(const tChar* __info):cFilter(__info)
{
    UCOM_REGISTER_TIMING_SPOT(cString(OIGetInstanceName()) + "::Process::Start", m_oProcessStart);

    flagtoreducespeed = tFalse;
    f32Areatoreducespeed = 400;
    var_lan_acc_input = 90.0f;
    var_lan_acc_output = 90.0f;
    global_i = 0;
    var_finish_flag = tTrue;
    FrameCount = 0;
    ManeuverJuryID = MANEUVER_INTERSECTION_DEFAULT;
    var_maneuver_id = TestArray[global_i];//(tFloat32)MANEUVER_INTERSECTION_RIGHT; //TestArray[global_i]; //global_i = 0;
    SetPropertyBool(MD_ENABLE_IMSHOW,tFalse);
    SetPropertyBool(MD_ENABLE_IMSHOW NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_ENABLE_IMSHOW NSSUBPROP_DESCRIPTION, "If true imshow will be enabled");

    SetPropertyBool(MD_ENABLE_IMSHOW_VER,tFalse);
    SetPropertyBool(MD_ENABLE_IMSHOW_VER NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_ENABLE_IMSHOW_VER NSSUBPROP_DESCRIPTION, "If true imshow will be enabled for vertical lines");

    SetPropertyBool("Debug Output to Console", tFalse);    
    SetPropertyStr("Debug Output to Console" NSSUBPROP_DESCRIPTION, "If enabled additional debug information is printed to the console (Warning: decreases performance)."); 

    //RETURN_NOERROR;
    SetPropertyStr("Dictionary File For Markers",""); 
    SetPropertyBool("Dictionary File For Markers" NSSUBPROP_FILENAME, tTrue); 
    SetPropertyStr("Dictionary File For Markers" NSSUBPROP_FILENAME NSSUBSUBPROP_EXTENSIONFILTER, "YML Files (*.yml)"); 
    SetPropertyStr("Dictionary File For Markers" NSSUBPROP_DESCRIPTION, "Here you have to set the dicitionary file which holds the marker ids and their content"); 

    SetPropertyStr("Calibration File for used Camera",""); 
    SetPropertyBool("Calibration File for used Camera" NSSUBPROP_FILENAME, tTrue); 
    SetPropertyStr("Calibration File for used Camera" NSSUBPROP_FILENAME NSSUBSUBPROP_EXTENSIONFILTER, "YML Files (*.yml)"); 
    SetPropertyStr("Calibration File for used Camera" NSSUBPROP_DESCRIPTION, "Here you have to set the file with calibration paraemters of the used camera"); 
    
    SetPropertyInt("Video Output Pin",1);
    SetPropertyStr("Video Output Pin" NSSUBPROP_VALUELIST, "1@None|2@Detected Signs|");
    SetPropertyStr("Video Output Pin" NSSUBPROP_DESCRIPTION, "If enabled the video stream with the highlighted markers is transmitted at the output pin (Warning: decreases performance)."); 

    SetPropertyFloat("Size of Markers",0.117f);
    SetPropertyStr("Size of Markers" NSSUBPROP_DESCRIPTION, "Size (length of one side) of markers in m"); 

    SetPropertyFloat(MD_REQUIRED_MARKER_SIZE, 900.0);
    SetPropertyBool(MD_REQUIRED_MARKER_SIZE NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_REQUIRED_MARKER_SIZE NSSUBPROP_DESCRIPTION, "MarkerDetection::The marker size above which manuevers processing starts");

    SetPropertyInt(MD_COUNT, 2);
    SetPropertyBool(MD_COUNT NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_COUNT NSSUBPROP_DESCRIPTION, "MarkerDetection::Minimum number of lines to be detected for markers to be considered");

    SetPropertyInt(MD_RANGE_ROWS_R1, 0);
    SetPropertyBool(MD_RANGE_ROWS_R1 NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_ROWS_R1 NSSUBPROP_DESCRIPTION, "MarkerDetection::The first row R1 to be taken (R1,) (R2,)");

    SetPropertyInt(MD_RANGE_ROWS_R2, 250);
    SetPropertyBool(MD_RANGE_ROWS_R2 NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_ROWS_R2 NSSUBPROP_DESCRIPTION,"MarkerDetection::The second row R2 to be taken (R1,) (R2,)");

    SetPropertyInt(MD_RANGE_COLS_C1, 0);
    SetPropertyBool(MD_RANGE_COLS_C1 NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_COLS_C1 NSSUBPROP_DESCRIPTION, "MarkerDetection::The first col C1 to be taken (,C1) (,C2)");

    SetPropertyInt(MD_RANGE_COLS_C2, 250);
    SetPropertyBool(MD_RANGE_COLS_C2 NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_COLS_C2 NSSUBPROP_DESCRIPTION, "MarkerDetection::The second col C2 to be taken (,C1) (,C2)");

    SetPropertyInt(MD_RANGE_ROWS_R1_L, 20);
    SetPropertyBool(MD_RANGE_ROWS_R1_L NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_ROWS_R1_L NSSUBPROP_DESCRIPTION, "LineDetection::The first row R1 to be taken (R1,) (R2,)");

    SetPropertyInt(MD_RANGE_ROWS_R2_L, 50);
    SetPropertyBool(MD_RANGE_ROWS_R2_L NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_ROWS_R2_L NSSUBPROP_DESCRIPTION,"LineDetection::The second row R2 to be taken (R1,) (R2,)");

    SetPropertyInt(MD_RANGE_COLS_C1_L, 90);
    SetPropertyBool(MD_RANGE_COLS_C1_L NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_COLS_C1_L NSSUBPROP_DESCRIPTION, "LineDetection::The first col C1 to be taken (,C1) (,C2)");

    SetPropertyInt(MD_RANGE_COLS_C2_L, 20);
    SetPropertyBool(MD_RANGE_COLS_C2_L NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_COLS_C2_L NSSUBPROP_DESCRIPTION, "LineDetection::The second col C2 to be taken (,C1) (,C2)");

    SetPropertyInt(MD_RANGE_ROWS_R1_VER, 30);
    SetPropertyBool(MD_RANGE_ROWS_R1_VER NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_ROWS_R1_VER NSSUBPROP_DESCRIPTION, "LineDetection_VER::Theq first row R1 to be taken (R1,) (R2,)");

    SetPropertyInt(MD_RANGE_ROWS_R2_VER, 60);
    SetPropertyBool(MD_RANGE_ROWS_R2_VER NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_ROWS_R2_VER NSSUBPROP_DESCRIPTION,"LineDetection_VER::Theq second row R2 to be taken (R1,) (R2,)");

    SetPropertyInt(MD_RANGE_COLS_C1_VER, 30);
    SetPropertyBool(MD_RANGE_COLS_C1_VER NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_COLS_C1_VER NSSUBPROP_DESCRIPTION, "LineDetection_VER::Theq first col C1 to be taken (,C1) (,C2)");

    SetPropertyInt(MD_RANGE_COLS_C2_VER, 60);
    SetPropertyBool(MD_RANGE_COLS_C2_VER NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_RANGE_COLS_C2_VER NSSUBPROP_DESCRIPTION, "LineDetection_VER::Theq second col C2 to be taken (,C1) (,C2)");

    SetPropertyInt(MD_GREY_TRESHOLD, 100);
    SetPropertyBool(MD_GREY_TRESHOLD NSSUBPROP_ISCHANGEABLE, tTrue);
    SetPropertyStr(MD_GREY_TRESHOLD NSSUBPROP_DESCRIPTION, "The threshold value for canny to detect lines.");

    UCOM_REGISTER_TIMING_SPOT(cString(OIGetInstanceName()) + "::Process::End", m_oProcessEnd);    
}
tResult cJuryTransmitter::OnStart(tInt16 entryId)
{
    m_Start_entry_id = entryId;
    m_hTimerStartCounter = 0;
    __synchronized_obj(m_oCriticalSectionTimerStart);
    m_hTimerStart = _kernel->TimerCreate(GetPropertyInt("Send time interval in sec")*1000000, 0, static_cast<IRunnable*>(this),
                                         NULL, &m_hTimerStartCounter, sizeof(m_hTimerStartCounter), 0, adtf_util::cString::Format("%s.timerStart", OIGetInstanceName()));

    RETURN_NOERROR;
}
tResult cJuryTransmitter::OnRequestReady(tInt16 entryId)
{    
    m_Request_Ready_entry_id = entryId;
    m_hTimerRequestReadyCounter= 0;
    __synchronized_obj(m_oCriticalSectionTimerRequestReady);
    // Create a timer that will trigger the signal generation every 2 sec.
    m_hTimerRequestReady = _kernel->TimerCreate(GetPropertyInt("Send time interval in sec")*1000000, 0, static_cast<IRunnable*>(this),
                                                NULL, &m_hTimerRequestReadyCounter, sizeof(m_hTimerRequestReadyCounter), 0, adtf_util::cString::Format("%s.timerRequestReady", OIGetInstanceName()));
    RETURN_NOERROR;
}
Exemplo n.º 6
0
tResult cJuryModule::OnNotAus()
{
    m_iNotAusCounter = 0;
    __synchronized_obj(m_oCriticalSectionTimerNotAus);
    m_hTimerNotAus = _kernel->TimerCreate(GetPropertyInt("Send time interval in sec")*1000000, 0, static_cast<IRunnable*>(this),
        NULL, &m_iNotAusCounter, sizeof(m_iNotAusCounter), 0, adtf_util::cString::Format("%s.timerNotAus", OIGetInstanceName()));

    RETURN_NOERROR;
}