Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add owlready2-based OntologyConcept #141

Merged
merged 31 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
baae59a
add pycharm tips
Mar 11, 2024
e929478
add OntologyOwl class using OwlReady2 to fetch object classes by onto…
Mar 14, 2024
399f500
BulletWorldTestCase add OntologyOWL init
Mar 25, 2024
ab4181f
OntologyHandheldObject, OntologyPlaceHolderObject + DesignatorDescrip…
Mar 27, 2024
7e8bca8
add ontology.ipynb
Apr 2, 2024
176640b
abbrev -> full-named vars
Apr 5, 2024
c256249
new-pycram-ci.yml install ontology deps
Apr 5, 2024
5db24bb
doc/source/examples.rst Add Ontology notebook section
Apr 5, 2024
830a8a7
Merge branch 'dev' into onto_concept
Apr 5, 2024
6c46980
update after merge from dev
Apr 5, 2024
2a21fc5
add OntologyConceptHolder, wrapping owlready2.Thing
Apr 8, 2024
f85d0ba
OntologyConceptHolder fix get_ontology_concept_holders_by_class()
Apr 8, 2024
47acbf6
OntologyManager put ontology loading into load_ontology()
Apr 9, 2024
e9ac814
Merge branch 'dev' into tmp_onto_concept
Apr 9, 2024
1e4ab04
OntologyConceptHolder typehint
Apr 9, 2024
a6971b3
Merge branch 'dev' into tmp_onto_concept
Apr 9, 2024
a0bfc51
Ontology.ipynb print just a few examples of classes-query results only
Apr 10, 2024
9b526ea
Add OntologyConceptHolderStore as singleton to store all instances of…
Apr 10, 2024
a028b6f
OntologyConceptHolderStore: get_ontology_concept_of_designator() more…
Apr 10, 2024
7a3ed97
ontology.ipynb correct text
Apr 10, 2024
f1853df
ontology.ipynb Example2: resolve by ontology_concept_holder to be exact
Apr 10, 2024
d6714d4
More typehint for None possible return
Apr 11, 2024
fdba8a4
ontology.ipynb typo
Apr 11, 2024
308bf59
ontology.ipynb correct text
Apr 12, 2024
b57a166
OntologyManager fetch soma, dul safely
Apr 28, 2024
4cb9888
load_ontology() always return ontology + namespace, which can never b…
Apr 28, 2024
f3749ff
address comment docstrings
May 27, 2024
8f836cb
Merge branch 'dev' into onto_concept
May 27, 2024
ed817eb
create_ontology_linked_designator() designator_name -> object_name
May 27, 2024
aef78a2
Merge branch 'dev' into onto_concept
May 28, 2024
ff5d61f
fix after merge with devel: rem spawning plane object due to existing…
May 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/new-pycram-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
cd /opt/ros/overlay_ws/src/pycram
pip3 install -r requirements.txt
pip3 install -r requirements-resolver.txt
pip3 install -r requirements-ontology.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this and add the requirement to requirements.txt

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subject to our consensus on whether to make Ontology integration as optional or not.


- name: Install pytest & pyjpt
run: |
Expand Down
6 changes: 6 additions & 0 deletions doc/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,9 @@ ORM Examples
notebooks/orm_example
notebooks/migrate_neems
notebooks/orm_querying_examples

Ontology
==========

.. nbgallery::
notebooks/ontology
49 changes: 44 additions & 5 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ All dependencies are available via PyPi.

PyCRAM is developed and tested currently with Python3.8, Ubuntu 20.04 and ROS Noetic.

This guide excpects you to have a GitHub account with an SSH key (you can read about adding a new ssh key
This guide expects you to have a GitHub account with an SSH key (you can read about adding a new ssh key
`here <https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account>`_).

Installing ROS
Expand Down Expand Up @@ -166,13 +166,16 @@ Install the requirements in your python interpreter.

.. code-block:: shell

cd ~/workspace/ros/src/pycram/doc
pip install -r requirements.txt

Run pycram and build the docs.

.. code-block:: shell

cd ~/workspace/ros
roslaunch pycram ik_and_description.launch
cd src/pycram/doc
make html

Show the index.
Expand All @@ -193,7 +196,8 @@ Install PyCharm Professional

First, `install PyCharm Professional <https://www.jetbrains.com/help/pycharm/installation-guide.html#standalone>`_.

Create a JetBrains account and verify it for educational purpose. Now you can unlock the PyCharm Professional features in PyCharm.
Create a JetBrains account and verify it for educational purpose. Normally, a school email address would suffice, otherwise you would have to upload your student/employee id card. The verification process typically takes 1~2-week time, so until then please use Trial version.
Once your account is verified, you can unlock the PyCharm Professional features in PyCharm.

The next step will set up the virtual Python environment, so it can be used as a project interpreter in PyCharm.

Expand All @@ -207,9 +211,20 @@ The virtualenvwrapper allows to manage virtual Python environments, where additi
.. code-block:: shell

sudo pip3 install virtualenvwrapper


(Optional but recommended) Set virtualenvwrapper's `WORKON_HOME` env variable, of which the default value is `~/.virtualenvs`

.. code-block:: shell

echo "export WORKON_HOME=~/envs" >> ~/.bashrc
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
mkdir -p $WORKON_HOME

Activate virtualenvwrapper at terminal start

.. code-block:: shell

echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc

Create a virtual env based on the workspaces libraries (see build-ws_) and add the `--system-site-packages` to get them properly. The env will be registered in `$WORKON_HOME`.
Expand Down Expand Up @@ -264,6 +279,29 @@ folder as Tests and the resources as Resources.

To verify that it works, you can execute any Testcase.

**Useful tips**

- `Keyboard shortcuts <https://www.jetbrains.com/help/pycharm/mastering-keyboard-shortcuts.html>`_
- `Keymap <https://www.jetbrains.com/help/pycharm/mastering-keyboard-shortcuts.html#ws_print_keymap>`_

- `Python interpreter <https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html>`_
- `Python virtual environment <https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html>`_
- `Python packages <https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html>`_
- `Python console <https://www.jetbrains.com/help/pycharm/using-consoles.html>`_

- **View | Active Editor | Soft-wrap**: wrap text inside the editor view

- **View | Tool Windows | Structure**: display structure window for easy content navigation

- **F12**: Open terminal

- **Double Shift**: Quick file search

- **Ctrl F/R**: Find/Replace text in current file

- **Ctrl Shift F/R**: Find/Replace text in the whole project, module, directory, scope

- **Settings | Editor | Inspections | Code is compatible with specific Python versions**: Enable/Disable Python version-specific warnings

Using IPython as REPL
=====================
Expand All @@ -281,7 +319,8 @@ Enable autoreload

To use changes made in the Python file while the Repl is running you need to enable the iPython extension ``autoreload``.
This can be done using the iPython startup files, these are files which are always run if iPython is started.
The startup files are located in ``~/.ipython/profile_default/startup`` along with a README file which explains the usage
First run ``ipython profile create`` to create a `default profile <https://ipython.readthedocs.io/en/stable/config/intro.html>`_.
Then you will find the startup files located in ``~/.ipython/profile_default/startup`` along with a README file which explains the usage
of the startup files. In this directory create a file called ``00-autoreload.ipy`` and enter the following code to the file.


Expand All @@ -297,7 +336,7 @@ code in the shell is executed.
Run scripts
-----------

IPython allows to run Python files and enabled the access to created variables. This can be helpful
IPython allows to run Python files and enables the access to created variables. This can be helpful
if you want to create a setup script which initializes things like the BulletWorld, Objects and imports
relevant modules.

Expand Down
9 changes: 8 additions & 1 deletion doc/source/remarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ To fix this issue one has to execute

python -m ipykernel install --user --name <kernel_name> --display-name "<Name_to_display>"

, eg.

.. code-block:: shell

python -m ipykernel install --user --name pycram --display-name "pycram"

in your terminal. --name is the name of your virtual environment and --display-name is the name
that will display in the drop down menu of jupyter. After that, select the correct kernel and
that will display in the drop down menu of jupyter. After that, select the correct Python interpreter kernel (``pycram``) and
everything should work now.
Refer `here <https://www.jetbrains.com/help/pycharm/configuring-jupyter-notebook.html#resolving-kernel-mismatch-error-of-configured-server>`_ for details.

Adding Notebooks to the Documentation
=====================================
Expand Down
Loading
Loading