Code Monkey home page Code Monkey logo

knowrob_addons's Introduction

KnowRob

CI

The purpose of KnowRob is to equip robots with explicit knowledge about the world. Originally, it was implemented using the Prolog programming language. In its second iteration, KnowRob is implemented in C++, but still supports Prolog for rule-based reasoning.

The core of KnowRob is a shared library that implements a hybrid knowledge base. With hybrid, we mean that different reasoning engines can be combined in KowRob's query evaluation process. To this end, KnowRob defines a querying language and manages which parts of a query are evaluated by which reasoner or storage backend. Both reasoners and storage backends are configurable, and can be extended by plugins either in written in C++ or Python. There are a few applications shipped with this repository including a terminal application that allows to interact with KnowRob using a command line interface, and a ROS node that exposes KnowRob's querying interface to the ROS ecosystem.

Getting Started

These instructions will get you a copy of KnowRob up and running on your local machine.

Dependencies

The following list of software is required to build KnowRob:

Optional Dependencies

Some features will only be conditionally compiled if the following dependencies are found:

  • ROS1 >= Melodic, ROS2 is not supported yet

Installation

KnowRob uses CMake as build system. The following steps will guide you through the installation process. Assuming you have cloned the repository to ~/knowrob:

cd ~/knowrob
mkdir build
cd build
cmake ..
make
sudo make install

You may further need to set the SWI_HOME_DIR environment variable to the installation location of swipl:

export SWI_HOME_DIR=/usr/lib/swi-prolog

Alternatively, you may clone the KnowRob repository into a ROS workspace and build it using catkin. Please refer to the ROS documentation for further information.

Development

Any IDE with proper CMake and C++ language support should be able to load the project. For example, you can use CLion or Visual Studio Code. But support for Prolog code is usually quite limited or not existent.

Configuration

KnowRob uses a configuration file to set up the knowledge base. Internally, boost's property tree is used to parse the configuration file. Hence, JSON is one of the supported formats. The configuration file specifies the storage backends, the reasoner, and the ontologies that are loaded into the knowledge base.

An example configuration file is provided in settings/default.json:

  "data-sources": [
    {
      "path": "owl/test/swrl.owl",
      "language": "owl",
      "format": "xml"
    }
  ],
  "data-backends": [
    {
      "type": "MongoDB",
      "name": "mongodb",
      "host": "localhost",
      "port": 27017,
      "db": "mongolog1",
      "read-only": false
    }
  ],
  "reasoner": [
    {
      "type": "Mongolog",
      "name": "mongolog",
      "data-backend": "mongodb"
    }
  ]

For more information about storage backends, please refer to the Backends documentation, and for more information about reasoners, please refer to the Reasoner documentation.

Launching

Being a shared library, KnowRob cannot be launched directly but only in the context of a program that uses it.

One such program is the terminal application that allows to interact with KnowRob using a command line interface. It can be launched as follows:

knowrob-terminal --config-file ~/knowrob/settings/default.json

The configuration file is a required argument, there is no fallback configuration file.

Once the terminal is up and running, you should see a greeting message and a prompt which looks like this:

Welcome to KnowRob.
For online help and background, visit http://knowrob.org/

?- 

Please refer to the CLI for documentation about the syntax of queries that can be typed into the terminal. Limited auto-completion is available. exit/0 will terminate the terminal.

Alternatively, you can expose the KnowRob querying interface as a ROS service. Please refer to the ROS documentation for further information.

Getting Familiar

Here we provide an overview about functionality of KnowRob.

Querying

The core of KnowRob is a querying interface that is built around a custom querying language. Its syntax is similar to Prolog, but it is more simplified and not Turing-complete like Prolog is.

For more information on querying in KnowRob, please have a look here.

Ontologies

KnowRob structures knowledge using ontologies. Ontologies are formal models of a domain that are used to describe the concepts in the domain and the relationships between them. In KnowRob, ontologies are generally represented as RDF graphs using the RDFS and OWL vocabularies.

Ontologies are organized in a hierarchy where each ontology is a specialization of another ontology. A common distinction is made between foundational (or top-level) ontologies, domain ontologies, and application ontologies. A foundational ontology fixes the basic concepts and relationships that are used across different domains. In KnowRob, we define a domain ontology for the robotics domain, and align it with a common foundational ontology. Applications can then import the domain ontology and extend it with application-specific concepts to cover the specific requirements of the application.

For more information on ontologies in KnowRob, please have a look here.

Triple Store and Data Access

Knowledge is represented in form of contextualized triples -- each subject-predicate-object triple has additional fields that contextualize the triple. A configurable storage backend is used to store and retrieve triples -- currently, triple stores based on Prolog, MongoDB and Redland are supported.

One important aspect in knowledge representation for robots is that a lot of knowledge is implicitly encoded in the control structures of the robot. Hence, one goal is to make this implicit knowledge explicit. This is done by mapping data to symbols in an ontology. In case of querying, this is often referred to as Ontology-based Data Access (OBDA).

For more information on storages in KnowRob, please have a look here.

Reasoning

KnowRob uses an ensemble of reasoners approach where inferences of different reasoners are combined into correlated knowledge pieces. The reason for choosing this approach is that there is no single formalism that is suited for every reasoning tasks. Instead, given a problem, one should decide what the most suitable formalism is to tackle it. Consequently, KnowRob can be configured to solve specific problems by loading corresponding reasoning modules that implement a common interface.

For more information on reasoning in KnowRob, please have a look here.

Further Information

More documentation can be found in the following pages:

In addition, the following resources are available:

knowrob_addons's People

Contributors

airballking avatar aljoshare avatar andreihaidu avatar asilx avatar bbferka avatar bbrieber avatar daniel86 avatar fairlight1337 avatar furushchev avatar gaya- avatar gheorghelisca avatar haidu avatar ichumuh avatar joserochh avatar jworch avatar mh0rst avatar moesenle avatar mpomarlan avatar mtenorth avatar sasjonge avatar seba90 avatar zyfang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

knowrob_addons's Issues

Could not resolve all dependencies for configuration

Hello everyone!
When I install the knowrob_addons,I find a difficult problem.
I input the commands in the terminal:
cd ~/catkin_ws
catkin_make
Then I find the errors in the terminal:
.........................................................................................................................................................
FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all dependencies for configuration ':knowrob_meshes:compile'.

Could not find any version that matches org.knowrob.knowrob_cram:knowrob_cram:[0.1,).
Required by:
org.knowrob.knowrob_meshes:knowrob_meshes:1.0.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    make[2]: *** [stacks/knowrob_addons/knowrob_meshes/CMakeFiles/gradle-knowrob_meshes] error 1
    make[1]: *** [stacks/knowrob_addons/knowrob_meshes/CMakeFiles/gradle-knowrob_meshes.dir/all] error 2
    make[1]: ....

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all dependencies for configuration ':knowrob_memory_graph:compile'.

Could not find any version that matches org.knowrob.knowrob_cram:knowrob_cram:[0.1,).
Required by:
org.knowrob.knowrob_memory_graph:knowrob_memory_graph:0.1.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all dependencies for configuration ':knowrob_plan_summary:compile'.

Could not find any version that matches org.knowrob.knowrob_cram:knowrob_cram:[0.1,).
Required by:
org.knowrob.knowrob_plan_summary:knowrob_plan_summary:0.1.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    make[2]: *** [stacks/knowrob_addons/knowrob_memory_graph/CMakeFiles/gradle-knowrob_memory_graph] error 1
    make[1]: *** [stacks/knowrob_addons/knowrob_memory_graph/CMakeFiles/gradle-knowrob_memory_graph.dir/all] error 2
    make[2]: *** [stacks/knowrob_addons/knowrob_plan_summary/CMakeFiles/gradle-knowrob_plan_summary] error 1
    make[1]: *** [stacks/knowrob_addons/knowrob_plan_summary/CMakeFiles/gradle-knowrob_plan_summary.dir/all] error 2

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all dependencies for configuration ':knowrob_chemlab:compile'.

Could not find any version that matches org.knowrob.knowrob_cram:knowrob_cram:[0.1,).
Required by:
org.knowrob.knowrob_chemlab:knowrob_chemlab:1.0.0
Could not find any version that matches org.knowrob.knowrob_sim_games:knowrob_sim_games:[0.1,).
Required by:
org.knowrob.knowrob_chemlab:knowrob_chemlab:1.0.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    make[2]: *** [stacks/knowrob_addons/knowrob_chemlab/CMakeFiles/gradle-knowrob_chemlab] error 1
    make[1]: *** [stacks/knowrob_addons/knowrob_chemlab/CMakeFiles/gradle-knowrob_chemlab.dir/all] error 2

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not resolve all dependencies for configuration ':knowrob_openease:compile'.

Could not find any version that matches org.knowrob.knowrob_cram:knowrob_cram:[0.1,).
Required by:
org.knowrob.knowrob_openease:knowrob_openease:1.0.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    make[2]: *** [stacks/knowrob_addons/knowrob_openease/CMakeFiles/gradle-knowrob_openease] error 1
    make[1]: *** [stacks/knowrob_addons/knowrob_openease/CMakeFiles/gradle-knowrob_openease.dir/all] error 2
    make: *** [all] error 2
    Invoking "make -j8 -l8" failed
    ....................................................................................................................................................

I find the package knowrob_cram is located in the folder knowrob_addons,and the package knowrob_meshes, knowrob_memory_graph, knowrob_plan_summary, knowrob_chemlab, knowrob_openease are also located in the folder knowrob_addons.In addition,these packages are all depend on the package knowrob_cram.
As a result, when I catkin_make the workspace,the system could not resolve all dependencies for configuration?

Which one can help me solve the problem?
Thanks a lot!

memory_graph extensions

Story: code-iai/knowrob_backlog#30

  • 'update_task_tree' predicate can accept prolog lists along with java arrays.
  • also, this predicate can support namespaces

so that, in the end, we have nice compact queries

knowrob_addons does not build using catkin tools

I tried build a fresh workspace with knowrob and knowrob_addons using catkin_tools. Unfortunately, it did not work. I know this is a nice-to-have feature. Still, I want to document this here. Maybe we manage to fix this in the future.

setup:
ROS Indigo
knowrob_addons commit: e4b9117
knowrob commit: 6d8c92b34

failure:

Errors     << knowrob_sim_games:cmake /home/gbartels/ros/indigo/robohow/logs/knowrob_sim_games/build.cmake.004.log
CMake Error at /home/gbartels/ros/indigo/robohow/src/stacks/knowrob_addons/knowrob_sim_games/CMakeLists.txt:7 (catkin_rosjava_setup):
  Unknown CMake command "catkin_rosjava_setup".

further observations:
workspace builds fine using catkin_make
only knowrob built fine using catkin_tools

Bugs on https://github.com/mpomarlan/knowrob_addons

  1. get_object_transform returns 'wheel' instead of 'http://www.knowrob.org/kb/knowrob_beliefstate#TestWheel'

  2. =(RefStr, 'http://knowrob.org/kb/knowrob_paramserver.owl#MapFrameSymbol') in get_object_transform fails.

  3. replace_object_transforms('http://www.knowrob.org/kb/knowrob_beliefstate#TestWheel', ['map', 'http://www.knowrob.org/kb/knowrob_beliefstate#TestWheel', [0.5, 0, 0.8], [0, 0, 0, 1]])
    results in the following error msg:
    [ERROR] [WallTime: 1497879005.558262] Error processing request: "Prolog query failed: PrologException: error(type_error(method_params, '.'(map, '.'(map, '.'(1.4978790055262158E9, [])))), context(/(jpl_call, 4), 'not all actual parameters are convertible to Java values or references'))"
    ['Traceback (most recent call last):\n', ' File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 623, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n', ' File "/home/ichumuh/thorin_ws/src/knowrob_addons/knowrob_beliefstate/src/knowrob_beliefstate/object_state_publisher.py", line 75, in test_srv_cb\n sol = self.prolog_query(q)\n', ' File "/home/ichumuh/thorin_ws/src/knowrob_addons/knowrob_beliefstate/src/knowrob_beliefstate/object_state_publisher.py", line 102, in prolog_query\n solutions = [x for x in query.solutions()]\n', ' File "/home/ichumuh/thorin_ws/src/knowrob/json_prolog/src/json_prolog/json_prolog.py", line 38, in solutions\n 'Prolog query failed: %s' % next_solution.solution)\n', 'PrologException: "Prolog query failed: PrologException: error(type_error(method_params, '.'(map, '.'(map, '.'(1.4978790055262158E9, [])))), context(/(jpl_call, 4), 'not all actual parameters are convertible to Java values or references'))"\n']`

Weka Interface Tutorial

Story: code-iai/knowrob_backlog#7
Depends on: #39

  • create tutorial about machine learning on knowrob.org
  • use predicates that allow users to use the weka interface with episode data
  • feature selection
  • classification

The problem about the installation of knowrob_addons

Hello,
I install the knowrob in the path /home/admin6/catkin_ws/src/stacks/knowrob,
then I want to install the knowrob_addons and knowrpb_gui.But I don't know which
location should I choose for the knowrob_addons and knowrob_gui?Now I put the
knowrob_addons and knowrob_gui inn the path /home/admin6/catkin_ws/src,and
input the commands
in the terminal:
cd /home/admin6/catkin_ws
catkin_make
But I find that the knowrob_addons and knowrob_gui are not install correctly.
Should I put the knowrob_addons and the knowrob_gui in the path /home/admin6/catkin_ws/src or /home/admin6/catkin_ws/src/stacks?In addition,should I modify the .rosinstall file or CMakeLists.txt?
Could you help me?Thanks a lot!

Proper time-buffer handling in TFMemory

At the moment, the internal buffer of transformations that, for normal tf, keeps only the last 10 seconds of data, is not emptied any more. While it is intended to keep data for several short time slots, we should find a garbage collection mechanism, e.g. by storing the "last accessed" time.

In addition, finding the appropriate transform should not return transforms that are newer than the time point of interest.

Weka Interface Implementation

Story: code-iai/knowrob_backlog#7

  • Interface to Weka machine learning
  • Feature selection: Find relevant features
  • Classifcation
  • Create knowrob package: Predicates that allow users to use the weka interface with episode data

knowrob_learning doesn't compile

Hi!

After cloning knowrob_addons, i can't compile due to the following error:
[100%] Built target gradle-knowrob_openease
[100%] Built target gradle-knowrob_plan_summary
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/home/user/catkin_ws/src/knowrob_addons/knowrob_learning/knowrob_learning/src/main/java/org/knowrob/reinforcement/KitchenEnvironment.java:821: error: cannot find symbol
gripper_cmd.setPosition(0.0);
^
symbol: method setPosition(double)
location: variable gripper_cmd of type Pr2GripperCommand
/home/user/catkin_ws/src/knowrob_addons/knowrob_learning/knowrob_learning/src/main/java/org/knowrob/reinforcement/KitchenEnvironment.java:822: error: cannot find symbol
gripper_cmd.setMaxEffort(100.0);
^
symbol: method setMaxEffort(double)
location: variable gripper_cmd of type Pr2GripperCommand

I've installed the Pr2GripperCommand messages, but this doesn't fix the problem.

/edit: Happens on master as well as on the kinetic branch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.