Skip to content

Commit

Permalink
docs: improve whoami docs (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
boczekbartek authored Sep 26, 2024
1 parent 3ca9866 commit 4cc7e7b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
32 changes: 18 additions & 14 deletions docs/create_robots_whoami.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,26 @@ Your robot's `whoami` package serves as a configuration package for the `rai_who

## Example (Franka Emika Panda arm)

1. Create a whoami package for Panda
1. Setup the repository using 1st and 2nd step from [Setup](../README.md#setup)

```
poetry run create_rai_ws --name panda --destination-directory src/examples
```
2. Create a whoami package for Panda

2. Fill in the `src/examples/panda_whoami/description` folder with data:\
```shell
poetry run create_rai_ws --name panda --destination-directory src/examples
```

3. Fill in the `src/examples/panda_whoami/description` folder with data:\
2.1 Save [this image](https://robodk.com/robot/img/Franka-Emika-Panda-robot.png) into `src/examples/panda_whoami/description/images`\
2.2 Save [this document](https://github.com/user-attachments/files/16417196/Franka.Emika.Panda.robot.-.RoboDK.pdf) in `src/examples/panda_whoami/description/documentation`

3. Run the `parse_whoami_package`. This will process the documentation, building it into a vector database, which is used by RAI agent to reason about its identity.
4. Run the `parse_whoami_package`. This will process the documentation, building it into a vector database, which is used by RAI agent to reason about its identity.

```
poetry run parse_whoami_package src/examples/panda_whoami/description src/examples/panda_whoami/description
> **NOTE**: By default the vector database is created using the OpenAI API. Parsing
> bigger documents might lead to costs. Embedding model can be configured in
> [config.toml](../config.toml) (`ollama` works locally, see [docs/vendors.md](./vendors.md#ollama)).
```shell
poetry run parse_whoami_package src/examples/panda_whoami/description
```

> [!IMPORTANT]
Expand All @@ -31,18 +37,16 @@ poetry run parse_whoami_package src/examples/panda_whoami/description src/exampl

You can test your new `panda_whoami` package by calling `rai_whoami` services:

2. Building and sourcing the install
2. Building the `rai_whoami` package and running the `rai_whoami_node` for your `Panda` robot:

```
colcon build
source install/setup.sh
export PYTHONPATH="$(dirname $(dirname $(poetry run which python)))/lib/python$(poetry run python --version | awk '{print $2}' | cut -d. -f1,2)/site-packages:$PYTHONPATH"
```shell
colcon build --symlink-install
ros2 run rai_whoami rai_whoami_node --ros-args -p robot_description_package:="panda_whoami"
```

2. Calling the rai_whoami services

```
```shell
ros2 service call /rai_whoami_identity_service std_srvs/srv/Trigger # ask for identity
ros2 service call /rai_whoami_selfimages_service std_srvs/srv/Trigger # ask for images folder
ros2 service call /rai_whoami_constitution_service std_srvs/srv/Trigger # ask for robot constitution
Expand Down
2 changes: 2 additions & 0 deletions docs/vendors.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Ollama

For installation see: https://ollama.com/

```python
from langchain_community.chat_models import ChatOllama

Expand Down

0 comments on commit 4cc7e7b

Please sign in to comment.