Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision |
doc:interact_with_knowrob_via_ros [2014/08/11 15:52] – [Use KnowRob from your program] admin | doc:interact_with_knowrob_via_ros [2014/08/11 15:57] – [Use KnowRob from your program] admin |
---|
====== Use KnowRob from your program ====== | ====== Use KnowRob from your program ====== |
| |
| ~~NOTOC~~ |
\\ | \\ |
^ This page describes the 'catkinized' version of KnowRob that has been converted to the [[http://wiki.ros.org/catkin/|catkin buildsystem]] and the new [[http://wiki.ros.org/rosjava|rosjava]]. The documentation for older versions can be found [[/doc/interact_with_knowrob_via_ros?rev=1407307101|here]].^ | ^ This page describes the 'catkinized' version of KnowRob that has been converted to the [[http://wiki.ros.org/catkin/|catkin buildsystem]] and the new [[http://wiki.ros.org/rosjava|rosjava]]. The documentation for older versions can be found [[/doc/interact_with_knowrob_via_ros?rev=1401968328|here]].^ |
\\ | \\ |
| |
| The interactive Prolog shell that [[http://ros.org/wiki/rosprolog|rosprolog]] provides is good for exploring KnowRob, visualizing knowledge, developing new functions and debugging Prolog code. However, if you would like to use KnowRob in your robot's control program, you need a way to send queries from your program. This functionality is provided by the [[http://ros.org/wiki/json_prolog|json_prolog]] package. It provides a service that exposes a Prolog shell via ROS. You can run the //json_prolog// service using a launch file such as the following. The //json_prolog_node// reads two optional ROS parameters for the initial package to be loaded (that you also give as argument when starting //rosprolog//) and a command to be executed at startup, for example for parsing an OWL file. |
The interactive Prolog shell that [[http://ros.org/wiki/rosprolog|rosprolog]] provides is good for exploring KnowRob, visualizing knowledge, developing new functions and debugging Prolog code. However, if you would like to use KnowRob in your robot's control program, you need a way to send queries from your program. This functionality is provided by the [[http://ros.org/wiki/json_prolog|json_prolog]] package. It provides a service that exposes a Prolog shell via ROS. | <code xml> |
| <launch> |
You can run the //json_prolog// service using the following command. It has the same structure as rosprolog, taking a KnowRob package as final argument. | <param name="initial_package" type="string" value="knowrob_map_data" /> |
<code> | <param name="initial_goal" type="string" value="owl_parse('package://knowrob_map_data/owl/ccrl2_semantic_map.owl')" /> |
roscore | |
rosrun json_prolog json_prolog knowrob_common | <node name="json_prolog" pkg="json_prolog" type="json_prolog_node" cwd="node" output="screen" /> |
| </launch> |
</code> | </code> |
| |