SemanticMapToOWLTestClient.java
Go to the documentation of this file.
00001 package edu.tum.cs.ias.knowrob.map;
00002 
00003 import ros.*;
00004 import ros.pkg.mod_semantic_map.srv.*;
00005 import ros.pkg.mod_semantic_map.msg.*;
00006 
00007 
00008 
00009 public class SemanticMapToOWLTestClient {
00010 
00011         
00013         // ROS stuff
00014         
00015         static Boolean rosInitialized = false;
00016         static Ros ros;
00017         static NodeHandle n;
00018         
00020 
00021                 
00022 
00023         public static void main(String args[]) {
00024                   
00025                 Ros ros = Ros.getInstance();
00026                 if(!Ros.getInstance().isInitialized()) {
00027                         ros.init("semantic_map_to_owl_test_client");
00028                 }
00029                 NodeHandle n = ros.createNodeHandle();
00030 
00031                 
00032                 // create map
00033 
00034                 GenerateSemanticMapOWL.Request req = new GenerateSemanticMapOWL.Request();
00035                 req.map= new SemMap();
00036     // Set the IRI for the map that will be created
00037                 req.map.header.frame_id="http://www.example.com/foo.owl#";
00038                 req.map.header.stamp=ros.now();
00039                 
00040 //              req.map.objects = new SemMapObject[4];
00041                 
00042                 
00043                 // create cupboard
00044     req.map.objects.add(new SemMapObject());
00045                 req.map.objects.get(0).id=1;
00046                 req.map.objects.get(0).partOf=0;
00047                 req.map.objects.get(0).type="cupboard";
00048 
00049                 req.map.objects.get(0).depth  = 55.6f;
00050                 req.map.objects.get(0).width  = 60.7f;
00051                 req.map.objects.get(0).height = 70.6f;
00052 
00053                 req.map.objects.get(0).pose = new float[] { 1.0f,0.0f,0.0f,2.3f,
00054                                                                                         0.0f,1.0f,0.0f,1.2f,
00055                                                                                         0.0f,0.0f,1.0f,0.4f,
00056                                                                                         0.0f,0.0f,0.0f,1.0f};           
00057                 // create door
00058                 req.map.objects.add(new SemMapObject());
00059                 req.map.objects.get(1).id=2;
00060                 req.map.objects.get(1).partOf=1;
00061                 req.map.objects.get(1).type="Door";
00062 
00063                 req.map.objects.get(1).depth  = 0.6f;
00064                 req.map.objects.get(1).width  = 60.7f;
00065                 req.map.objects.get(1).height = 70.6f;
00066 
00067                 req.map.objects.get(1).pose = new float[] { 1.0f,0.0f,0.0f,2.4f,
00068                                                                                         0.0f,1.0f,0.0f,1.3f,
00069                                                                                         0.0f,0.0f,1.0f,0.4f,
00070                                                                                         0.0f,0.0f,0.0f,1.0f};           
00071                 // create hinge
00072                 req.map.objects.add(new SemMapObject());
00073                 req.map.objects.get(2).id=3;
00074                 req.map.objects.get(2).partOf=2;
00075                 req.map.objects.get(2).type="HINGEDJOINT";
00076 
00077                 req.map.objects.get(2).depth  = 5.6f;
00078                 req.map.objects.get(2).width  = 0.7f;
00079                 req.map.objects.get(2).height = 0.6f;
00080 
00081                 req.map.objects.get(2).pose = new float[] { 1.0f,0.0f,0.0f,2.5f,
00082                                                                                         0.0f,1.0f,0.0f,1.4f,
00083                                                                                         0.0f,0.0f,1.0f,0.4f,
00084                                                                                         0.0f,0.0f,0.0f,1.0f};
00085                 
00086                 // create handle
00087                 req.map.objects.add(new SemMapObject());
00088                 req.map.objects.get(3).id=4;
00089                 req.map.objects.get(3).partOf=2;
00090                 req.map.objects.get(3).type="handle";
00091 
00092                 req.map.objects.get(3).depth  = 5.6f;
00093                 req.map.objects.get(3).width  = 6.7f;
00094                 req.map.objects.get(3).height = 7.6f;
00095 
00096                 req.map.objects.get(3).pose = new float[] { 1.0f,0.0f,0.0f,2.6f,
00097                                                                                         0.0f,1.0f,0.0f,1.5f,
00098                                                                                         0.0f,0.0f,1.0f,0.4f,
00099                                                                                         0.0f,0.0f,0.0f,1.0f};
00100 
00101                                 ServiceClient<GenerateSemanticMapOWL.Request, GenerateSemanticMapOWL.Response, GenerateSemanticMapOWL> cl = 
00102                                                         n.serviceClient("/knowrob_semantic_map_to_owl/generate_owl_map", new GenerateSemanticMapOWL());
00103                 
00104                 try {
00105                         GenerateSemanticMapOWL.Response res = cl.call(req);
00106                         System.out.println("Map:\n\n " +res.owlmap);
00107                         
00108                 } catch (RosException e) {
00109                         e.printStackTrace();
00110                 }
00111 
00112         }
00113 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


mod_semantic_map
Author(s): Moritz Tenorth
autogenerated on Thu May 23 2013 08:54:30