• attachment:missing_objects_query_solution.cpp of Events/CoTeSys-ROS-School/Day6

Attachment 'missing_objects_query_solution.cpp'

Download

   1 #include <string>
   2 #include <iostream>
   3 
   4 #include <ros/ros.h>
   5 #include <ros/node_handle.h>
   6 #include <json_prolog/prolog.h>
   7 
   8 using namespace std;
   9 using namespace json_prolog;
  10 
  11 int main(int argc, char *argv[])
  12 {
  13   ros::init(argc, argv, "main");
  14 
  15   Prolog pl;
  16 
  17   //////////////////////////////////////////////////////////////////////////////
  18   // Get Percepts from Table 1 - happens in another thread
  19   // TODO: Where?
  20   //////////////////////////////////////////////////////////////////////////////
  21 
  22   //////////////////////////////////////////////////////////////////////////////
  23   // Insert to Knowrob - happens in another thread
  24   // TODO: Where?
  25   //////////////////////////////////////////////////////////////////////////////
  26 
  27   //////////////////////////////////////////////////////////////////////////////
  28   // Query knowrob
  29   //////////////////////////////////////////////////////////////////////////////
  30   string q = "comp_misingobj:comp_missingObjectTypes(PerceivedObj, MissingObj, MissingTypes)";
  31   
  32   PrologQueryProxy bdgs = pl.query(q);
  33   for(PrologQueryProxy::iterator it=bdgs.begin(); it != bdgs.end(); it++)
  34   {
  35     PrologBindings bdg = *it;
  36     ROS_INFO_STREAM("PerceivedObj = "<< bdg["PerceivedObj"]);
  37     ROS_INFO_STREAM("MissingObj = "<< bdg["MissingObj"]);
  38     ROS_INFO_STREAM("MissingTypes = "<< bdg["MissingTypes"]);
  39   }
  40 
  41   //////////////////////////////////////////////////////////////////////////////
  42   //Navigate to Table 2
  43   //////////////////////////////////////////////////////////////////////////////
  44 
  45   //////////////////////////////////////////////////////////////////////////////
  46   // Get Percepts from Table 2 - happens in another thread
  47   // TODO: Where?
  48   //////////////////////////////////////////////////////////////////////////////
  49 
  50   //////////////////////////////////////////////////////////////////////////////
  51   // Fetch Object
  52   // TODO: How? Service, Actionlib?
  53   //////////////////////////////////////////////////////////////////////////////
  54 
  55   //////////////////////////////////////////////////////////////////////////////
  56   // Navigate to Table 1
  57   //////////////////////////////////////////////////////////////////////////////
  58   
  59   //////////////////////////////////////////////////////////////////////////////
  60   // Find empty surface
  61   //////////////////////////////////////////////////////////////////////////////
  62 
  63   //////////////////////////////////////////////////////////////////////////////
  64   // Put down the objects
  65   //////////////////////////////////////////////////////////////////////////////
  66   return 0;
  67 }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2010-11-06 08:06:25, 3.6 KB) [[attachment:missing_objects.cpp]]
  • [get | view] (2010-11-06 08:11:19, 0.6 KB) [[attachment:missing_objects_query.cpp]]
  • [get | view] (2010-11-06 17:01:29, 2.5 KB) [[attachment:missing_objects_query_solution.cpp]]
  • [get | view] (2010-11-06 17:01:38, 4.6 KB) [[attachment:missing_objects_solution.cpp]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.