Skip to content

Commit

Permalink
docs improvements (#200)
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Dąbrowski <[email protected]>
Co-authored-by: Bartek Boczek <[email protected]>
  • Loading branch information
2 people authored and maciejmajek committed Sep 18, 2024
1 parent ddd2661 commit cfabdc4
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 196 deletions.
62 changes: 32 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ The RAI framework aims to:
- Include ROS 2-oriented tooling for agents.
- Support a comprehensive task/mission orchestrator.

# Table of Contents
## Table of Contents

- [Features](#features)
- [Quick Start](#quick-start)
- [Developer guide](./docs/developer_guide.md)
- [Usage examples (demos)](#planned-demos)
- [Further documentation](#further-documentation)
- [ROSCon 2024 Talk](#roscon-2024)
Expand All @@ -60,22 +59,19 @@ The RAI framework aims to:
- [ ] Additional tooling such as GroundingDino.
- [ ] UI for configuration to select features and tools relevant for your deployment.

# Quick Start

Currently, RAI supports Ubuntu 24.04 with ROS 2 Jazzy and Python 3.12.
The release will also support Ubuntu 22.04 with ROS 2 Humble (it should work or be close to working now).
## Setup

### 1. Setting up the workspace:

#### 1.1 Install poetry

Install poetry (1.8+) with the following line, or
Install poetry (1.8+) with the following line:

```bash
curl -sSL https://install.python-poetry.org | python3 -
```

by following the official [docs](https://python-poetry.org/docs/#installation)
Alternatively, you can opt to do so by following the [official docs](https://python-poetry.org/docs/#installation).

#### 1.2 Clone the repository:

Expand Down Expand Up @@ -107,7 +103,7 @@ source ./setup_shell.sh

### 3. Setting up vendors

RAI is fully vendor-agnostic, however the beta development work currently utilizes OpenAI models. Setting the `OPENAI_API_KEY` environment variable will yield the best results.
RAI is fully vendor-agnostic, however the beta development work currently utilizes OpenAI models.

#### OpenAI

Expand All @@ -117,66 +113,72 @@ If you do not have a key, see how to generate one [here](https://platform.openai
export OPENAI_API_KEY=""
```

#### Congratulations, your installation is now complete! Head to [Running example](./docs/developer_guide.md)

# Running RAI
It is best to put this command into your `~/.bashrc` file for convenience, so it is effective for each new console.

![rosbot-xl-example](./docs/imgs/rosbot-xl-example.gif)
Congratulations, your installation is now completed!

RAI is a sophisticated framework targeted at solving near general cases. As of now, we provide the following examples:
## Running RAI

1. Engage with your ROS 2 network through an intuitive Streamlit chat interface.
2. Explore the O3DE Husarion ROSbot XL demo and assign tasks via natural language.
![rosbot-xl-example](./docs/imgs/rosbot-xl-example.gif)

If you are more ambitious:
You can start by running the following examples:

- Create your own robot description package and unleash it with the rai_whoami node.
- Run Streamlit powered by your custom robot’s description package and effortlessly access your robot's documentation as well as identity and constitution.
- Implement additional tools via LangChain's @tool and use them in your chat.
1. Hello RAI: Interact directly with your ROS 2 environment through an intuitive Streamlit chat interface.
2. Explore the O3DE Husarion ROSbot XL demo and have your robot do tasks defined with natural language.

## 1. Chat Interface
### Hello RAI

Chat seamlessly with your setup, retrieve images from cameras, adjust parameters on the fly, and get comprehensive information about your topics.
Chat seamlessly with your ROS 2 environment, retrieve images from cameras, adjust parameters, and get information about your ROS interfaces.

```bash
streamlit run src/rai_hmi/rai_hmi/streamlit_hmi_node.py
```

Remember to run this command in a sourced shell.

## 2. O3DE Rosbot XL Demo
### O3DE Rosbot XL Demo

This demo provides a practical way to interact with and control a virtual Husarion ROSbot XL within a simulated environment.
Using natural language commands, you can assign tasks to the robot, allowing it to perform a variety of actions.

Given that this is a beta release, consider this demo as an opportunity to explore the framework's capabilities, provide feedback, and contribute.
Try different commands, see how the robot responds, and use this experience to understand the potential and limitations of the system.

Follow this guide: [husarion-rosbot-xl-demo](./docs/demos.md)
Follow this guide: [husarion-rosbot-xl-demo](docs/demos.md)

## What's next?

Once you know your way around RAI, try the following challenges, with the aid the [developer guide](developer_guide.md):

- Run RAI on your own robot and talk to it, asking questions about what is in its documentation (and others!).
- Implement additional tools and use them in your interaction.
- Try a complex, multi-step task for your robot, such as going to several points to perform observations!

Soon you will have an opportunity to work with new RAI demos across several domains.

## Planned demos
### Planned demos

| Application | Robot | Description | Link |
| ------------------------------------------ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- |
| Mission and obstacle reasoning in orchards | Autonomous tractor | In a beautiful scene of a virtual orchard, RAI goes beyond obstacle detection to analyze best course of action for a given unexpected situation. | [🌾 demo](https://github.com/RobotecAI/rai-agriculture-demo) |
| Manipulation tasks with natural language | Robot Arm (Franka Panda) | Complete flexible manipulation tasks thanks to RAI and OpenVLA | [🦾 demo](https://github.com/RobotecAI/rai-manipulation-demo) |
| Quadruped inspection demo | A robot dog (ANYbotics ANYmal) | Perform inspection in a warehouse environment, find and report anomalies | link TBD |

# Community
## Community

## RAI Q&A
### RAI Q&A

Please take a look at [Q&A](https://github.com/RobotecAI/rai/discussions/categories/q-a).

## Developer Resources
### Developer Resources

See our [Developer Guide](docs/developer_guide.md).

## Contributing
### Contributing

You are welcome to contribute to RAI! Please see our [Contribution Guide](CONTRIBUTING.md).

## RAI release and talk
### RAI release and talk

RAI will be released on **October 15th**, right before [ROSCon 2024](https://roscon.ros.org/2024/).
If you are going to the conference, come join us at RAI talk on October 23rd.
Expand Down
28 changes: 15 additions & 13 deletions docs/create_robots_whoami.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# robot_whoami
# Your robot identity in RAI

Certain parts of RAI rely on robot's whoami package. Your robot's whoami package serves as a configuration package for the rai_whoami node, which is responsible for the robot identity, self-understanding, ethical code, and documentation.
RAI Agent needs to understand what kind of robot it is running on.
This includes its looks, purpose, ethical code, equipment, capabilities and documentation.
To configure RAI for your robot, provide contents for your robot's so called `whoami` package.

## Creating robot's whoami (Franka Emika Panda)
Your robot's `whoami` package serves as a configuration package for the `rai_whoami` node.

1. Create a whoami package for panda
## Example (Franka Emika Panda arm)

1. Create a whoami package for Panda

```
poetry run create_rai_ws --name panda --destination-directory src/examples
```

2. Fill in the src/examples/panda_whoami/description folder with data:\
2. 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 to build vector database and reason out the identity
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.

```
poetry run parse_whoami_package src/examples/panda_whoami/description src/examples/panda_whoami/description
Expand All @@ -23,11 +27,11 @@ poetry run parse_whoami_package src/examples/panda_whoami/description src/exampl
> [!IMPORTANT]
> For now, this works only if you have OPENAI_API_KEY variable exported.
## Testing panda_whoami
## Testing

rai_whoami provides services for gathering information about current platform. Test the panda_whoami package by:
You can test your new `panda_whoami` package by calling `rai_whoami` services:

1. Building and sourcing the install
2. Building and sourcing the install

```
colcon build
Expand All @@ -42,9 +46,7 @@ ros2 run rai_whoami rai_whoami_node --ros-args -p robot_description_package:="pa
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
ros2 service call /rai_whoami_documentation_service rai_interfaces/srv/VectorStoreRetrieval "query: 'maximum load'" # ask for panda's maximum load
ros2 service call /rai_whoami_documentation_service rai_interfaces/srv/VectorStoreRetrieval "query: 'maximum load'" # ask for Panda's maximum load
```

## Voila

If rai_whoami responds to the service calls, panda_whoami package has been properly initialized.
If your service calls succeed, your `panda_whoami` package has been properly initialized.
95 changes: 10 additions & 85 deletions docs/demos.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,20 @@
# Demos

## Installation

In the root directory of the `rai` repo download repositories:

```bash
vcs import < demos.repos
```

## Husarion ROSBot XL demo

![Screenshot1](imgs/o3deSimulation.png)

### Using pre-bulit binary

1. Download the newest binary release (`release.zip` file) from [rai-rosbot-xl-demo -> releases](https://github.com/RobotecAI/rai-rosbot-xl-demo/releases)
2. Install required packages
RAI comes with a number of supported demos, which showcase different applications, but are by no means exhaustive.

```bash
sudo apt install ros-${ROS_DISTRO}-ackermann-msgs ros-${ROS_DISTRO}-gazebo-msgs ros-${ROS_DISTRO}-control-toolbox
```
![demos.png](imgs/demos.png)

3. Unpack the binary and run the simulation:

```bash
unzip release.zip
. /opt/ros/${ROS_DISTRO}/setup.bash
./release/RAIRosbotXLDemo.GameLauncher -bg_ConnectToAssetProcessor=0
```

4. Start navigation stack:
```bash
./src/examples/rai-rosbot-xl-demo/run-nav.sh
```

### Building the project yourself

If you would like to adapt the simulation to your needs, you can make changes using
[O3DE Editor](https://www.docs.o3de.org/docs/welcome-guide/) and build the project
yourself.
Please refer to [rai husarion rosbot xl demo][rai rosbot demo] for more details.

## Running RAI

You can set the task for the agent in the `examples/nav2_example_ros_actions.py` file.

1. Prepare the robot description.

```bash
colcon build --symlink-install --packages-select rosbot_xl_whoami

. install/setup.bash
```

2. Start `rai_whoami_node`
who_am_i node. It loads files from robot [description](https://github.com/RobotecAI/rai-rosbot-xl-demo/tree/development/src/rosbot_xl_whoami/description) folder to server robot identity.

```bash
source setup_shell.sh

ros2 run rai_whoami rai_whoami_node --ros-args -p robot_description_package:="rosbot_xl_whoami"
```

3. Start `rai_node`.

By looking at the example code in `src/examples/rosbot-xl-generic-node-demo.py` you can see that:
## Installation

- This node has no information about the robot besides what it can get from `rai_whoami_node`
- Topics can be whitelisted to only receive information about the robot
- Before every LLM decision, `rai_node` sends it's state to the LLM Agent. By default it contains ros interfaces (topics, services, actions) and rosout summary, but state can be extended. In the example we also adding the summary of the camera image.
In the root directory of the `rai` repo, run the following command to fetch demo repositories:

```bash
source setup_shell.sh

python examples/rosbot-xl-generic-node-demo.py
vcs import < demos.repos
```

4. Send the task to the node:

> **NOTE**: For now agent is capable of performing only 1 task at once.
```bash
# Using robots camera to describe environment
ros2 topic pub --once /task_addition_requests std_msgs/msg/String "data: 'Where are you now?'"

# Automatic integration with navigation stack
ros2 topic pub --once /task_addition_requests std_msgs/msg/String "data: 'Drive 1 meter forward'"
ros2 topic pub --once /task_addition_requests std_msgs/msg/String "data: 'Spin 90 degrees'"

# Knowledge composition to achieve more complicated tasks
ros2 topic pub --once /task_addition_requests std_msgs/msg/String "data: 'Drive forward if the path is clear, otherwise backward'"
```
Once you have all the demos pulled, see dedicated docs to proceed:

[rai rosbot demo]: https://github.com/RobotecAI/rai-rosbot-xl-demo
- [Husarion ROSBot XL in an apartment](demos/rosbot_xl.md)
- Coming soon - autonomous tractor in an orchard.
- Coming soon - inspection with ANYmal robot dog.
- Coming soon - manipulation tasks demo
Loading

0 comments on commit cfabdc4

Please sign in to comment.