8000 feat: rai_sim by MagdalenaKotynia · Pull Request #415 · RobotecAI/rai · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: rai_sim #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 69 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
5a2333a
feat: benchmark class models
MagdalenaKotynia Feb 6, 2025
d3be95a
chore: naming changes
MagdalenaKotynia Feb 7, 2025
c4ca61a
chore: naming changes
MagdalenaKotynia Feb 7, 2025
f44f394
chore: redefine benchmark model
MagdalenaKotynia Feb 7, 2025
7c1b2a1
refactor: SceneConfig to BaseModel class
MagdalenaKotynia Feb 7, 2025
80112ce
feat: add SceneSetup to store initial scene setup
MagdalenaKotynia Feb 10, 2025
466b22d
build: poetry initialization of rai_benchmarks and rai_simulations
MagdalenaKotynia Feb 10, 2025
22fbb86
chore: add licence lines
MagdalenaKotynia Feb 10, 2025
d93509f
build: create packages from rai_benchmarks and rai_simulations
MagdalenaKotynia Feb 10, 2025
a81770e
chore: removed mistakenly added file
MagdalenaKotynia Feb 10, 2025
5a84d95
feat: scene config implementation
MagdalenaKotynia Feb 10, 2025
8ca1bf7
Add O3DEEngineConnector features
knicked Feb 11, 2025
e07f204
Remove an unused file
knicked Feb 11, 2025
86d0e6d
Add binary path caching
knicked Feb 11, 2025
fe854f5
Add two example scenes
knicked Feb 11, 2025
0737397
feat: replace binary path with ros2 launch command + binary path
MagdalenaKotynia Feb 11, 2025
3803dfc
refactor: renamed rai_sim and rai_bench
MagdalenaKotynia Feb 11, 2025
f9c4910
fix: fixed shutdown of binary
MagdalenaKotynia Feb 11, 2025
7f88240
chore: make pose mandatory
MagdalenaKotynia Feb 11, 2025
9238d12
chore: remove rai_bench because it is developed on another branch
MagdalenaKotynia Feb 11, 2025
8312b1a
ci: add missing license lines
MagdalenaKotynia Feb 11, 2025
4edfd87
fix: avoid force killing ros2 launch, add check if process has started
MagdalenaKotynia Feb 12, 2025
7d271c1
refactor: create PoseModel for storing pose from config, add methods …
MagdalenaKotynia Feb 13, 2025
cf50968
fix: retry service calls with timeout
MagdalenaKotynia Feb 13, 2025
7c2130d
fix: remove redundant version specification from init
MagdalenaKotynia Feb 13, 2025
11ec55d
license: changed date to 2025
MagdalenaKotynia Feb 13, 2025
38f19a1
refactor: moved conversion from ros2 Pose to PoseModel to utils
MagdalenaKotynia Feb 13, 2025
1d651ef
refactor: removed try except having no effect
MagdalenaKotynia Feb 13, 2025
cefaa89
refactor: renamed SceneConfig to SimulationConfig to better reflect i…
MagdalenaKotynia Feb 13, 2025
442836c
fix: renamed missed scene_config occurencies to simulation_config
MagdalenaKotynia Feb 13, 2025
616cc95
fix: renamed missed scene_config to simulation_config
MagdalenaKotynia Feb 13, 2025
cdc9a78
ci: pre-commit
MagdalenaKotynia Feb 13, 2025
85ca90c
refactor: SimulationConfig as base class storing configurable attribu…
MagdalenaKotynia Feb 14, 2025
d250f02
chore: remove print used for debugging
MagdalenaKotynia Feb 14, 2025
1376cc8
license: add missing license
MagdalenaKotynia Feb 14, 2025
1456900
refactor: use pathlib.Path instead of str type
MagdalenaKotynia Feb 14, 2025
70ad1c8
feat: add method to get current scene state, refactored spawned entit…
MagdalenaKotynia Feb 14, 2025
07fbd23
docs: precise the SceneState docs
MagdalenaKotynia Feb 14, 2025
5ca90c9
refactor: separated running binary from running robotic stack
MagdalenaKotynia Feb 17, 2025
c3d33a3
feat: add check if the entities names are unique
MagdalenaKotynia Feb 17, 2025
60f5f67
refactor: remove despawned entity from spawned_entities list directly
MagdalenaKotynia Feb 17, 2025
738eeff
refactor: ranamed O3DEngineCOnnector to O3DExROS2Connector and O3DESi…
MagdalenaKotynia Feb 17, 2025
3c7d17e
chore: minor code reorganization
MagdalenaKotynia Feb 17, 2025
b1e8ded
refactor: add file left after renaming classes
MagdalenaKotynia Feb 17, 2025
a76726c
chore: launch file cleanup
MagdalenaKotynia Feb 17, 2025
15d0050
refactor: renamed the EngineConnector to SimulationConnector
MagdalenaKotynia Feb 17, 2025
22d1cdf
refactor: renamed engine_connector file to simulation_connector
MagdalenaKotynia Feb 17, 2025
b64e3c6
docs: added README
MagdalenaKotynia Feb 17, 2025
f59e97e
docs: minor changes in docstrings
MagdalenaKotynia Feb 17, 2025
f81585f
refactor: removed CONFIG_REGISTRY to not force user to modify source …
MagdalenaKotynia Feb 17, 2025
f658a4f
fix: add service errors handling
MagdalenaKotynia Feb 18, 2025
c25ca5e
refactor: moved loading configs to configs classes as classmethods
MagdalenaKotynia Feb 18, 2025
c4e2cbb
refactor: removed unnecesary variable
MagdalenaKotynia Feb 18, 2025
f5ac61b
fix: removed None as valid argument for _has_process_started method
MagdalenaKotynia Feb 18, 2025
26a3b9f
fix: moved NOTEs outside docstrings
MagdalenaKotynia Feb 18, 2025
23edbdc
fix: added error logging for exception in try_service_call
MagdalenaKotynia Feb 18, 2025
f9134bc
fix: revert missed change done for testing errors handling
MagdalenaKotynia Feb 18, 2025
75336f9
refactor: moved conversion of ros2 pose to PoseModel to classmethod o…
MagdalenaKotynia Feb 18, 2025
63e11b2
fix: workaround for bug in get_available_spawnable_names service
MagdalenaKotynia Feb 18, 2025
6804a49
refactor: applied logging convention
MagdalenaKotynia Feb 18, 2025
114799c
chore: add link to PR fixing the bug with get_available_spawnable_nam…
MagdalenaKotynia Feb 18, 2025
c7ed70c
chore: replaced link to PR with other PR
MagdalenaKotynia Feb 18, 2025
d23f42c
refactor: renamed the SimulationConnector to SimulationBridge to not …
MagdalenaKotynia Feb 18, 2025
e94c362
fix: add not changed import during renaming
MagdalenaKotynia Feb 18, 2025
3652cdc
fix: remove redundant ros2_pose getting, modified raising error
MagdalenaKotynia Feb 19, 2025
6c1244a
refactor: moved ros2 related methods outside simulation_bridge.py to …
MagdalenaKotynia Feb 19, 2025
cb50d43
refactor: moved spawned_entities to base SimulationBridge
MagdalenaKotynia Feb 19, 2025
d4aa378
Fix tf listener in rai_sim module (#428)
pijaro Feb 20, 2025
6b07135
fix transform bug
jmatejcz Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions examples/manipulation-demo-no-binary.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright (C) 2025 Robotec.AI
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from launch import LaunchDescription
from launch.actions import (
IncludeLaunchDescription,
)
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare


# TODO (mkotynia) think about separation of launches
def generate_launch_description():
launch_moveit = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[
"src/examples/rai-manipulation-demo/Project/Examples/panda_moveit_config_demo.launch.py",
]
)
)

launch_robotic_manipulation = Node(
package="robotic_manipulation",
executable="robotic_manipulation",
# name="robotic_manipulation_node",
output="screen",
parameters=[
{"use_sim_time": True},
],
)

launch_openset = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[
FindPackageShare("rai_bringup"),
"/launch/openset.launch.py",
]
),
)

return LaunchDescription(
[
launch_openset,
launch_moveit,
launch_robotic_manipulation,
]
)
18 changes: 17 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ python = "^3.10, <3.13"
rai = {path = "src/rai_core", develop = true}
rai_asr = {path = "src/rai_asr", develop = true}
rai_tts = {path = "src/rai_tts", develop = true}
rai_sim = {path = "src/rai_sim", develop = true}

langchain-core = "^0.3"
langchain = "*"
Expand Down
8 changes: 4 additions & 4 deletions src/rai_core/rai/communication/ros2/connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(
self._topic_api = ROS2TopicAPI(self._node)
self._service_api = ROS2ServiceAPI(self._node)
self._actions_api = ROS2ActionAPI(self._node)
self._tf_buffer = Buffer(node=self._node)

self._executor = MultiThreadedExecutor()
self._executor.add_node(self._node)
Expand Down Expand Up @@ -179,16 +180,15 @@ def get_transform(
source_frame: str,
timeout_sec: float = 5.0,
) -> TransformStamped:
tf_buffer = Buffer(node=self._node)
tf_listener = TransformListener(tf_buffer, self._node)
tf_listener = TransformListener(self._tf_buffer, self._node)
transform_available = self.wait_for_transform(
tf_buffer, target_frame, source_frame, timeout_sec
self._tf_buffer, target_frame, source_frame, timeout_sec
)
if not transform_available:
raise LookupException(
f"Could not find transform from {source_frame} to {target_frame} in {timeout_sec} seconds"
)
transform: TransformStamped = tf_buffer.lookup_transform(
transform: TransformStamped = self._tf_buffer.lookup_transform(
target_frame,
source_frame,
rclpy.time.Time(),
Expand Down
17 changes: 17 additions & 0 deletions src/rai_sim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## RAI Sim

## Description

The RAI Sim is a package providing interface to implement connection with a specific simulation.

### Components

- `SimulationConnector` - An interface for connecting with a specific simulation. It manages scene setup, spawning, despawning objects, getting current state of the scene.

- `SimulationConfig` - base config class to specify the entities to be spawned. For each simulation connector there should be specified custom simulation config specifying additional parameters needed to run and connect with the simulation.

- `SceneState` - stores the current info about spawned entities

### Example implementation

- `O3DExROS2Connector` - An implementation of SimulationConnector for working with simulation based on O3DE and ROS2.
23 changes: 23 additions & 0 deletions src/rai_sim/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tool.poetry]
name = "rai-sim"
version = "0.0.1"
description = "Package to run simulations"
authors = ["Magdalena Kotynia <magdalena.kotynia@robotec.ai>", "Kacper Dąbrowski <kacper.dabrowski@robotec.ai>", "Jakub Matejczyk <jakub.matejczyk@robotec.ai>"]
readme = "README.md"
classifiers = [
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"License :: OSI Approved :: Apache Software License",
]
packages = [
{ include = "rai_sim", from = "." },
]

[tool.poetry.dependencies]
python = "^3.10, <3.13"
PyYAML = "*"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add version constraint for PyYAML dependency.

Using an unconstrained version (*) for dependencies can lead to compatibility issues when new versions are released. Consider adding a version constraint to ensure compatibility.

-PyYAML = "*"
+PyYAML = "^6.0.1"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
PyYAML = "*"
PyYAML = "^6.0.1"



[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
15 changes: 15 additions & 0 deletions src/rai_sim/rai_sim/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (C) 2025 Robotec.AI
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""RAI Simulations package."""
Loading
0