build: migrate env_manager, rbs_gym, rbs_runtime to ament_python

Migrate `env_manager`, `rbs_gym`, and `rbs_runtime` from ament_cmake to ament_python.
Removed unnecessary files including .json and .yaml config files
This commit is contained in:
Ilya Uraev 2024-09-30 18:34:57 +03:00
parent e4e3e4e3af
commit 860f7d6566
40 changed files with 750 additions and 1239 deletions

View file

@ -1,36 +0,0 @@
cmake_minimum_required(VERSION 3.8)
project(rbs_runtime)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
ament_python_install_package(${PROJECT_NAME})
install(PROGRAMS
scripts/runtime.py
DESTINATION lib/${PROJECT_NAME}
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# comment the line when a copyright and license is added to all source files
set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# comment the line when this package is in a git repo and when
# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
ament_package()

View file

@ -1,139 +0,0 @@
robot:
name: rbs_arm
urdf_string: ""
spawn_position:
- 0.0
- 0.0
- 0.0
spawn_quat_xyzw:
- 0.0
- 0.0
- 0.0
- 1.0
joint_positioins:
- 0
- 0
- 0
- 0
- 0
- 0
with_gripper: true
gripper_jont_positions:
- 0
randomizer:
pose: false
spawn_volume:
- 1.0
- 1.0
- 0.0
joint_positions: false
joint_positions_std: 0.1
joint_positions_above_object_spawn: false
joint_positions_above_object_spawn_elevation: 0.2
joint_positions_above_object_spawn_xy_randomness: 0.2
terrain:
type: flat
spawn_position:
- 0
- 0
- 0
spawn_quat_xyzw:
- 0
- 0
- 0
- 1
size:
- 1.5
- 1.5
model_rollouts_num: 1
light:
type: sun
direction:
- 0.5
- -0.25
- -0.75
random_minmax_elevation:
- -0.15
- -0.65
color:
- 1.0
- 1.0
- 1.0
- 1.0
distance: 1000.0
visual: true
radius: 25.0
model_rollouts_num: 1
objects:
- name: bishop
type: ""
relative_to: world
position:
- 0.0
- 0.0
- 0.0
orientation:
- 1.0
- 0.0
- 0.0
- 0.0
static: false
randomize:
count: 0
random_pose: false
random_position: false
random_orientation: false
random_model: false
random_spawn_position_segments: []
random_spawn_position_update_workspace_centre: false
random_spawn_volume:
- 0.5
- 0.5
- 0.5
models_rollouts_num: 0
texture: []
camera:
- name: robot_camera
enable: true
type: rgbd_camera
relative_to: base_link
width: 128
height: 128
image_format: R8G8B8
update_rate: 10
horizontal_fov: 1.0471975511965976
vertical_fov: 1.0471975511965976
clip_color:
- 0.01
- 1000.0
clip_depth:
- 0.05
- 10.0
noise_mean: null
noise_stddev: null
publish_color: false
publish_depth: false
publish_points: false
spawn_position:
- 0
- 0
- 1
spawn_quat_xyzw:
- 0
- 0.70710678118
- 0
- 0.70710678118
random_pose_rollouts_num: 1
random_pose_mode: orbit
random_pose_orbit_distance: 1.0
random_pose_orbit_height_range:
- 0.1
- 0.7
random_pose_orbit_ignore_arc_behind_robot: 0.39269908169872414
random_pose_select_position_options: []
random_pose_focal_point_z_offset: 0.0
random_pose_rollout_counter: 0.0

View file

@ -100,7 +100,7 @@ def launch_setup(context, *args, **kwargs):
rbs_runtime = Node(
package="rbs_runtime",
executable="runtime.py",
executable="runtime",
parameters=[robot_description, {"use_sim_time": True}],
)

View file

@ -7,12 +7,12 @@
<maintainer email="ur.narmak@gmail.com">narmak</maintainer>
<license>Apache-2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>
<export>
<build_type>ament_cmake</build_type>
<build_type>ament_python</build_type>
</export>
</package>

View file

@ -22,8 +22,8 @@ DEFAULT_SCENE: SceneData = SceneData(
robot=RobotData(
name="rbs_arm",
with_gripper=True,
joint_positions=[0, 0, 0, 0, 0, 0, 0],
gripper_joint_positions=[0],
joint_positions=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
gripper_joint_positions=0.0,
),
objects=[MeshObjectData("bishop", position=(0.0, 1.0, 0.3))],
camera=[CameraData("robot_camera")],

View file

@ -1,17 +0,0 @@
from env_manager.models.configs import SceneData, RobotData, MeshObjectData, CameraData
from dataclasses import asdict
import json
scene: SceneData = SceneData(
robot=RobotData(
name="rbs_arm",
with_gripper=True,
joint_positions=[0, 0, 0, 0, 0, 0, 0],
gripper_joint_positions=[0],
),
objects=[MeshObjectData("bishop", position=(0.0, 1.0, 0.3))],
camera=[CameraData("robot_camera")],
)
with open("scene_config.json", "w") as file:
json.dump(asdict(scene), file)

View file

@ -0,0 +1,4 @@
[develop]
script_dir=$base/lib/rbs_runtime
[install]
install_scripts=$base/lib/rbs_runtime

View file

@ -0,0 +1,32 @@
import os
from glob import glob
from setuptools import find_packages, setup
package_name = "rbs_runtime"
setup(
name=package_name,
version="0.0.0",
packages=find_packages(exclude=["test"]),
data_files=[
("share/ament_index/resource_index/packages", ["resource/" + package_name]),
("share/" + package_name, ["package.xml"]),
(
os.path.join("share", package_name, "launch"),
glob(os.path.join("launch", "*launch.[pxy][yma]*")),
),
],
install_requires=["setuptools"],
zip_safe=True,
maintainer="narmak",
maintainer_email="ur.narmak@gmail.com",
description="TODO: Package description",
license="Apache-2.0",
tests_require=["pytest"],
entry_points={
"console_scripts": [
"runtime = rbs_runtime.scripts.runtime:main",
],
},
)

View file

@ -0,0 +1,25 @@
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# 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 ament_copyright.main import main
import pytest
# Remove the `skip` decorator once the source file(s) have a copyright header
@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.')
@pytest.mark.copyright
@pytest.mark.linter
def test_copyright():
rc = main(argv=['.', 'test'])
assert rc == 0, 'Found errors'

View file

@ -0,0 +1,25 @@
# Copyright 2017 Open Source Robotics Foundation, Inc.
#
# 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 ament_flake8.main import main_with_errors
import pytest
@pytest.mark.flake8
@pytest.mark.linter
def test_flake8():
rc, errors = main_with_errors(argv=[])
assert rc == 0, \
'Found %d code style errors / warnings:\n' % len(errors) + \
'\n'.join(errors)

View file

@ -0,0 +1,23 @@
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# 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 ament_pep257.main import main
import pytest
@pytest.mark.linter
@pytest.mark.pep257
def test_pep257():
rc = main(argv=['.', 'test'])
assert rc == 0, 'Found code style errors / warnings'