Robotics Environment Authoring Framework.
Project description
Robotics Environment Authoring Framework (REAF)
The Robotics Environment Authoring Framework (REAF) simplifies creating environments that adhere to the GDM Robotics Environment interface.
How to install
reaf can be installed from PyPI using pip:
pip install reaf
Directory Structure
Currently, the directory structure is designed as standalone subdirectories with a well-defined dependency graph.
reaf
├── core: Core libraries and interfaces for REAF.
├── testing: General tooling for testing REAF interfaces and environments.
├── common: Libraries with shared functionality across setups and platforms.
Design
REAF is a framework designed to simplify the creation of robotics environments. It adopts a layered architecture to promote modularity and reusability. The core components of a REAF environment are:
- Environment: The top-level interface for interacting with the environment, conforming to the GDM Robotics Environment interface. It handles stepping, resetting, and action/observation specs.
- Task Logic Layer (TLL): Responsible for defining the task itself, including reward calculation, termination conditions, features generation, and commands processing.
- Data Acquisition and Control Layer (DACL): Interfaces with the physical or simulated robotic setup, managing commands to actuators and retrieving measurements from sensors.
- Adapters: Bridge the gap between the abstract GDMR interfaces and the specific requirements of the TLL. These adapters translate agent actions into TLL commands and TLL features into agent observations.
- Reset and End of Episode Handlers: Support customized behavior during environment resets and episode termination.
Environment
The Environment class serves as the primary interface for interacting with the
robotic environment. It coordinates the interactions between the TLL and DACL,
manages the environment's state, and handles stepping through the environment.
Key functionalities include:
reset_with_options(): Resets the environment to a new initial state based on the provided options. This involves resetting the DACL, computing initial features and observations.step(): Advances the environment by one step. This method takes an agent action, processes it into commands, steps the DACL, computes features, reward, discount, termination conditions, and new observations, and returns aTimeStepobject containing this information.action_spec(): Returns the specification for valid agent actions. This is determined by theActionSpaceAdapter.timestep_spec(): Returns the specification for theTimeStepobjects returned bystep()andreset().- Logging: Facilitates adding and removing loggers to monitor internal operations.
Task Logic Layer (TLL)
The TLL defines the logic and rules governing the robotic task. It comprises several core components:
FeaturesProducer: Generates additional features based on existing features and measurements from the DACL. Each producer has aproduced_features_spec()defining the features it generates andrequired_features_keys()indicating the features it depends on.CommandsProcessor: Modifies commands before they are sent to the DACL. Processors can transform, filter, or augment commands. Theconsumed_commands_spec()describes the commands accepted by the processor, andproduced_commands_keys()defines the output commands.RewardProvider: Calculates the reward signal based on the current features. It exposes areward_spec()defining the structure of the reward.TerminationChecker: Determines whether the episode should terminate based on features and returns aTerminationResultindicating the type of termination.DiscountProvider: Computes the discount factor based on features and the termination state.FeaturesObserver: Passive components that observe features without modifying them. This is useful for logging or analysis.Logger: Records measurements, features, and commands during environment interactions. Methods likerecord_measurements(),record_features(), andrecord_commands_processing()are called at specific points in the environment's lifecycle.
The TLL also provides methods to:
compute_all_features(): Computes all features based on measurements from the DACL and the output ofFeaturesProducers.compute_final_commands(): Processes the policy's commands using theCommandsProcessors and outputs the DACL command.compute_reward(): Calculates the reward using theRewardProvider.check_for_termination(): Checks termination conditions usingTerminationCheckers.compute_discount(): Computes the discount using theDiscountProvider.validate_spec(): Verifies the consistency of the specs across the TLL and DACL.
Data Acquisition and Control Layer (DACL)
The DACL serves as the bridge between the REAF environment and the robotic hardware. It's responsible for sending commands to the robot and receiving measurements from sensors. The DACL is built around:
Device: Represents a single hardware component (e.g., robot arm, camera). It provides methods likeset_commands()andget_measurements()for interacting with the hardware.DeviceCoordinator: Manages a collection ofDeviceobjects, coordinating their actions and data exchange. It provides lifecycle management throughstart()andstop()methods and synchronization points throughbefore_set_commands()andbefore_get_measurements().
The DACL's key functions are:
begin_stepping(): Initializes the DACL and returns the initial measurements.step(): Sends commands to the devices, retrieves new measurements, and returns them.end_stepping(): Performs cleanup operations at the end of an episode.commands_spec(): Returns the specification for valid commands. The user is expected to pass the full command dictionary.measurements_spec(): Returns the specification for the measurements returned byget_measurements().
Adapters
REAF utilizes adapters to translate between the generic agent interface and the specific format required by the TLL.
ActionSpaceAdapter: Converts the agent's actions into a commands dictionary understood by the TLL.ObservationSpaceAdapter: Transforms the features generated by the TLL into observations suitable for the agent.
Reset and End of Episode Handler
EnvironmentReset: Defines the reset behavior of the environment, including ado_reset()method and a default reset configuration. The reset is a complex step and very hard to predict how this will be written. The intention is to leave complete control to the user so they can pass whatever object is needed to the reset without any restrictions. The user can use this to check that everything is working properly, reset the state of any features producers, etc...EndOfEpisodeHandler: Provides a callback function,on_end_of_episode_stepping(), that is invoked at the end of each episode after the last step. This is useful for logging, cleanup, or custom logic that needs to be executed when an episode ends.
Licence and Disclaimer
Copyright 2025 Google LLC
All software is licensed under the Apache License, Version 2.0 (Apache 2.0); you may not use this file except in compliance with the Apache 2.0 license. You may obtain a copy of the Apache 2.0 license at: https://www.apache.org/licenses/LICENSE-2.0
All other materials are licensed under the Creative Commons Attribution 4.0 International License (CC-BY). You may obtain a copy of the CC-BY license at: https://creativecommons.org/licenses/by/4.0/legalcode
Unless required by applicable law or agreed to in writing, all software and materials distributed here under the Apache 2.0 or CC-BY licenses are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the licenses for the specific language governing permissions and limitations under those licenses.
This is not an official Google product.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reaf-1.0.1.tar.gz.
File metadata
- Download URL: reaf-1.0.1.tar.gz
- Upload date:
- Size: 86.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57306dcb632f04abce8a087d30061626bbcbfd8c26bf78bc6e1a891c68eb47da
|
|
| MD5 |
6fa2188235e3c561fff49dcf52dbb4cb
|
|
| BLAKE2b-256 |
acc733e152acc9b93734576582b7380d0f2f8bd8951450752f02f9fb4618557f
|
File details
Details for the file reaf-1.0.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: reaf-1.0.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 422.2 kB
- Tags: CPython 3.14, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f0e7e9fa1724e7c9167c3f416bb2c88a0b92aa45b77adc0537e8240f36ae178
|
|
| MD5 |
254da0f3e65d6b5754c8735cc53c0096
|
|
| BLAKE2b-256 |
7a5fe51e6ed43201aff9c2b9daa663f0b386adece3c66f857a35f44f0aa9d354
|
File details
Details for the file reaf-1.0.1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: reaf-1.0.1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 401.6 kB
- Tags: CPython 3.14, manylinux: glibc 2.26+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5883d8b1d7076a56707ace7cb8e3719da43f029e642613e11d2e8098e685e898
|
|
| MD5 |
d55c9296f28478781c6d2148b04752e9
|
|
| BLAKE2b-256 |
37ca7b6d05ad8c7e5842e6671dbb55cb95208c543b32fbd74b63756e39d04725
|
File details
Details for the file reaf-1.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: reaf-1.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 422.0 kB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d63b179fae21ae3f2b3925ccfa0f3705d35589d83e3731a4865b870726830817
|
|
| MD5 |
f4a8c282a6df673cdae7f9afa877dab0
|
|
| BLAKE2b-256 |
1e0a43142830609a1271f6292407680218c09c6998c3a1042eeec9258950cf14
|
File details
Details for the file reaf-1.0.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: reaf-1.0.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 401.1 kB
- Tags: CPython 3.13, manylinux: glibc 2.26+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26e1faf5dbea4c95c7f18781194e41d0ea1832d30cbf42255dc0e74480935890
|
|
| MD5 |
e27c63f8d24bf14b4ed78201c1a0ba60
|
|
| BLAKE2b-256 |
facd3f32227ea1f2a3d975715cd4af2ea3c49680c276366d00e8342a498f289c
|
File details
Details for the file reaf-1.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: reaf-1.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 422.0 kB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ad72b820b36fa46751740f63e41f091f9d5ddf36bec3df5d34f1c0f676cffcc
|
|
| MD5 |
44dd8980b731299e30ea2a50484972f6
|
|
| BLAKE2b-256 |
52b753193feaf6eaf95827b5275cd29148b176f56a6c57397f635d4777c28435
|
File details
Details for the file reaf-1.0.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: reaf-1.0.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 401.1 kB
- Tags: CPython 3.12, manylinux: glibc 2.26+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfac63c3c4fd0315ef21df1bf67f9ab4c052c20d0f4ec2d887e8c3e833ca606d
|
|
| MD5 |
dfcaeb410ec65fd99d0c2892f100e97b
|
|
| BLAKE2b-256 |
1c5e61bdf361b799af096a9b6217a2fd0ed2b77ccef453304b2d6344d5f38d08
|
File details
Details for the file reaf-1.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: reaf-1.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 422.0 kB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6a86ef8e8f3143071c9129dfa24e4dd7f582c0a5aec12bd7314a1ff13ef61c3
|
|
| MD5 |
c1ac56a1271e5336769f9bc0e8dd343a
|
|
| BLAKE2b-256 |
5a776665b78635dde960f9c41a1a23ea331773657c370ce7db3b0dfe338562bc
|
File details
Details for the file reaf-1.0.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: reaf-1.0.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 401.5 kB
- Tags: CPython 3.11, manylinux: glibc 2.26+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42a53f91c816baa66df3f5c27ce2c1675bce552c684c483dbfc1b8d019263b09
|
|
| MD5 |
a4370b1dfeb8ed59944f36486fa57d30
|
|
| BLAKE2b-256 |
adc8102c177130207b0819cd65c8a85e4a7daedb6f3f3643cab7f23f52f3463b
|
File details
Details for the file reaf-1.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: reaf-1.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 420.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
650c4ed1af5343231da90d139887a386660581a7be77996d2e4230760820a775
|
|
| MD5 |
cf9b203d24c3b4ac92420dd2fc5e375b
|
|
| BLAKE2b-256 |
6222dfba0fb64fb689899b4e374f5870aad99a7dc2c50fc1dfe2648bf8495c68
|
File details
Details for the file reaf-1.0.1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: reaf-1.0.1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 401.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.26+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e7218410fff349abb27045ba9b89febadb0f3b0c6772d1ea779c96f43ff8fb3
|
|
| MD5 |
db62fed29f407e9a52bcd648276c1664
|
|
| BLAKE2b-256 |
1d94f3f579b67124cdb8cc51eaf2d20dffa8120a81d812a22e84cacd06ca178d
|