$search
00001 package edu.tum.cs.ias.knowrob; 00002 00003 import ros.*; 00004 import ros.pkg.mesh_label_node.srv.LabelMesh; 00005 00006 00007 public class MeshLabelTestClient { 00008 00009 00010 public static void main(String args[]) { 00011 00012 Ros ros = Ros.getInstance(); 00013 if(!Ros.getInstance().isInitialized()) { 00014 ros.init("mesh_label_test_client"); 00015 } 00016 NodeHandle n = ros.createNodeHandle(); 00017 00018 MeshVisApplet m = new MeshVisApplet(); 00019 00020 00021 for(String file : new String[]{ "./vtk/cup_handle_side_from_cylinder.vtk", 00022 //"./vtk/cup_handle_side.vtk", 00023 //"./vtk/teapot_green_order_5_th_0004.vtk", 00024 //"./vtk/teapot.vtk", 00025 //"./vtk/cornflakes.vtk" 00026 }) { 00027 00028 //m.readMeshFile(); 00029 m.readMeshFile(file); 00030 00031 //mesh_applet.readMeshData("./vtk/teapot_green_order_5_th_0004.vtk"); 00032 00033 LabelMesh.Request req = new LabelMesh.Request(); 00034 req.mesh = m.getTriangleMesh(); 00035 00036 ServiceClient<LabelMesh.Request, LabelMesh.Response, LabelMesh> cl = 00037 n.serviceClient("/mesh_label_node", new LabelMesh()); 00038 00039 try { 00040 LabelMesh.Response res = cl.call(req); 00041 System.out.println("Label: " +res.label); 00042 00043 } catch (RosException e) { 00044 e.printStackTrace(); 00045 } 00046 00047 } 00048 00049 00050 00051 } 00052 } 00053