2 #include <yarp/os/all.h> 6 if(yarp::os::Network::isConnected(
portRPC.getName(),
"/sam/rpc:i")) {
9 return yarp::os::Network::connect(
portRPC.getName(),
"/sam/rpc:i");
24 if (mode ==
"stop" || mode ==
"continue")
26 yarp::os::Bottle bReq, bResp;
27 bReq.addString(
"attentionModulation " + mode);
29 if (bResp.toString() ==
"ack")
34 yInfo()<<
"Received ack. Attention off";
36 else if(mode ==
"continue")
39 yInfo()<<
"Received ack. Attention on";
45 yError()<<bResp.toString();
51 yError()<<
"mode can be 'stop' or 'continue'. Received: "+ mode;
57 yarp::os::Bottle bReq, bResp, bRet;
58 bReq.addString(
"ask_" + model +
"_label");
60 if (bResp.get(0).toString() ==
"ack")
62 std::string classification = bResp.get(1).toString();
63 yInfo()<<model +
" Classification = " + classification;
64 bRet.addString(
"true");
65 bRet.addString(classification);
70 yError()<<bResp.toString();
71 bRet.addString(
"false");
72 bRet.addString(
"nack");
yarp::os::Bottle askXLabel(const std::string &model)
Method to trigger a classification from SAM.
SubSystem_SAM(const std::string &masterName)
Default constructor.
yarp::os::RpcClient portRPC
Abstract class to handle sub-systems of the icub-client.
bool attentionModulation(const std::string &mode)
Method to switch attention modes for SAM.
virtual void Close()
Clean up resources.