当前位置: 首页>>代码示例>>C++>>正文


C++ PolyDriver::isValid方法代码示例

本文整理汇总了C++中PolyDriver::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ PolyDriver::isValid方法的具体用法?C++ PolyDriver::isValid怎么用?C++ PolyDriver::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PolyDriver的用法示例。


在下文中一共展示了PolyDriver::isValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: close

    bool close()
    {
        if (serverArmR.isValid())
            serverArmR.close();

        if (serverArmL.isValid())
            serverArmL.close();

        if (serverLegR.isValid())
            serverLegR.close();

        if (serverLegL.isValid())
            serverLegL.close();

        if (torso.isValid())
            torso.close();

        if (armR.isValid())
            armR.close();

        if (armL.isValid())
            armL.close();

        if (legR.isValid())
            legR.close();

        if (legL.isValid())
            legL.close();

        return true;
    }
开发者ID:apaikan,项目名称:icub-main,代码行数:31,代码来源:main.cpp

示例2: close

    //********************************************
    bool close()
    {
        yInfo("[demoAvoidance] Closing module..");

        dataPort.close();

        if (useLeftArm)
        {
            if (driverCartL.isValid())
            {
                data["left"].iarm->stopControl();
                data["left"].iarm->restoreContext(contextL);
                driverCartL.close();
            }

            if (driverJointL.isValid())
            {
                IInteractionMode *imode;
                driverJointL.view(imode);
                for (int j=0; j<5; j++)
                    imode->setInteractionMode(j,VOCAB_IM_STIFF);

                driverJointL.close();
            }
        }

        if (useRightArm)
        {
            if (driverCartR.isValid())
            {
                data["right"].iarm->stopControl();
                data["right"].iarm->restoreContext(contextR);
                driverCartR.close();
            }

            if (driverJointR.isValid())
            {
                IInteractionMode *imode;
                driverJointR.view(imode);
                for (int j=0; j<5; j++)
                    imode->setInteractionMode(j,VOCAB_IM_STIFF);

                driverJointR.close();
            }
        }

        return true;
    }
开发者ID:robotology,项目名称:peripersonal-space,代码行数:49,代码来源:demoAvoidance.cpp

示例3: close

    bool close()
    {
        if (driver.isValid())
            driver.close();

        return true;
    }
开发者ID:robotology,项目名称:icub-tutorials,代码行数:7,代码来源:main.cpp

示例4: open

bool DeviceGroup::open(const char *key, PolyDriver& poly,
                       yarp::os::Searchable& config, const char *comment) {

    Value *name;
    if (config.check(key,name,comment)) {
        if (name->isString()) {
            // maybe user isn't doing nested configuration
            yarp::os::Property p;
            p.setMonitor(config.getMonitor(),
                         name->toString().c_str()); // pass on any monitoring
            p.fromString(config.toString());
            p.put("device",name->toString());
            p.unput("subdevice");
            p.unput("wrapped");
            poly.open(p);
        } else {
            Bottle subdevice = config.findGroup(key).tail();
            poly.open(subdevice);
        }
        if (!poly.isValid()) {
            printf("cannot make <%s>\n", name->toString().c_str());
            return false;
        }
    } else {
        printf("\"--%s <name>\" not set\n", key);
        return false;
    }
    return true;
}
开发者ID:paulfitz,项目名称:yarp,代码行数:29,代码来源:DeviceGroup.cpp

示例5: open

    bool open(Searchable& p) {
        bool dev = true;
        if (p.check("nodevice")) {
            dev = false;
        }
        if (dev) {
            poly.open(p);
            if (!poly.isValid()) {
                printf("cannot open driver\n");
                return false;
            }
            
            if (!p.check("mute")) {
                // Make sure we can write sound
                poly.view(put);
                if (put==NULL) {
                    printf("cannot open interface\n");
                    return false;
                }
            }
        }
            
        port.setStrict(true);
        if (!port.open(p.check("name",Value("/yarphear")).asString())) {
            printf("Communication problem\n");
            return false;
        }
        
        if (p.check("remote")) {
            Network::connect(p.check("remote",Value("/remote")).asString(),
                             port.getName());
        }

        return true;
    }
开发者ID:andreadelprete,项目名称:yarp,代码行数:35,代码来源:yarphear.cpp

示例6: configure

    bool configure(ResourceFinder &rf)
    {
        Property options;
        options.put("device","fakeyServer");
        options.put("local","/fake_robot/fake_part");

        driver.open(options);
        return driver.isValid();
    }
开发者ID:robotology,项目名称:icub-tutorials,代码行数:9,代码来源:main.cpp

示例7: terminate

    void terminate()
    {
        if (!imgInPort.isClosed())
            imgInPort.close();

        if (!imgOutPort.isClosed())
            imgOutPort.close();

        if (drvGaze.isValid())
            drvGaze.close();

        if (drvCart.isValid())
            drvCart.close();

        if (drvArm.isValid())
            drvArm.close();

        if (drvAnalog.isValid())
            drvAnalog.close();
    }
开发者ID:pattacini,项目名称:icub-contrib,代码行数:20,代码来源:main.cpp

示例8: close

    //********************************************
    bool close()
    {
        dataPort.close();

        if (driverCartL.isValid())
        {
            data["left"].iarm->stopControl();
            data["left"].iarm->restoreContext(contextL);
            driverCartL.close(); 
        }

        if (driverCartR.isValid())
        {
            data["right"].iarm->stopControl();
            data["right"].iarm->restoreContext(contextR);
            driverCartR.close();
        }

        if (driverJointL.isValid())
        {
            IInteractionMode *imode;
            driverJointL.view(imode);
            for (int j=0; j<5; j++)
                imode->setInteractionMode(j,VOCAB_IM_STIFF);

            driverJointL.close();
        }

        if (driverJointR.isValid())
        {
            IInteractionMode *imode;
            driverJointR.view(imode);
            for (int j=0; j<5; j++)
                imode->setInteractionMode(j,VOCAB_IM_STIFF);

            driverJointR.close();
        }

        return true;
    }
开发者ID:towardthesea,项目名称:peripersonal-space,代码行数:41,代码来源:demoAvoidance.cpp

示例9: close

    virtual bool close()
    {
        yInfo("Stopping dumper class\n");
        for(int i = 0; i < nData; i++)
            myDumper[i].stop();

        yInfo("Deleting dumper class\n");
        delete[] myDumper;

        //finally close the dd of the remote control board
        yInfo("Closing the device driver\n");
        if (ddBoard.isValid()) ddBoard.close();
        yInfo("Device driver closed\n");

        //finally close the dd of the debug interface clien
        yInfo("Closing the debug interface\n");
        if (ddDebug.isValid()) ddDebug.close();
        yInfo("Debug interface closed\n");

        delete[] thetaMap;
        delete[] dataToDump;
        return true;
    }
开发者ID:robotology,项目名称:icub-main,代码行数:23,代码来源:main.cpp

示例10: close

    bool close()
    {
        handlerPort.close();
		objectsPort.close();

		igaze->stopControl();
		igaze->restoreContext(startupGazeContextID);
		igaze->deleteContext(startupGazeContextID);
		igaze->deleteContext(currentGazeContextID);

		if (clientGazeCtrl.isValid())
			clientGazeCtrl.close();

		icartLeft->stopControl();
		icartLeft->restoreContext(startupArmLeftContextID);
		icartLeft->deleteContext(startupArmLeftContextID);
		icartLeft->deleteContext(currentArmLeftContextID);

		if (clientArmLeft.isValid())
			clientArmLeft.close();

		icartRight->stopControl();
		icartRight->restoreContext(startupArmRightContextID);
		icartRight->deleteContext(startupArmRightContextID);
		icartRight->deleteContext(currentArmRightContextID);

		if (clientArmLeft.isValid())
			clientArmLeft.close();

		itorsoVelocity->stop();
		
		if (clientTorso.isValid())
		clientTorso.close();
		
        return true;
    }
开发者ID:tanismar,项目名称:merge-point-clouds,代码行数:36,代码来源:torsoDemo.cpp

示例11: link

bool PolyDriver::link(PolyDriver& alt) {
    if (!alt.isValid()) return false;
    if (isValid()) return false;
    dd = alt.dd;
    if (system_resource!=NULL) {
        int ct = HELPER(system_resource).removeRef();
        if (ct==0) {
            yAssert(system_resource!=NULL);
            delete &HELPER(system_resource);
        }
    }
    system_resource = alt.system_resource;
    yAssert(dd!=NULL);
    yAssert(system_resource!=NULL);
    HELPER(system_resource).addRef();
    return true;
}
开发者ID:giuliavezzani,项目名称:yarp,代码行数:17,代码来源:PolyDriver.cpp

示例12: connect

    bool connect()
    {
        drv=new PolyDriver(drvOptions);

        if (drv->isValid())
            connected=drv->view(pos)&&drv->view(enc);
        else
            connected=false;

        if (!connected)
        {
            delete drv;
            drv=0;
        }

        return connected;
    }
开发者ID:praveenv4k,项目名称:icub-main,代码行数:17,代码来源:main.cpp

示例13: main

int main(int argc, char *argv[])
{
    Network yarp;       // Initialize yarp framework

    // use YARP to create and configure an instance of fakeDepthCamera
    Property config;
    config.put("device", "fakeDepthCamera");         // device producing (fake) data
    config.put("mode",   "ball");                    // fake data type to be produced

    PolyDriver dd;
    dd.open(config);
    if (!dd.isValid())
    {
        yError("Failed to create and configure a the fake device\n");
        return 1;
    }

    yarp::dev::IRGBDSensor *RGBDInterface;              // interface we want to use
    if (!dd.view(RGBDInterface))                        // grab wanted device interface
    {
        yError("Failed to get RGBDInterface device interface\n");
        return 1;
    }

    // Let's use the interface to get info from device
    int rgbImageHeight   = RGBDInterface->getRgbHeight();
    int rgbImageWidth    = RGBDInterface->getRgbWidth();
    int depthImageHeight = RGBDInterface->getDepthHeight();
    int depthImageWidth  = RGBDInterface->getDepthWidth();

    FlexImage rgbImage;
    ImageOf<PixelFloat> depthImage;
    bool gotImage = RGBDInterface->getImages(rgbImage, depthImage);

    if(gotImage)
        yInfo("Succesfully retieved an image");
    else
        yError("Failed retieving images");

    yarp::os::Property intrinsic;
    RGBDInterface->getRgbIntrinsicParam(intrinsic);
    yInfo("RGB intrinsic parameters: \n%s", intrinsic.toString().c_str());
    dd.close();

    return 0;
}
开发者ID:robotology,项目名称:yarp,代码行数:46,代码来源:RGBD_test_1a.cpp

示例14: configure

bool OnlineStictionEstimator::configure(PolyDriver &driver, const Property &options)
{
    if (driver.isValid() && options.check("joint"))
    {
        bool ok=true;
        ok&=driver.view(imod);
        ok&=driver.view(ilim);
        ok&=driver.view(ienc);
        ok&=driver.view(ipid);
        ok&=driver.view(iolc);

        if (!ok)
            return false;

        joint=options.find("joint").asInt();
        setRate((int)(1000.0*options.check("Ts",Value(0.01)).asDouble()));

        T=options.check("T",Value(2.0)).asDouble();
        Kp=options.check("Kp",Value(10.0)).asDouble();
        Ki=options.check("Ki",Value(250.0)).asDouble();
        Kd=options.check("Kd",Value(15.0)).asDouble();
        vel_thres=fabs(options.check("vel_thres",Value(5.0)).asDouble());
        e_thres=fabs(options.check("e_thres",Value(1.0)).asDouble());

        gamma.resize(2,1.0);
        if (Bottle *pB=options.find("gamma").asList()) 
        {
            size_t len=std::min(gamma.length(),(size_t)pB->size());
            for (size_t i=0; i<len; i++)
                gamma[i]=pB->get(i).asDouble();
        }

        stiction.resize(2,0.0);
        if (Bottle *pB=options.find("stiction").asList()) 
        {
            size_t len=std::min(stiction.length(),(size_t)pB->size());
            for (size_t i=0; i<len; i++)
                stiction[i]=pB->get(i).asDouble();
        }

        return configured=true;
    }
    else
        return false;
}
开发者ID:Karma-Revolutions,项目名称:icub-main,代码行数:45,代码来源:tuning.cpp

示例15: threadInit

    /*
     * init the thread, instantiate the device driver and connet the ports appropriately.
     * @return true iff successful.
     */
    virtual bool threadInit() {
        Property p;
        p.put("device", "logpolarclient");
        p.put("local", local.c_str());
        p.put("remote", remote.c_str());
        poly.open(p);
        if (poly.isValid()) {
            poly.view(lpImage);
            active = false;

            if (lpImage != 0) {
                const int nang = lpImage->nang();
                const int necc = lpImage->necc();
                const int fovea = lpImage->fovea();
                const double overlap = lpImage->overlap();

                if (necc != 0 && nang != 0) {
                    fprintf(stdout, "logpolar format with ang: %d ecc: %d fov: %d ovl: %f\n",
                        nang,
                        necc,
                        fovea,
                        overlap);

                    fprintf(stdout, "cartesian image of size %d %d\n", width, height);
                    trsf.allocLookupTables(L2C, necc, nang, width, height, overlap);
                    active = true;

                    lp.resize(nang, necc);
                    
                    // open the out port.
                    out.open(outname.c_str());
                }
            }
        }
        return active;
    }
开发者ID:robotology,项目名称:logpolar,代码行数:40,代码来源:logpolarRemapper.cpp


注:本文中的PolyDriver::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。