You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/create_robots_whoami.md
+40-38Lines changed: 40 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,66 +6,68 @@ To configure RAI for your robot, provide contents for your robot's so called `wh
6
6
7
7
Your robot's `whoami` package serves as a configuration package for the `rai_whoami` node.
8
8
9
-
> [!TIP]
10
-
> The Human-Machine Interface (HMI), both text and voice versions, relies heavily on the whoami package. It uses the robot's identity, constitution, and documentation to provide context-aware responses and ensure the robot behaves according to its defined characteristics.
11
-
12
9
## Configuration example - Franka Emika Panda arm
13
10
14
11
1. Setup the repository using 1st and 2nd step from [Setup](../README.md#setup)
15
12
16
-
2. Create a whoami package for Panda
17
-
18
-
```shell
19
-
./scripts/create_rai_ws.sh --name panda --destination-directory src/examples
20
-
```
13
+
2. Fill in the `src/examples/panda_whoami/description` folder with data:
21
14
22
-
3. Fill in the `src/examples/panda_whoami/description` folder with data:
15
+
2.1. Save [this image](https://robodk.com/robot/img/Franka-Emika-Panda-robot.png) into `panda/images`
23
16
24
-
3.1. Save [this image](https://robodk.com/robot/img/Franka-Emika-Panda-robot.png) into `src/examples/panda_whoami/description/images`
17
+
2.2. Save [this document](https://github.com/user-attachments/files/16417196/Franka.Emika.Panda.robot.-.RoboDK.pdf) in `panda/documentation`
25
18
26
-
3.2. Save [this document](https://github.com/user-attachments/files/16417196/Franka.Emika.Panda.robot.-.RoboDK.pdf) in `src/examples/panda_whoami/description/documentation`
19
+
2.3. Save [this urdf](https://github.com/frankaemika/franka_ros/blob/develop/franka_description/robots/panda/panda.urdf.xacro) in `panda/urdf`
27
20
28
-
3.3. Save [this urdf](https://github.com/frankaemika/franka_ros/blob/develop/franka_description/robots/panda/panda.urdf.xacro) in `src/examples/panda_whoami/description/urdf`
21
+
3. Build the embodiment info using `build_whoami.py`:
29
22
30
-
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.
After running the `parse_whoami_package` command, you can inspect the generated files in the `src/examples/panda_whoami/description/generated` directory. These files contain important information about your robot:
34
+
After running the build command, inspect the generated files in the `panda/generated` directory. The folder should contain a info.json file containing:
44
35
45
-
-`robot_identity.txt`: Contains a detailed description of the robot's identity, capabilities, and characteristics.
46
-
-`robot_description.urdf.txt`: Provides a summary of the robot's URDF (Unified Robot Description Format), describing its physical structure.
47
-
-`robot_constitution.txt`: Outlines the ethical guidelines and operational rules for the robot.
48
-
-`faiss_index`: A directory containing the vector store of the robot's documentation, used for efficient information retrieval.
36
+
-`rules`: List of rules
37
+
-`capabilities`: List of capabilities
38
+
-`behaviors`: List of behaviors
39
+
-`description`: Description of the robot
40
+
-`images`: Base64 encoded images
49
41
50
42
## Testing
51
43
52
-
You can test your new `panda_whoami`package by calling `rai_whoami` services:
44
+
You can test the generated package by using the RAI Whoami services:
53
45
54
-
1.Building the `rai_whoami` package and running the `rai_whoami_node` for your `Panda` robot:
46
+
1.Using the RAI Whoami services:
55
47
56
48
```shell
57
-
colcon build --symlink-install
58
-
ros2 run rai_whoami rai_whoami_node --ros-args -p robot_description_package:="panda_whoami"
49
+
# Get robot's identity
50
+
ros2 service call /rai_whoami_embodiment_info_service rai_interfaces/srv/EmbodimentInfo
51
+
52
+
# Query the vector database
53
+
ros2 service call /rai_whoami_documentation_service rai_interfaces/srv/VectorStoreRetrieval "query: 'maximum load'"
59
54
```
60
55
61
-
2. Calling the rai_whoami services
56
+
If your service calls succeed and you can access the embodiment info and vector database, your robot's whoami package has been properly initialized.
62
57
63
-
```shell
64
-
ros2 service call /rai_whoami_identity_service std_srvs/srv/Trigger # ask for identity
65
-
ros2 service call /rai_whoami_selfimages_service std_srvs/srv/Trigger # ask for images folder
66
-
ros2 service call /rai_whoami_constitution_service std_srvs/srv/Trigger # ask for robot constitution
67
-
ros2 service call /rai_whoami_urdf_service std_srvs/srv/Trigger # ask for urdf description
68
-
ros2 service call /rai_whoami_documentation_service rai_interfaces/srv/VectorStoreRetrieval "query: 'maximum load'"# ask for Panda's maximum load
69
-
```
58
+
2. Alternatively, you can use the RAI Whoami tools directly in your Python code:
59
+
60
+
```python
61
+
from rai_whoami import EmbodimentInfo
62
+
from rai_whoami.tools import QueryDatabaseTool
70
63
71
-
If your service calls succeed, your `panda_whoami` package has been properly initialized.
64
+
# Load embodiment info
65
+
info = EmbodimentInfo.from_directory("panda/generated")
0 commit comments