Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import ros.Ros;
00019 import ros.NodeHandle;
00020 import ros.RosException;
00021 import ros.ServiceClient;
00022 import ros.pkg.vision_srvs.srv.srvjlo;
00023 import ros.pkg.vision_srvs.srv.srvjlo.Response;
00024 import ros.pkg.vision_srvs.srv.srvjlo.Request;
00025 import ros.pkg.vision_msgs.msg.partial_lo;
00026 import java.util.concurrent.ExecutionException;
00027
00028 public class KBClient {
00029
00030 static boolean rosInitialized = false;
00031
00032 public static void main(String [] args) throws InterruptedException, RosException, ExecutionException {
00033
00034 }
00035
00036 public static Ros initRosInstance() {
00037
00038 Ros ros = Ros.getInstance();
00039
00040 if(!rosInitialized) {
00041 ros.init("kb_jlo_client");
00042 rosInitialized=true;
00043 }
00044
00045 return ros;
00046 }
00047
00048
00049 public static partial_lo loQuery(String command, String objName, int objID, int refFrame) throws RosException {
00050
00051 Ros ros = initRosInstance();
00052 NodeHandle n = ros.createNodeHandle();
00053
00054 ServiceClient<Request, Response, srvjlo> client = n.serviceClient("/located_object", new ros.pkg.vision_srvs.srv.srvjlo());
00055
00056 srvjlo srv = new srvjlo();
00057 Request rq = srv.createRequest();
00058
00059 rq.command=command;
00060
00061 if(command.equals("namequery")) {
00062 rq.query.name=objName;
00063 }
00064 else if(command.equals("framequery")) {
00065 rq.query.id=objID;
00066
00067 if(refFrame>0)
00068 rq.query.parent_id=refFrame;
00069 }
00070
00071 return client.call(rq).answer;
00072 }
00073
00074
00075
00076
00077 }