Skip to main content

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:

  1. 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.
  2. Task Logic Layer (TLL): Responsible for defining the task itself, including reward calculation, termination conditions, features generation, and commands processing.
  3. Data Acquisition and Control Layer (DACL): Interfaces with the physical or simulated robotic setup, managing commands to actuators and retrieving measurements from sensors.
  4. 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.
  5. 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 a TimeStep object containing this information.
  • action_spec(): Returns the specification for valid agent actions. This is determined by the ActionSpaceAdapter.
  • timestep_spec(): Returns the specification for the TimeStep objects returned by step() and reset().
  • 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 a produced_features_spec() defining the features it generates and required_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. The consumed_commands_spec() describes the commands accepted by the processor, and produced_commands_keys() defines the output commands.
  • RewardProvider: Calculates the reward signal based on the current features. It exposes a reward_spec() defining the structure of the reward.
  • TerminationChecker: Determines whether the episode should terminate based on features and returns a TerminationResult indicating 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 like record_measurements(), record_features(), and record_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 of FeaturesProducers.
  • compute_final_commands(): Processes the policy's commands using the CommandsProcessors and outputs the DACL command.
  • compute_reward(): Calculates the reward using the RewardProvider.
  • check_for_termination(): Checks termination conditions using TerminationCheckers.
  • compute_discount(): Computes the discount using the DiscountProvider.
  • 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 like set_commands() and get_measurements() for interacting with the hardware.
  • DeviceCoordinator: Manages a collection of Device objects, coordinating their actions and data exchange. It provides lifecycle management through start() and stop() methods and synchronization points through before_set_commands() and before_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 by get_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 a do_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reaf-1.0.1.tar.gz (86.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

reaf-1.0.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (422.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

reaf-1.0.1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (401.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

reaf-1.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (422.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

reaf-1.0.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (401.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

reaf-1.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (422.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

reaf-1.0.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (401.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

reaf-1.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (422.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

reaf-1.0.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (401.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

reaf-1.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (420.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

reaf-1.0.1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (401.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

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

Hashes for reaf-1.0.1.tar.gz
Algorithm Hash digest
SHA256 57306dcb632f04abce8a087d30061626bbcbfd8c26bf78bc6e1a891c68eb47da
MD5 6fa2188235e3c561fff49dcf52dbb4cb
BLAKE2b-256 acc733e152acc9b93734576582b7380d0f2f8bd8951450752f02f9fb4618557f

See more details on using hashes here.

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

File hashes

Hashes for reaf-1.0.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4f0e7e9fa1724e7c9167c3f416bb2c88a0b92aa45b77adc0537e8240f36ae178
MD5 254da0f3e65d6b5754c8735cc53c0096
BLAKE2b-256 7a5fe51e6ed43201aff9c2b9daa663f0b386adece3c66f857a35f44f0aa9d354

See more details on using hashes here.

File details

Details for the file reaf-1.0.1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for reaf-1.0.1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5883d8b1d7076a56707ace7cb8e3719da43f029e642613e11d2e8098e685e898
MD5 d55c9296f28478781c6d2148b04752e9
BLAKE2b-256 37ca7b6d05ad8c7e5842e6671dbb55cb95208c543b32fbd74b63756e39d04725

See more details on using hashes here.

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

File hashes

Hashes for reaf-1.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d63b179fae21ae3f2b3925ccfa0f3705d35589d83e3731a4865b870726830817
MD5 f4a8c282a6df673cdae7f9afa877dab0
BLAKE2b-256 1e0a43142830609a1271f6292407680218c09c6998c3a1042eeec9258950cf14

See more details on using hashes here.

File details

Details for the file reaf-1.0.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for reaf-1.0.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 26e1faf5dbea4c95c7f18781194e41d0ea1832d30cbf42255dc0e74480935890
MD5 e27c63f8d24bf14b4ed78201c1a0ba60
BLAKE2b-256 facd3f32227ea1f2a3d975715cd4af2ea3c49680c276366d00e8342a498f289c

See more details on using hashes here.

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

File hashes

Hashes for reaf-1.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8ad72b820b36fa46751740f63e41f091f9d5ddf36bec3df5d34f1c0f676cffcc
MD5 44dd8980b731299e30ea2a50484972f6
BLAKE2b-256 52b753193feaf6eaf95827b5275cd29148b176f56a6c57397f635d4777c28435

See more details on using hashes here.

File details

Details for the file reaf-1.0.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for reaf-1.0.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cfac63c3c4fd0315ef21df1bf67f9ab4c052c20d0f4ec2d887e8c3e833ca606d
MD5 dfcaeb410ec65fd99d0c2892f100e97b
BLAKE2b-256 1c5e61bdf361b799af096a9b6217a2fd0ed2b77ccef453304b2d6344d5f38d08

See more details on using hashes here.

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

File hashes

Hashes for reaf-1.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f6a86ef8e8f3143071c9129dfa24e4dd7f582c0a5aec12bd7314a1ff13ef61c3
MD5 c1ac56a1271e5336769f9bc0e8dd343a
BLAKE2b-256 5a776665b78635dde960f9c41a1a23ea331773657c370ce7db3b0dfe338562bc

See more details on using hashes here.

File details

Details for the file reaf-1.0.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for reaf-1.0.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 42a53f91c816baa66df3f5c27ce2c1675bce552c684c483dbfc1b8d019263b09
MD5 a4370b1dfeb8ed59944f36486fa57d30
BLAKE2b-256 adc8102c177130207b0819cd65c8a85e4a7daedb6f3f3643cab7f23f52f3463b

See more details on using hashes here.

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

File hashes

Hashes for reaf-1.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 650c4ed1af5343231da90d139887a386660581a7be77996d2e4230760820a775
MD5 cf9b203d24c3b4ac92420dd2fc5e375b
BLAKE2b-256 6222dfba0fb64fb689899b4e374f5870aad99a7dc2c50fc1dfe2648bf8495c68

See more details on using hashes here.

File details

Details for the file reaf-1.0.1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for reaf-1.0.1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1e7218410fff349abb27045ba9b89febadb0f3b0c6772d1ea779c96f43ff8fb3
MD5 db62fed29f407e9a52bcd648276c1664
BLAKE2b-256 1d94f3f579b67124cdb8cc51eaf2d20dffa8120a81d812a22e84cacd06ca178d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page