Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
interact_with_knowrob_via_ros [2013/01/09 21:12] – [Interact with KnowRob via ROS] tenorth | interact_with_knowrob_via_ros [2013/02/12 17:41] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 10: | Line 10: | ||
===== Client libraries ===== | ===== Client libraries ===== | ||
The communication with the // | The communication with the // | ||
+ | |||
+ | |||
+ | ==== Python client ==== | ||
<code python> | <code python> | ||
Line 30: | Line 33: | ||
</ | </ | ||
+ | ==== C++ client ==== | ||
+ | |||
+ | <code c++> | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | using namespace std; | ||
+ | using namespace json_prolog; | ||
+ | |||
+ | int main(int argc, char *argv[]) | ||
+ | { | ||
+ | ros:: | ||
+ | |||
+ | Prolog pl; | ||
+ | |||
+ | PrologQueryProxy bdgs = pl.query(" | ||
+ | |||
+ | for(PrologQueryProxy:: | ||
+ | it != bdgs.end(); it++) | ||
+ | { | ||
+ | PrologBindings bdg = *it; | ||
+ | cout << "Found solution: " << (bool)(it == bdgs.end()) << endl; | ||
+ | cout << "A = "<< | ||
+ | cout << "B = " << bdg[" | ||
+ | cout << "C = " << bdg[" | ||
+ | } | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== Java client ==== | ||
+ | |||
+ | <code java> | ||
+ | import edu.tum.cs.ias.knowrob.json_prolog.Prolog; | ||
+ | import edu.tum.cs.ias.knowrob.json_prolog.PrologBindings; | ||
+ | import edu.tum.cs.ias.knowrob.json_prolog.PrologQueryProxy; | ||
+ | |||
+ | |||
+ | public class JSONPrologTestClient { | ||
+ | |||
+ | public static void main(String args[]) { | ||
+ | |||
+ | Prolog pl = new Prolog(); | ||
+ | PrologQueryProxy bdgs = pl.query(" | ||
+ | |||
+ | |||
+ | for(PrologBindings bdg : bdgs) { | ||
+ | |||
+ | System.out.println(" | ||
+ | System.out.println(" | ||
+ | System.out.println(" | ||
+ | System.out.println(" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||