예제 #1
0
STDMETHODIMP ProgressWrap::COMGETTER(Completed)(BOOL *aCompleted)
{
    LogRelFlow(("{%p} %s: enter aCompleted=%p\n", this, "Progress::getCompleted", aCompleted));

    VirtualBoxBase::clearError();

    HRESULT hrc;

    try
    {
        CheckComArgOutPointerValidThrow(aCompleted);

        AutoCaller autoCaller(this);
        if (FAILED(autoCaller.rc()))
            throw autoCaller.rc();

        hrc = getCompleted(aCompleted);
    }
    catch (HRESULT hrc2)
    {
        hrc = hrc2;
    }
    catch (...)
    {
        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
    }

    LogRelFlow(("{%p} %s: leave *aCompleted=%RTbool hrc=%Rhrc\n", this, "Progress::getCompleted", *aCompleted, hrc));
    return hrc;
}
예제 #2
0
ArrayElement* ToDo::clone() {
    ToDo* ret = new ToDo();
    if (getClass()) ret->setClass(*classEvent);
    if (getCompleted()) ret->setCompleted(*completed);
    if (getCreated()) ret->setCreated(*created);
    if (getDescription()) ret->setDescription(*description);
    if (getDtStamp()) ret->setDtStamp(*dtStamp);
    if (getDtStart()) ret->setDtStart(*dtStart);
    if (getGeo()) ret->setGeo(*geo);
    if (getLastMod()) ret->setLastMod(*lastMod);
    if (getLocation()) ret->setLocation(*location);
    if (getOrganizer()) ret->setOrganizer(*organizer);
    if (getPercent()) ret->setPercent(*percent);
    if (getPriority()) ret->setPriority(*priority);
    if (getRecurID()) ret->setRecurID(*recurID);
    if (getSequence()) ret->setSequence(*seq);
    if (getStatus()) ret->setStatus(*status);
    if (getSummary()) ret->setSummary(*summary);
    if (getUid()) ret->setUid(*uid);
    if (getUrl()) ret->setUrl(*url);
    if (getDue()) ret->setDue(*due);
    if (getDuration()) ret->setDuration(*duration);
    if (getAttach()) ret->setAttach(*attach);
    if (getAttendee()) ret->setAttendee(*attendee);
    if (getCategories()) ret->setCategories(*categories);
    if (getComment()) ret->setComment(*comment);
    if (getContact()) ret->setContact(*contact);
    if (getExDate()) ret->setExDate(*exDate);
    if (getExRule()) ret->setExRule(*exRule);
    if (getRStatus()) ret->setRStatus(*rStatus);
    if (getRelated()) ret->setRelated(*related);
    if (getResources()) ret->setResources(*resources);
    if (getRDate()) ret->setRDate(*rDate);
    if (getRRule()) ret->setRRule(*rRule);
    if (getXProp()) ret->setXProp(*xProp);

    return ret;
}
예제 #3
0
void SetGripperRotationPosition::executionWorker()
{
    qDebug("Task#%lu %s started", getTaskId(), taskName.c_str());
    PlatformManipulatorAndIRBumper *platformManipulatorAndIRBumper = PlatformManipulatorAndIRBumper::getInstance();

    /************************************ emulation *********************start***************************/
    platformManipulatorAndIRBumper->setGripperADCRotation(355); //0 degrees = 355;
    /************************************ emulation *********************finish**************************/

    float sigma = 0.5; //precision in degrees

    //true CW
    bool direction = (angle > platformManipulatorAndIRBumper->getGripperRotation()) ? true : false;

    float cutoffAngle = angle * 0.99; //<<<<<<<<<<<<<<< dynamic parameter

    if (abs(abs(angle) - abs(platformManipulatorAndIRBumper->getGripperRotation())) < sigma)
    {
        this_thread::sleep_for(std::chrono::milliseconds(100));
        setCompleted();
        return;
    }

    while (!stopped)
    {
        if (!executing)
        {
            if (direction) //rotate gripper CW
            {
                platformManipulatorAndIRBumper->manGripperRotateCW();
            }
            else
            {
                platformManipulatorAndIRBumper->manGripperRotateCCW();
            }
            executing = true;
        }
        else
        {

            if (qDebugOn)
            {
                qDebug("Task#%lu: GripperRotation (deg) = %f, target (deg) = %f, cutoffAngle = %f, dSigma = %f ? %f, direction: %s", getTaskId(), platformManipulatorAndIRBumper->getGripperRotation(), angle, cutoffAngle, abs(abs(angle) - abs(platformManipulatorAndIRBumper->getGripperRotation())), sigma, (direction ? "CW" : "CCW"));
            }

            if ((direction && platformManipulatorAndIRBumper->getGripperRotation() >= cutoffAngle) || ((!direction && platformManipulatorAndIRBumper->getGripperRotation() <= cutoffAngle)) || (abs(angle - platformManipulatorAndIRBumper->getGripperRotation()) < sigma))
            {
                platformManipulatorAndIRBumper->manGripperRotateStop();
                setCompleted();
                break;
            }

            /************************************ emulation *********************start***************************/
            int positionADC = platformManipulatorAndIRBumper->getGripperADCRotation();
            if (direction)
            {
                positionADC += 1;
            }
            else
            {
                positionADC -= 1;
            }
            platformManipulatorAndIRBumper->setGripperADCRotation(positionADC);
            /************************************ emulation *********************finish**************************/
        }
        this_thread::sleep_for(std::chrono::milliseconds(50));
    }

    if (!getCompleted())
    {
        string msg = Valter::format_string("Task#%lu has been stopped via stopExecution() signal", getTaskId());
        qDebug("%s", msg.c_str());
        TaskManager::getInstance()->sendMessageToCentralHostTaskManager(Valter::format_string("%lu~notes~%s", getTaskId(), msg.c_str()));

        setCompleted();
    }
}
예제 #4
0
void SetGripperGrasperPosition::executionWorker()
{
    qDebug("Task#%lu %s started", getTaskId(), taskName.c_str());
    PlatformManipulatorAndIRBumper *platformManipulatorAndIRBumper = PlatformManipulatorAndIRBumper::getInstance();

    /************************************ emulation *********************start***************************/
    platformManipulatorAndIRBumper->setGripperADCPosition(300); //0 (opened) = 300;
    /************************************ emulation *********************finish**************************/

    float sigma = 0.25; //precision in mm

    //opening - true
    bool direction = (position > platformManipulatorAndIRBumper->getGripperPosition()) ? true : false;

    float cutoffPosition = (direction) ? (position * 1) : (position / 1); //<<<<<<<<<<<<<<< dynamic parameter

    if (abs(position - platformManipulatorAndIRBumper->getGripperPosition()) < sigma)
    {
        this_thread::sleep_for(std::chrono::milliseconds(100));
        setCompleted();
        return;
    }

    while (!stopped)
    {
        if (!executing)
        {
            if (direction) //open grasper
            {
                platformManipulatorAndIRBumper->manGripperOpen();
            }
            else
            {
                platformManipulatorAndIRBumper->manGripperClose();
            }
            executing = true;
        }
        else
        {

            if (qDebugOn)
            {
                qDebug("Task#%lu: GripperGrasperPosition (mm) = %f, target (mm) = %f, cutoffPosition = %f, dSigma = %f ? %f, direction: %s", getTaskId(), platformManipulatorAndIRBumper->getGripperPosition(), position, cutoffPosition, abs(position - platformManipulatorAndIRBumper->getGripperPosition()), sigma, (direction ? "openning" : "closing"));
            }

            if ((direction && platformManipulatorAndIRBumper->getGripperPosition() >= cutoffPosition) || ((!direction && platformManipulatorAndIRBumper->getGripperPosition() <= cutoffPosition)) || (abs(position - platformManipulatorAndIRBumper->getGripperPosition()) < sigma))
            {
                platformManipulatorAndIRBumper->manGripperStop();
                setCompleted();
                break;
            }

            /************************************ emulation *********************start***************************/
            int positionADC = platformManipulatorAndIRBumper->getGripperADCPosition();
            if (direction)
            {
                positionADC -= 1;
            }
            else
            {
                positionADC += 1;
            }
            platformManipulatorAndIRBumper->setGripperADCPosition(positionADC);
            /************************************ emulation *********************finish**************************/
        }
        this_thread::sleep_for(std::chrono::milliseconds(50));
    }

    if (!getCompleted())
    {
        string msg = Valter::format_string("Task#%lu has been stopped via stopExecution() signal", getTaskId());
        qDebug("%s", msg.c_str());
        TaskManager::getInstance()->sendMessageToCentralHostTaskManager(Valter::format_string("%lu~notes~%s", getTaskId(), msg.c_str()));

        setCompleted();
    }
}