├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── NOTICE
├── README.md
├── deepsim
├── CMakeLists.txt
├── LICENSE.txt
├── MANIFEST.in
├── README.md
├── VERSION
├── deepsim
│ ├── __init__.py
│ ├── behaviours
│ │ ├── __init__.py
│ │ ├── behaviour_manager.py
│ │ ├── deepsim_behaviour.py
│ │ └── transform.py
│ ├── cameras
│ │ ├── __init__.py
│ │ ├── abs_camera.py
│ │ └── constants.py
│ ├── colliders
│ │ ├── __init__.py
│ │ ├── abs_collider.py
│ │ ├── box2d_collider.py
│ │ ├── box_collider.py
│ │ ├── circle2d_collider.py
│ │ ├── geometry2d_collider.py
│ │ ├── hit.py
│ │ ├── ray_castable.py
│ │ └── sphere_collider.py
│ ├── constants.py
│ ├── core
│ │ ├── __init__.py
│ │ ├── color.py
│ │ ├── euler.py
│ │ ├── frustum.py
│ │ ├── link_state.py
│ │ ├── material.py
│ │ ├── math.py
│ │ ├── model_state.py
│ │ ├── plane.py
│ │ ├── point.py
│ │ ├── pose.py
│ │ ├── quaternion.py
│ │ ├── ray.py
│ │ ├── twist.py
│ │ ├── vector3.py
│ │ └── visual.py
│ ├── deepsim.py
│ ├── domain_randomizations
│ │ ├── __init__.py
│ │ ├── abs_randomizer.py
│ │ ├── constants.py
│ │ ├── randomizer_manager.py
│ │ └── randomizers
│ │ │ ├── __init__.py
│ │ │ ├── light_randomizer.py
│ │ │ └── model_visual_randomizer.py
│ ├── exception.py
│ ├── gazebo
│ │ ├── __init__.py
│ │ └── constants.py
│ ├── ros
│ │ ├── __init__.py
│ │ ├── ros_util.py
│ │ └── service_proxy_wrapper.py
│ ├── sim_trackers
│ │ ├── __init__.py
│ │ ├── constants.py
│ │ ├── tracker.py
│ │ ├── tracker_manager.py
│ │ └── trackers
│ │ │ ├── __init__.py
│ │ │ ├── get_link_state_tracker.py
│ │ │ ├── get_model_state_tracker.py
│ │ │ ├── get_visual_tracker.py
│ │ │ ├── set_link_state_tracker.py
│ │ │ ├── set_model_state_tracker.py
│ │ │ ├── set_visual_material_tracker.py
│ │ │ ├── set_visual_transparency_tracker.py
│ │ │ └── set_visual_visible_tracker.py
│ ├── spawners
│ │ ├── __init__.py
│ │ ├── abs_model_spawner.py
│ │ ├── dummy_spawner.py
│ │ ├── gazebo_model_spawner.py
│ │ └── gazebo_xml_loader.py
│ └── visual_effects
│ │ ├── __init__.py
│ │ ├── abs_effect.py
│ │ ├── effect_manager.py
│ │ └── effects
│ │ ├── __init__.py
│ │ ├── blink_effect.py
│ │ └── invisible_effect.py
├── package.xml
├── pytest.ini
├── pytest.launch
├── pytest_runner.py
├── setup.cfg
├── setup.py
└── test
│ ├── test_deepsim
│ ├── __init__.py
│ ├── behaviours
│ │ ├── __init__.py
│ │ ├── test_behaviour_manager.py
│ │ ├── test_deepsim_behaviour.py
│ │ └── test_transform.py
│ ├── cameras
│ │ ├── __init__.py
│ │ └── test_abs_camera.py
│ ├── colliders
│ │ ├── __init__.py
│ │ ├── test_abs_2d_collider.py
│ │ ├── test_abs_3d_collider.py
│ │ ├── test_abs_collider.py
│ │ ├── test_box2d_collider.py
│ │ ├── test_box_collider.py
│ │ ├── test_circle2d_collider.py
│ │ ├── test_geometry2d_collider.py
│ │ ├── test_hit.py
│ │ └── test_sphere_collider.py
│ ├── core
│ │ ├── test_color.py
│ │ ├── test_euler.py
│ │ ├── test_frustum.py
│ │ ├── test_link_state.py
│ │ ├── test_material.py
│ │ ├── test_math.py
│ │ ├── test_model_state.py
│ │ ├── test_plane.py
│ │ ├── test_point.py
│ │ ├── test_pose.py
│ │ ├── test_quaternion.py
│ │ ├── test_ray.py
│ │ ├── test_twist.py
│ │ ├── test_vector3.py
│ │ └── test_visual.py
│ ├── domain_randomizations
│ │ ├── __init__.py
│ │ ├── randomizers
│ │ │ ├── __init__.py
│ │ │ ├── test_light_randomizer.py
│ │ │ └── test_model_visual_randomizer.py
│ │ ├── test_abs_randomizer.py
│ │ └── test_randomizer_manager.py
│ ├── ros
│ │ ├── __init__.py
│ │ ├── test_ros_util.py
│ │ └── test_service_proxy_wrapper.py
│ ├── sim_trackers
│ │ ├── __init__.py
│ │ ├── test_tracker.py
│ │ ├── test_tracker_manager.py
│ │ └── trackers
│ │ │ ├── __init__.py
│ │ │ ├── test_get_link_state_tracker.py
│ │ │ ├── test_get_model_state_tracker.py
│ │ │ ├── test_get_visual_tracker.py
│ │ │ ├── test_set_link_state_tracker.py
│ │ │ ├── test_set_model_state_tracker.py
│ │ │ ├── test_set_visual_material_tracker.py
│ │ │ ├── test_set_visual_transparency_tracker.py
│ │ │ └── test_set_visual_visible_tracker.py
│ ├── spawners
│ │ ├── __init__.py
│ │ ├── test_abs_model_spawner.py
│ │ ├── test_dummy_spawner.py
│ │ ├── test_gazebo_model.py
│ │ └── test_gazebo_xml_loader.py
│ ├── test_deepsim.py
│ └── visual_effects
│ │ ├── __init__.py
│ │ ├── effects
│ │ ├── __init__.py
│ │ ├── test_blink_effect.py
│ │ └── test_invisible_effect.py
│ │ ├── test_abs_effect.py
│ │ └── test_effect_manager.py
│ └── test_deepsim_import.py
├── deepsim_btree
├── CMakeLists.txt
├── LICENSE.txt
├── MANIFEST.in
├── README.md
├── VERSION
├── deepsim_btree
│ ├── __init__.py
│ ├── behaviour.py
│ ├── composites
│ │ ├── __init__.py
│ │ ├── composite.py
│ │ ├── parallel_selector.py
│ │ ├── parallel_sequence.py
│ │ ├── rand_selector.py
│ │ ├── rand_sequence.py
│ │ ├── selector.py
│ │ └── sequence.py
│ ├── constants.py
│ ├── decorators
│ │ ├── __init__.py
│ │ ├── condition.py
│ │ ├── decorator.py
│ │ ├── limit.py
│ │ ├── repeater.py
│ │ └── status_flippers.py
│ ├── leaves.py
│ └── py.typed
├── package.xml
├── pytest.ini
├── pytest.launch
├── pytest_runner.py
├── setup.cfg
├── setup.py
└── test
│ ├── test_deepsim_btree
│ ├── __init__.py
│ ├── composites
│ │ ├── __init__.py
│ │ ├── test_composite.py
│ │ ├── test_parallel_selector.py
│ │ ├── test_parallel_sequence.py
│ │ ├── test_rand_selector.py
│ │ ├── test_rand_sequence.py
│ │ ├── test_selector.py
│ │ └── test_sequence.py
│ ├── decorators
│ │ ├── __init__.py
│ │ ├── test_condition.py
│ │ ├── test_decorator.py
│ │ ├── test_limit.py
│ │ ├── test_repeater.py
│ │ └── test_status_flippers.py
│ ├── test_behaviour.py
│ └── test_leaves.py
│ └── test_deepsim_btree_import.py
├── deepsim_envs
├── CMakeLists.txt
├── LICENSE.txt
├── MANIFEST.in
├── README.md
├── VERSION
├── deepsim_envs
│ ├── __init__.py
│ ├── agents
│ │ ├── __init__.py
│ │ └── abs_agent.py
│ └── envs
│ │ ├── __init__.py
│ │ ├── area_interface.py
│ │ └── environment.py
├── package.xml
├── pytest.ini
├── pytest.launch
├── pytest_runner.py
├── setup.cfg
├── setup.py
└── test
│ ├── agents
│ ├── __init__.py
│ └── test_abs_agent.py
│ ├── envs
│ ├── __init__.py
│ └── test_environment.py
│ └── test_deepsim_envs_import.py
├── deepsim_gazebo_plugin
├── CMakeLists.txt
├── README.md
├── include
│ └── deepsim_gazebo_plugin
│ │ ├── converters
│ │ ├── geometry_converter.hpp
│ │ └── visual_converter.hpp
│ │ ├── deepsim_gazebo_state.hpp
│ │ ├── deepsim_gazebo_state_services.hpp
│ │ ├── deepsim_gazebo_system_plugin.hpp
│ │ ├── deepsim_gazebo_visual_publisher.hpp
│ │ ├── deepsim_gazebo_visual_services.hpp
│ │ └── deepsim_gazebo_world_services.hpp
├── launch
│ └── example_world.launch
├── models
│ ├── .DS_Store
│ ├── box
│ │ ├── model.config
│ │ └── model.sdf
│ └── cylinder
│ │ ├── model.config
│ │ └── model.sdf
├── package.xml
├── src
│ ├── converters
│ │ ├── geometry_converter.cpp
│ │ └── visual_converter.cpp
│ ├── deepsim_gazebo_state.cpp
│ ├── deepsim_gazebo_state_services.cpp
│ ├── deepsim_gazebo_system_plugin.cpp
│ ├── deepsim_gazebo_visual_publisher.cpp
│ ├── deepsim_gazebo_visual_services.cpp
│ └── deepsim_gazebo_world_services.cpp
└── worlds
│ └── example_box.world
└── deepsim_msgs
├── CMakeLists.txt
├── README.md
├── msg
├── Visual.msg
└── Visuals.msg
├── package.xml
└── srv
├── GetAllLinkStates.srv
├── GetAllModelStates.srv
├── GetAllVisuals.srv
├── GetLightNames.srv
├── GetLinkStates.srv
├── GetModelStates.srv
├── GetVisual.srv
├── GetVisualNames.srv
├── GetVisuals.srv
├── SetLinkStates.srv
├── SetModelStates.srv
├── SetVisualMaterial.srv
├── SetVisualMaterials.srv
├── SetVisualTransparencies.srv
├── SetVisualTransparency.srv
├── SetVisualVisible.srv
└── SetVisualVisibles.srv
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | *#
3 | *.swp
4 |
5 | *.DS_Store
6 | *.iml
7 |
8 | __pycache__/
9 | *.py[cod]
10 | *$py.class
11 | *.egg-info/
12 | *dist/
13 | *build/
14 |
15 | /.coverage
16 | /.coverage.*
17 | /.cache
18 | /.pytest_cache
19 | /.mypy_cache
20 |
21 | /build
22 | /dist
23 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | ## Code of Conduct
2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4 | opensource-codeofconduct@amazon.com with any additional questions or comments.
5 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing Guidelines
2 |
3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
4 | documentation, we greatly value feedback and contributions from our community.
5 |
6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
7 | information to effectively respond to your bug report or contribution.
8 |
9 |
10 | ## Reporting Bugs/Feature Requests
11 |
12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features.
13 |
14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
16 |
17 | * A reproducible test case or series of steps
18 | * The version of our code being used
19 | * Any modifications you've made relevant to the bug
20 | * Anything unusual about your environment or deployment
21 |
22 |
23 | ## Contributing via Pull Requests
24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
25 |
26 | 1. You are working against the latest source on the *main* branch.
27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
29 |
30 | To send us a pull request, please:
31 |
32 | 1. Fork the repository.
33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
34 | 3. Ensure local tests pass.
35 | 4. Commit to your fork using clear commit messages.
36 | 5. Send us a pull request, answering any default questions in the pull request interface.
37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
38 |
39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
41 |
42 |
43 | ## Finding contributions to work on
44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
45 |
46 |
47 | ## Code of Conduct
48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
50 | opensource-codeofconduct@amazon.com with any additional questions or comments.
51 |
52 |
53 | ## Security issue notifications
54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
55 |
56 |
57 | ## Licensing
58 |
59 | See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
60 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## We have made a difficult decision of ceasing active development on this repo as of Jul 2022.
2 |
3 | ## DeepSim Toolkit
4 |
5 | DeepSim Toolkit is an open-source reinforcement learning environment build toolkit for ROS and Gazebo. It provides the building blocks of extensive advanced features such as collision detection, behavior controls, domain randomization, spawner, and many more to build complex and challenging custom reinforcement learning environment in ROS and Gazebo simulation environment with Python language.
6 |
7 | ## Citation
8 |
9 | DeepSim whitepaper is available at https://arxiv.org/abs/2205.08034.
10 | If you reference or use DeepSim in your research, please cite:
11 |
12 | ```
13 | @misc{la2022deepsim,
14 | title={DeepSim: A Reinforcement Learning Environment Build Toolkit for ROS and Gazebo},
15 | author={Woong Gyu La and Lingjie Kong and Sunil Muralidhara and Pratik Nichat},
16 | year={2022},
17 | eprint={2205.08034},
18 | archivePrefix={arXiv},
19 | primaryClass={cs.LG}
20 | }
21 | ```
22 |
23 | ## License
24 |
25 | The source code is released under [Apache 2.0](https://aws.amazon.com/apache-2-0/).
26 |
--------------------------------------------------------------------------------
/deepsim/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.7.2)
2 | project(deepsim)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | rospy
6 | std_msgs
7 | geometry_msgs
8 | rosgraph_msgs
9 | gazebo_msgs
10 | deepsim_msgs
11 | )
12 |
13 | catkin_python_setup()
14 |
15 | catkin_package(
16 | CATKIN_DEPENDS
17 | rospy
18 | std_msgs
19 | geometry_msgs
20 | rosgraph_msgs
21 | gazebo_msgs
22 | deepsim_msgs
23 | )
24 |
25 | ## Tests
26 |
27 | if(CATKIN_ENABLE_TESTING)
28 | find_package(rostest REQUIRED)
29 | add_rostest(pytest.launch)
30 | endif()
31 |
--------------------------------------------------------------------------------
/deepsim/MANIFEST.in:
--------------------------------------------------------------------------------
1 |
2 | include VERSION
3 | include LICENSE.txt
4 | include README.md
--------------------------------------------------------------------------------
/deepsim/README.md:
--------------------------------------------------------------------------------
1 | ## DeepSim Gazebo Framework
2 |
3 | The DeepSim Gazebo Framework package is a part of DeepSim Toolkit that provides buildinig blocks to create a RL environment in ROS-Gazebo platform.
4 |
5 | ## Citation
6 |
7 | DeepSim whitepaper is available at https://arxiv.org/abs/2205.08034.
8 | If you reference or use DeepSim in your research, please cite:
9 |
10 | ```
11 | @misc{la2022deepsim,
12 | title={DeepSim: A Reinforcement Learning Environment Build Toolkit for ROS and Gazebo},
13 | author={Woong Gyu La and Lingjie Kong and Sunil Muralidhara and Pratik Nichat},
14 | year={2022},
15 | eprint={2205.08034},
16 | archivePrefix={arXiv},
17 | primaryClass={cs.LG}
18 | }
19 | ```
20 |
21 | ## License
22 |
23 | The source code is released under [Apache 2.0](https://aws.amazon.com/apache-2-0/).
24 |
25 | ## Resources
26 | * [DeepSim Gazebo Plugin](https://github.com/aws-deepracer/deepsim/tree/main/deepsim_gazebo_plugin)
27 | * [DeepSim Messages](https://github.com/aws-deepracer/deepsim/tree/main/deepsim_msgs)
28 | * [Unified Distributed Environment](https://github.com/aws-deepracer/ude)
29 |
--------------------------------------------------------------------------------
/deepsim/VERSION:
--------------------------------------------------------------------------------
1 | 0.1.0
--------------------------------------------------------------------------------
/deepsim/deepsim/behaviours/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/cameras/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/cameras/constants.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """Module to contain DeepSim camera related constants"""
17 | from enum import Enum, unique
18 |
19 |
20 | @unique
21 | class CameraSettings(Enum):
22 | """This enum is used to index into the camera settings list"""
23 | HORZ_FOV = 1
24 | PADDING_PCT = 2
25 | IMG_WIDTH = 3
26 | IMG_HEIGHT = 4
27 |
28 | @classmethod
29 | def get_empty_dict(cls) -> dict:
30 | """Returns dictionary with the enum as key values and None's as the values, clients
31 | are responsible for populating the dict accordingly
32 | """
33 | empty_dict = dict()
34 | for val in cls._value2member_map_.values():
35 | empty_dict[val] = None
36 | return empty_dict
37 |
--------------------------------------------------------------------------------
/deepsim/deepsim/colliders/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/colliders/ray_castable.py:
--------------------------------------------------------------------------------
1 | import abc
2 | from typing import Union
3 |
4 | from deepsim.colliders.hit import Hit
5 | from deepsim.core.ray import Ray
6 |
7 |
8 | # Python 2 and 3 compatible Abstract class
9 | ABC = abc.ABCMeta('ABC', (object,), {})
10 |
11 |
12 | class RayCastable(ABC):
13 | """
14 | Ray Castable interface.
15 | """
16 | @abc.abstractmethod
17 | def raycast(self, ray: Ray) -> Union[Hit, None]:
18 | """
19 | Returns the distance along the ray, where it intersects the ray-castable object.
20 | - If there is no intersection then returns None.
21 |
22 | Args:
23 | ray (Ray): ray to test intersection.
24 |
25 | Returns:
26 | Union[Hit, None]: Hit object if intersects. Otherwise, None.
27 | """
28 | raise NotImplementedError("Subclass must implement raycast!")
29 |
--------------------------------------------------------------------------------
/deepsim/deepsim/constants.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """Module to contain DeepSim related constants"""
17 |
18 |
19 | class Tag(object):
20 | """
21 | Tag Enumerator
22 | """
23 | AGENT = "agent"
24 | CAMERA = "camera"
25 |
--------------------------------------------------------------------------------
/deepsim/deepsim/core/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/domain_randomizations/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/domain_randomizations/abs_randomizer.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """A class for abstract randomizer."""
17 | import abc
18 |
19 | # Python 2 and 3 compatible Abstract class
20 | ABC = abc.ABCMeta('ABC', (object,), {})
21 |
22 |
23 | class AbstractRandomizer(ABC):
24 | """
25 | Abstract Randomizer class
26 | """
27 | def __init__(self):
28 | pass
29 |
30 | def randomize(self) -> None:
31 | """
32 | Randomize
33 | """
34 | self._randomize()
35 |
36 | @abc.abstractmethod
37 | def _randomize(self) -> None:
38 | """
39 | Actual randomize function
40 | """
41 | raise NotImplementedError('Randomizer must implement this function')
42 |
--------------------------------------------------------------------------------
/deepsim/deepsim/domain_randomizations/constants.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """Module to contain domain randomization related constants"""
17 | from enum import Enum
18 |
19 |
20 | class ModelRandomizerType(Enum):
21 | """ Model Randomizer Type
22 |
23 | MODEL type will randomize the color of overall model.
24 | LINK type will randomize the color for each link.
25 | VISUAL type will randomize the color for each link's visual
26 | """
27 | MODEL = "model"
28 | LINK = "link"
29 | VISUAL = "visual"
30 |
31 |
32 | class RangeType(Enum):
33 | """Range Type"""
34 | COLOR = 'color'
35 | ATTENUATION = 'attenuation'
36 |
37 |
38 | RANGE_MIN = 'min'
39 | RANGE_MAX = 'max'
40 |
41 |
42 | class ColorAttr(object):
43 | """Color attributes"""
44 | R = 'r'
45 | G = 'g'
46 | B = 'b'
47 |
48 |
49 | class Attenuation(object):
50 | """Light attenuation attributes"""
51 | CONSTANT = 'constant'
52 | LINEAR = 'linear'
53 | QUADRATIC = 'quadratic'
54 |
--------------------------------------------------------------------------------
/deepsim/deepsim/domain_randomizations/randomizers/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/exception.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """Classes for exceptions."""
17 |
18 |
19 | class DeepSimException(Exception):
20 | """
21 | UDEException class
22 | """
23 | def __init__(self, message="", error_code=500):
24 | """
25 | Initialize UDEException
26 |
27 | Args:
28 | message (str): message
29 | error_code (int): error code
30 | """
31 | self.error_code = error_code
32 | self.message = message
33 | super().__init__(self.message)
34 |
35 | def __str__(self):
36 | return "{} ({})".format(self.message, self.error_code)
37 |
38 |
39 | class DeepSimError(DeepSimException):
40 | """
41 | DeepSimError class
42 | """
43 | def __init__(self, message="", error_code=400):
44 | """
45 | Initialize DeepSimError
46 |
47 | Args:
48 | message (str): message
49 | error_code (int): error code
50 | """
51 | super().__init__(error_code=error_code,
52 | message=message)
53 |
54 |
55 | class DeepSimCallbackError(DeepSimException):
56 | """
57 | DeepSimCallbackError class
58 | """
59 | def __init__(self, message="", error_code=400):
60 | """
61 | Initialize DeepSimCallbackError
62 |
63 | Args:
64 | message (str): message
65 | error_code (int): error code
66 | """
67 | super().__init__(error_code=error_code,
68 | message=message)
69 |
--------------------------------------------------------------------------------
/deepsim/deepsim/gazebo/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/ros/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/sim_trackers/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/sim_trackers/constants.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """Module to contain simulation tracker related constants"""
17 | from enum import Enum
18 |
19 |
20 | class TrackerPriority(Enum):
21 | """Tracker Priority"""
22 | HIGH = 1
23 | NORMAL = 2
24 | LOW = 3
25 |
--------------------------------------------------------------------------------
/deepsim/deepsim/sim_trackers/tracker.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """A class for tracker interface."""
17 | import abc
18 |
19 | from rosgraph_msgs.msg import Clock
20 |
21 |
22 | # Python 2 and 3 compatible Abstract class
23 | ABC = abc.ABCMeta('ABC', (object,), {})
24 |
25 |
26 | class TrackerInterface(ABC):
27 | """
28 | Tracker class interface
29 | """
30 | @abc.abstractmethod
31 | def on_update_tracker(self, delta_time: float, sim_time: Clock) -> None:
32 | """
33 | Update Tracker
34 |
35 | Args:
36 | delta_time (float): delta time
37 | sim_time (Clock): simulation time
38 | """
39 | raise NotImplementedError('Tracker must be able to update')
40 |
--------------------------------------------------------------------------------
/deepsim/deepsim/sim_trackers/trackers/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/spawners/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/spawners/dummy_spawner.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """A class for dummy spawner."""
17 | from typing import Optional
18 |
19 | from deepsim.spawners.abs_model_spawner import AbstractModelSpawner
20 | from deepsim.core.pose import Pose
21 |
22 |
23 | class DummySpawner(AbstractModelSpawner):
24 | """
25 | Dummy Spawner class to handle dummy model spawn and delete
26 | """
27 | def __init__(self):
28 | """
29 | Constructor for DummySpawner
30 | """
31 | super().__init__(should_validate_spawn=False,
32 | should_validate_delete=False)
33 |
34 | def _spawn(self, model_name: str, pose: Optional[Pose] = None, **kwargs) -> None:
35 | """
36 | Spawn dummy model in gazebo simulator
37 |
38 | Args:
39 | model_name (str): name of the model.
40 | pose (Optional[Pose]): model pose
41 | **kwargs: Arbitrary keyword arguments
42 | """
43 | pass
44 |
45 | def _delete(self, model_name: str, **kwargs) -> None:
46 | """
47 | Delete the non-existing dummy model
48 |
49 | Args:
50 | model_name (str): name of the model.
51 | **kwargs: Arbitrary keyword arguments
52 | """
53 | pass
54 |
--------------------------------------------------------------------------------
/deepsim/deepsim/spawners/gazebo_xml_loader.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """A class for Gazebo XML loader."""
17 | import os
18 | import xacro
19 |
20 |
21 | class GazeboXmlLoader(object):
22 | """
23 | GazeboXmlLoader to parse sdf, urdf, and xacro file
24 | """
25 | @staticmethod
26 | def parse(file_path: str, **kwargs) -> str:
27 | """
28 | Parse sdf, urdf, or xacro file
29 |
30 | Args:
31 | file_path (str): file path to parse
32 | **kwargs: Arbitrary keyword arguments
33 |
34 | Returns:
35 | str: string of processed file contents
36 |
37 | Raises:
38 | Exception: GazeboXmlLoader parse file loading or non-recognized type
39 | exception
40 | """
41 | _, file_extension = os.path.splitext(file_path)
42 | if file_extension in ['.sdf', '.urdf']:
43 | with open(file_path, "r") as file_pointer:
44 | xml = file_pointer.read()
45 | return xml
46 | if file_extension == '.xacro':
47 | xacro_xml = xacro.process_file(input_file_name=file_path,
48 | mappings=kwargs).toxml()
49 | return xacro_xml
50 | raise ValueError("[GazeboXmlLoader]: file type {} not recognizable".format(file_extension))
51 |
--------------------------------------------------------------------------------
/deepsim/deepsim/visual_effects/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/deepsim/visual_effects/effects/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | deepsim
5 | Amazon Web Services
6 | 0.1.0
7 | Open source library to provide building block to build an RL environment in ROS-Gazebo platform.
8 | AWS DeepRacer
9 | Apache License 2.0
10 | catkin
11 |
12 | rospy
13 | std_msgs
14 | geometry_msgs
15 | rosgraph_msgs
16 | gazebo_msgs
17 | deepsim_msgs
18 |
19 | python3-pytest
20 |
21 |
--------------------------------------------------------------------------------
/deepsim/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | junit_suite_name = pytest_tests
3 | flake8-ignore =
4 | *.py C816 D100 D101 D102 D103 D104 D105 D106 D107 D203 D212 D404 I202 E501 F401 F403 W503
5 | test/* ALL
6 | flake8-max-line-length = 200
7 | flake8-show-source = true
8 | flake8-statistics = true
--------------------------------------------------------------------------------
/deepsim/pytest.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/deepsim/pytest_runner.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | #################################################################################
4 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
5 | # #
6 | # Licensed under the Apache License, Version 2.0 (the "License"). #
7 | # You may not use this file except in compliance with the License. #
8 | # You may obtain a copy of the License at #
9 | # #
10 | # http://www.apache.org/licenses/LICENSE-2.0 #
11 | # #
12 | # Unless required by applicable law or agreed to in writing, software #
13 | # distributed under the License is distributed on an "AS IS" BASIS, #
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15 | # See the License for the specific language governing permissions and #
16 | # limitations under the License. #
17 | #################################################################################
18 | """Tools to assist unit testing."""
19 | from __future__ import print_function
20 |
21 | import os
22 | import sys
23 | import rospy
24 | import pytest
25 |
26 |
27 | def get_output_file():
28 | for arg in sys.argv:
29 | if arg.startswith('--gtest_output'):
30 | return arg.split('=xml:')[1]
31 |
32 | raise RuntimeError('No output file has been passed')
33 |
34 |
35 | if __name__ == '__main__':
36 | output_file = get_output_file()
37 | test_module = rospy.get_param('test_module')
38 | runner_path = os.path.dirname(os.path.realpath(__file__))
39 | module_path = os.path.join(runner_path, test_module)
40 |
41 | sys.exit(
42 | pytest.main([module_path, '--junitxml={}'.format(output_file), '--pep257', '--flake8', '--timeout=30'])
43 | )
44 |
--------------------------------------------------------------------------------
/deepsim/setup.cfg:
--------------------------------------------------------------------------------
1 | [metadata]
2 | description_file = README.md
3 | license_file = LICENSE.txt
--------------------------------------------------------------------------------
/deepsim/setup.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """ This ensures modules and global scripts declared therein get installed
17 | ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
18 | """
19 | import os
20 | from setuptools import find_packages
21 | from distutils.core import setup
22 | from catkin_pkg.python_setup import generate_distutils_setup
23 |
24 |
25 | def read(fname):
26 | """
27 | Args:
28 | fname (str): dir path to read
29 | """
30 | with open(os.path.join(os.path.dirname(__file__), fname)) as f:
31 | return f.read()
32 |
33 |
34 | def read_version():
35 | return read("VERSION").strip()
36 |
37 |
38 | package_name = "deepsim"
39 |
40 | # Declare minimal set for installation
41 | required_packages = [
42 | "setuptools",
43 | "numpy>=1.19.5",
44 | "Shapely>=1.7.0,<1.8",
45 | ]
46 |
47 |
48 | test_required_packages = [
49 | "flake8>=3.5,<4.0.0",
50 | "pytest-flake8==1.0.7",
51 | "pytest-pep257==0.0.5",
52 | "pytest-timeout==1.4.2",
53 | ]
54 |
55 | setup_args = {
56 | "name": package_name,
57 | "version": read_version(),
58 | "packages": find_packages(where=".", exclude="test"),
59 | "package_dir": {"": "."},
60 | "description": "Open source library to provide building block to build an RL environment in ROS-Gazebo platform.",
61 | "long_description": read("README.md"),
62 | "long_description_content_type": 'text/markdown',
63 | "author": "Amazon Web Services",
64 | "url": "https://github.com/aws-deepracer/deepsim/tree/main/deepsim",
65 | "license": "Apache License 2.0",
66 | "keywords": "ML RL Amazon AWS AI DeepRacer",
67 | "classifiers": [
68 | "Development Status :: 4 - Beta",
69 | "Intended Audience :: Developers",
70 | "Natural Language :: English",
71 | "License :: OSI Approved :: Apache Software License",
72 | "Programming Language :: Python",
73 | "Programming Language :: Python :: 3.6",
74 | "Programming Language :: Python :: 3.7",
75 | "Programming Language :: Python :: 3.8",
76 | "Programming Language :: Python :: 3.9",
77 | ],
78 | "install_requires": required_packages,
79 | "tests_require": test_required_packages,
80 | }
81 |
82 | PACKAGE_IMPORT = generate_distutils_setup(**setup_args)
83 |
84 | setup(**PACKAGE_IMPORT)
85 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/behaviours/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/cameras/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/colliders/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/colliders/test_hit.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable
17 | from unittest import TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim.colliders.hit import Hit
22 |
23 |
24 | class HitTest(TestCase):
25 | def setUp(self) -> None:
26 | pass
27 |
28 | def test_lt(self):
29 | a = Hit(obj=MagicMock(), ray=MagicMock(), entry=10.0, exit=15.0)
30 | b = Hit(obj=MagicMock(), ray=MagicMock(), entry=12.0, exit=14.0)
31 | assert a < b
32 |
33 | def test_gt(self):
34 | a = Hit(obj=MagicMock(), ray=MagicMock(), entry=13.0, exit=14.0)
35 | b = Hit(obj=MagicMock(), ray=MagicMock(), entry=12.0, exit=15.0)
36 | assert a > b
37 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/core/test_frustum.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable
17 | from unittest import TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | import math
22 | from deepsim.core.frustum import Frustum
23 |
24 |
25 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
26 |
27 |
28 | class FrustumTest(TestCase):
29 | def setUp(self) -> None:
30 | pass
31 |
32 | def test_initialize(self):
33 | near = 1.0
34 | far = 100.0
35 | horizontal_fov = math.pi * 2.0 / 3.0
36 | view_ratio = 480.0 / 640.0
37 | frustum = Frustum(near=near,
38 | far=far,
39 | horizontal_fov=horizontal_fov,
40 | view_ratio=view_ratio)
41 | assert frustum.near == 1.0
42 | assert frustum.far == far
43 | assert frustum.horizontal_fov == horizontal_fov
44 | assert frustum.view_ratio == view_ratio
45 |
46 | def test_setter(self):
47 | near = 1.0
48 | far = 100.0
49 | horizontal_fov = math.pi * 2.0 / 3.0
50 | view_ratio = 480.0 / 640.0
51 | frustum = Frustum(near=near,
52 | far=far,
53 | horizontal_fov=horizontal_fov,
54 | view_ratio=view_ratio)
55 | assert frustum.near == 1.0
56 | assert frustum.far == far
57 | assert frustum.horizontal_fov == horizontal_fov
58 | assert frustum.view_ratio == view_ratio
59 |
60 | new_near = 2.0
61 | new_far = 200.0
62 | new_horizontal_fov = math.pi * 3.0 / 4.0
63 | new_view_ratio = 500.0 / 640.0
64 | frustum.near = new_near
65 | assert frustum.near == new_near
66 | frustum.far = new_far
67 | assert frustum.far == new_far
68 | frustum.horizontal_fov = new_horizontal_fov
69 | assert frustum.horizontal_fov == new_horizontal_fov
70 | frustum.view_ratio = new_view_ratio
71 | assert frustum.view_ratio == new_view_ratio
72 | assert frustum._is_outdated
73 |
74 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/domain_randomizations/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/domain_randomizations/randomizers/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/domain_randomizations/test_abs_randomizer.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable
17 | from unittest import TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim.domain_randomizations.abs_randomizer import AbstractRandomizer
22 |
23 |
24 | class DummyRandomizer(AbstractRandomizer):
25 | def __init__(self):
26 | self.mock = MagicMock()
27 | super(DummyRandomizer, self).__init__()
28 |
29 | def _randomize(self) -> None:
30 | self.mock.randomize()
31 |
32 |
33 | class AbstractEffectTest(TestCase):
34 | def setUp(self) -> None:
35 | pass
36 |
37 | def test_randomize(self):
38 | randomizer = DummyRandomizer()
39 | randomizer.randomize()
40 | randomizer.mock.randomize.assert_called_once()
41 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/domain_randomizations/test_randomizer_manager.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable
17 | from unittest import TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim.domain_randomizations.randomizer_manager import RandomizerManager
22 |
23 |
24 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
25 |
26 |
27 | class RandomizerManagerTest(TestCase):
28 | def setUp(self) -> None:
29 | pass
30 |
31 | def test_add(self):
32 | randomizer_manager = RandomizerManager(is_singleton=False)
33 | randomizer = MagicMock()
34 |
35 | randomizer_manager.add(randomizer)
36 | assert randomizer in randomizer_manager._randomizers
37 |
38 | def test_remove(self):
39 | randomizer_manager = RandomizerManager(is_singleton=False)
40 | randomizer = MagicMock()
41 |
42 | randomizer_manager.add(randomizer)
43 |
44 | randomizer_manager.remove(randomizer)
45 | assert randomizer not in randomizer_manager._randomizers
46 |
47 | def test_remove_non_existing_randomizer(self):
48 | randomizer_manager = RandomizerManager(is_singleton=False)
49 | randomizer = MagicMock()
50 |
51 | with self.assertRaises(KeyError):
52 | randomizer_manager.remove(randomizer)
53 |
54 | def test_discard(self):
55 | randomizer_manager = RandomizerManager(is_singleton=False)
56 | randomizer = MagicMock()
57 |
58 | randomizer_manager.add(randomizer)
59 |
60 | randomizer_manager.discard(randomizer)
61 | assert randomizer not in randomizer_manager._randomizers
62 |
63 | def test_discard_non_existing_randomizer(self):
64 | randomizer_manager = RandomizerManager(is_singleton=False)
65 | randomizer = MagicMock()
66 |
67 | randomizer_manager.discard(randomizer)
68 |
69 | def test_randomize(self):
70 | randomizer_manager = RandomizerManager(is_singleton=False)
71 | randomizer = MagicMock()
72 |
73 | randomizer_manager.add(randomizer)
74 | randomizer_manager.randomize()
75 | randomizer.randomize.assert_called_once()
76 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/ros/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/sim_trackers/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/sim_trackers/test_tracker.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable
17 | from unittest import TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim.sim_trackers.tracker import TrackerInterface
22 | import deepsim.sim_trackers.constants as consts
23 |
24 | from rosgraph_msgs.msg import Clock
25 |
26 |
27 | class DummyTracker(TrackerInterface):
28 | def __init__(self, priority: consts.TrackerPriority = consts.TrackerPriority.NORMAL):
29 | self.mock = MagicMock()
30 |
31 | def on_update_tracker(self, delta_time: float, sim_time: Clock) -> None:
32 | self.mock.on_update_tracker(delta_time, sim_time)
33 |
34 |
35 | @patch("deepsim.sim_trackers.tracker_manager.TrackerManager")
36 | class AbstractTrackerTest(TestCase):
37 | def setUp(self) -> None:
38 | pass
39 |
40 | def test_on_update_tracker(self, tracker_manager_mock):
41 | tracker = DummyTracker()
42 | delta_time_mock = MagicMock()
43 | sim_time_mock = MagicMock()
44 | tracker.on_update_tracker(delta_time=delta_time_mock,
45 | sim_time=sim_time_mock)
46 | tracker.mock.on_update_tracker.assert_called_once_with(delta_time_mock,
47 | sim_time_mock)
48 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/sim_trackers/trackers/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/spawners/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/spawners/test_dummy_spawner.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable
17 | from unittest import TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim.spawners.dummy_spawner import DummySpawner
22 |
23 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
24 |
25 |
26 | class DummySpawnerTest(TestCase):
27 | def setUp(self) -> None:
28 | pass
29 |
30 | def test_initialize(self):
31 | spawner = DummySpawner()
32 | assert not spawner._should_validate_spawn
33 | assert not spawner._should_validate_delete
34 |
35 | def test_spawn(self):
36 | spawner = DummySpawner()
37 | with patch("deepsim.ros.ros_util.ROSUtil") as ros_util_mock:
38 | spawner.spawn(model_name=myself())
39 | ros_util_mock.wait_for_model_spawn.assert_not_called()
40 |
41 | def test_delete(self):
42 | spawner = DummySpawner()
43 | with patch("deepsim.ros.ros_util.ROSUtil") as ros_util_mock:
44 | spawner.delete(model_name=myself())
45 | ros_util_mock.wait_for_model_delete.assert_not_called()
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/test_deepsim.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable
17 | from unittest import TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim.deepsim import DeepSim
22 |
23 |
24 | class DeepSimTest(TestCase):
25 | def setUp(self) -> None:
26 | pass
27 |
28 | def test_timestep(self):
29 | deepsim = DeepSim(is_singleton=False)
30 | deepsim.timestep = 3.0
31 | assert deepsim.timestep == 3.0
32 |
33 | def test_start(self):
34 | with patch("deepsim.sim_trackers.tracker_manager.TrackerManager") as tracker_manager_mock:
35 | deepsim = DeepSim(is_singleton=False)
36 | deepsim.start()
37 | tracker_manager_mock.get_instance.return_value.start.assert_called_once()
38 |
39 | def test_stop(self):
40 | with patch("deepsim.sim_trackers.tracker_manager.TrackerManager") as tracker_manager_mock:
41 | deepsim = DeepSim(is_singleton=False)
42 | deepsim.stop()
43 | tracker_manager_mock.get_instance.return_value.stop.assert_called_once()
44 |
45 | def test_pause(self):
46 | with patch("deepsim.sim_trackers.tracker_manager.TrackerManager") as tracker_manager_mock, \
47 | patch("deepsim.ros.ros_util.ROSUtil") as ros_util_mock:
48 | deepsim = DeepSim(is_singleton=False)
49 | deepsim.pause()
50 | tracker_manager_mock.get_instance.return_value.pause.assert_called_once()
51 | ros_util_mock.pause_physics.assert_called_once()
52 |
53 | def test_resume(self):
54 | with patch("deepsim.sim_trackers.tracker_manager.TrackerManager") as tracker_manager_mock, \
55 | patch("deepsim.ros.ros_util.ROSUtil") as ros_util_mock:
56 | deepsim = DeepSim(is_singleton=False)
57 | deepsim.resume()
58 | tracker_manager_mock.get_instance.return_value.resume.assert_called_once()
59 | ros_util_mock.unpause_physics.assert_called_once()
60 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/visual_effects/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/visual_effects/effects/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim/visual_effects/test_effect_manager.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable
17 | from unittest import TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim.visual_effects.effect_manager import EffectManager
22 |
23 |
24 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
25 |
26 |
27 | class EffectManagerTest(TestCase):
28 | def setUp(self) -> None:
29 | pass
30 |
31 | def test_add(self):
32 | effect_manager = EffectManager(is_singleton=False)
33 | effect = MagicMock()
34 |
35 | effect_manager.add(effect)
36 | assert effect in effect_manager._effects
37 |
38 | def test_remove(self):
39 | effect_manager = EffectManager(is_singleton=False)
40 | effect = MagicMock()
41 |
42 | effect_manager.add(effect)
43 |
44 | effect_manager.remove(effect)
45 | assert effect not in effect_manager._effects
46 |
47 | def test_remove_non_existing_randomizer(self):
48 | effect_manager = EffectManager(is_singleton=False)
49 | effect = MagicMock()
50 |
51 | with self.assertRaises(KeyError):
52 | effect_manager.remove(effect)
53 |
54 | def test_discard(self):
55 | effect_manager = EffectManager(is_singleton=False)
56 | effect = MagicMock()
57 |
58 | effect_manager.add(effect)
59 |
60 | effect_manager.discard(effect)
61 | assert effect not in effect_manager._effects
62 |
63 | def test_discard_non_existing_randomizer(self):
64 | effect_manager = EffectManager(is_singleton=False)
65 | effect = MagicMock()
66 |
67 | effect_manager.discard(effect)
68 |
69 | def test_on_update_tracker(self):
70 | effect_manager = EffectManager(is_singleton=False)
71 | effect = MagicMock()
72 |
73 | effect_manager.add(effect)
74 |
75 | delta_time_mock = MagicMock()
76 | sim_time_mock = MagicMock()
77 | effect_manager.on_update_tracker(delta_time=delta_time_mock,
78 | sim_time=sim_time_mock)
79 | effect.update.assert_called_once_with(delta_time_mock, sim_time_mock)
80 |
--------------------------------------------------------------------------------
/deepsim/test/test_deepsim_import.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | import pytest
17 |
18 |
19 | def test_deepsim_importable():
20 | import deepsim # noqa: F401
21 |
--------------------------------------------------------------------------------
/deepsim_btree/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.7.2)
2 | project(deepsim_btree)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | )
6 |
7 | catkin_python_setup()
8 |
9 | catkin_package(
10 | CATKIN_DEPENDS
11 | )
12 |
13 | ## Tests
14 |
15 | if(CATKIN_ENABLE_TESTING)
16 | find_package(rostest REQUIRED)
17 | add_rostest(pytest.launch)
18 | endif()
19 |
--------------------------------------------------------------------------------
/deepsim_btree/MANIFEST.in:
--------------------------------------------------------------------------------
1 |
2 | include VERSION
3 | include LICENSE.txt
4 | include README.md
--------------------------------------------------------------------------------
/deepsim_btree/README.md:
--------------------------------------------------------------------------------
1 | ## DeepSim Behaviour Tree
2 |
3 | The DeepSim Behaviour Tree package is a part of DeepSim Toolkit that provides a behaviour tree implementation.
4 |
5 | ## Installation
6 |
7 | To install the DeepSim Behaviour Tree, run the `pip install deepsim-btree`command.
8 |
9 | Python 3.6, 3.7, 3.8, and 3.9 are supported on Linux, Windows, and macOS.
10 |
11 | ## Citation
12 |
13 | DeepSim whitepaper is available at https://arxiv.org/abs/2205.08034.
14 | If you reference or use DeepSim in your research, please cite:
15 |
16 | ```
17 | @misc{la2022deepsim,
18 | title={DeepSim: A Reinforcement Learning Environment Build Toolkit for ROS and Gazebo},
19 | author={Woong Gyu La and Lingjie Kong and Sunil Muralidhara and Pratik Nichat},
20 | year={2022},
21 | eprint={2205.08034},
22 | archivePrefix={arXiv},
23 | primaryClass={cs.LG}
24 | }
25 | ```
26 |
27 | ## License
28 |
29 | The source code is released under [Apache 2.0](https://aws.amazon.com/apache-2-0/).
30 |
--------------------------------------------------------------------------------
/deepsim_btree/VERSION:
--------------------------------------------------------------------------------
1 | 0.1.2
--------------------------------------------------------------------------------
/deepsim_btree/deepsim_btree/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from .behaviour import Behaviour
17 |
18 | from .constants import Status
19 |
20 | from .leaves import (Success, Failure)
21 |
22 | from .composites.composite import Composite
23 | from .composites.sequence import Sequence
24 | from .composites.selector import Selector
25 | from .composites.rand_sequence import RandomSequence
26 | from .composites.rand_selector import RandomSelector
27 | from .composites.parallel_sequence import ParallelSequence
28 | from .composites.parallel_selector import ParallelSelector
29 |
30 | from .decorators.decorator import Decorator
31 | from .decorators.condition import Condition
32 | from .decorators.limit import Limit
33 | from .decorators.repeater import Repeater
34 | from .decorators.status_flippers import (
35 | Inverter,
36 | Succeeder,
37 | UntilFail,
38 | RunningIsFailure, RunningIsSuccess,
39 | FailureIsRunning, FailureIsSuccess,
40 | SuccessIsFailure, SuccessIsRunning
41 | )
42 |
--------------------------------------------------------------------------------
/deepsim_btree/deepsim_btree/composites/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim_btree/deepsim_btree/composites/parallel_selector.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """A class for parallel selector node."""
17 | from typing import Optional, Iterable, Iterator
18 | from deepsim_btree.behaviour import Behaviour
19 | from deepsim_btree.composites.composite import Composite
20 | import deepsim_btree.constants as const
21 |
22 |
23 | class ParallelSelector(Composite):
24 | """
25 | Selector behaviour that executes the behavior children in parallel.
26 | """
27 |
28 | def _tick(self) -> Iterator[Behaviour]:
29 | """
30 | Process single tick for current behaviour.
31 | - If any child succeeds then behaviour stops with SUCCESS status
32 | - If all child fails then behaviour stops with FAILURE status
33 |
34 | Returns:
35 | Iterator[Behaviour]: the iterator to process the ticks on behaviour.
36 | """
37 | if self.status != const.Status.RUNNING:
38 | self.initialize()
39 |
40 | # customized update
41 | self.update()
42 |
43 | if not self.children:
44 | self.stop(const.Status.FAILURE)
45 | yield self
46 | return
47 |
48 | self._status = const.Status.RUNNING
49 | children = list(self.children)
50 | while children:
51 | failed_children = []
52 | for child in children:
53 | status = child.tick()
54 | if status == const.Status.SUCCESS:
55 | self.stop(const.Status.SUCCESS)
56 | yield self
57 | return
58 | elif status != const.Status.RUNNING:
59 | failed_children.append(child)
60 | for failed_child in failed_children:
61 | children.remove(failed_child)
62 | if not children:
63 | break
64 | yield self
65 |
66 | self.stop(const.Status.FAILURE)
67 | yield self
68 |
--------------------------------------------------------------------------------
/deepsim_btree/deepsim_btree/composites/parallel_sequence.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """A class for parallel sequence node."""
17 | from typing import Optional, Iterable, Iterator
18 | from deepsim_btree.behaviour import Behaviour
19 | from deepsim_btree.composites.composite import Composite
20 | import deepsim_btree.constants as const
21 |
22 |
23 | class ParallelSequence(Composite):
24 | """
25 | Sequence behaviour that executes the behaviour children in parallel.
26 | """
27 |
28 | def _tick(self) -> Iterator['Behaviour']:
29 | """
30 | Process single tick for current behaviour.
31 | - If all child succeeds then behaviour stops with SUCCESS status
32 | - If any child fails then behaviour stops with FAILURE status
33 |
34 | Returns:
35 | Iterator['Behaviour']: the iterator to process the ticks on behaviour.
36 | """
37 | if self.status != const.Status.RUNNING:
38 | self.initialize()
39 |
40 | # customized update
41 | self.update()
42 |
43 | if not self.children:
44 | self.stop(const.Status.SUCCESS)
45 | yield self
46 | return
47 |
48 | self._status = const.Status.RUNNING
49 | children = list(self.children)
50 | while children:
51 | success_children = []
52 | for child in children:
53 | status = child.tick()
54 | if status == const.Status.SUCCESS:
55 | success_children.append(child)
56 | elif status != const.Status.RUNNING:
57 | self.stop(const.Status.FAILURE)
58 | yield self
59 | return
60 | for success_child in success_children:
61 | children.remove(success_child)
62 | if not children:
63 | break
64 | yield self
65 |
66 | self.stop(const.Status.SUCCESS)
67 | yield self
68 |
--------------------------------------------------------------------------------
/deepsim_btree/deepsim_btree/constants.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """Module to contain DeepSim Behaviour Tree related constants"""
17 | from enum import Enum, unique
18 |
19 |
20 | @unique
21 | class Status(Enum):
22 | """
23 | Behaviour Status
24 | """
25 | SUCCESS = "SUCCESS"
26 | FAILURE = "FAILURE"
27 | RUNNING = "RUNNING"
28 | INVALID = "INVALID"
29 |
--------------------------------------------------------------------------------
/deepsim_btree/deepsim_btree/decorators/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim_btree/deepsim_btree/leaves.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """Classes for leaf nodes"""
17 | from deepsim_btree.behaviour import Behaviour
18 | import deepsim_btree.constants as const
19 |
20 |
21 | class Success(Behaviour):
22 | """
23 | Success behaviour class that always returns SUCCESS
24 | """
25 | def update(self) -> const.Status:
26 | """
27 | Returns SUCCESS.
28 |
29 | Returns:
30 | const.Status: SUCCESS
31 | """
32 | return const.Status.SUCCESS
33 |
34 |
35 | class Failure(Behaviour):
36 | """
37 | Failure behaviour class that always returns FAILURE
38 | """
39 | def update(self) -> const.Status:
40 | """
41 | Returns FAILURE.
42 |
43 | Returns:
44 | const.Status: FAILURE
45 | """
46 | return const.Status.FAILURE
47 |
48 |
49 | class Running(Behaviour):
50 | """
51 | Running behaviour class that always returns RUNNING
52 | """
53 | def update(self) -> const.Status:
54 | """
55 | Returns RUNNING.
56 |
57 | Returns:
58 | const.Status: RUNNING
59 | """
60 | return const.Status.RUNNING
61 |
--------------------------------------------------------------------------------
/deepsim_btree/deepsim_btree/py.typed:
--------------------------------------------------------------------------------
1 | # Marker file that indicates this package supports typing
2 |
--------------------------------------------------------------------------------
/deepsim_btree/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | deepsim_btree
5 | Amazon Web Services
6 | 0.1.2
7 | A Behaviour Tree library for DeepSim Toolkit.
8 | AWS DeepRacer
9 | Apache License 2.0
10 | catkin
11 |
12 | rospy
13 |
14 | python3-pytest
15 |
16 |
--------------------------------------------------------------------------------
/deepsim_btree/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | junit_suite_name = pytest_tests
3 | flake8-ignore =
4 | *.py C816 D100 D101 D102 D103 D104 D105 D106 D107 D203 D212 D404 I202 E501 F401 F403 W503
5 | test/* ALL
6 | *ude_objects/* ALL
7 | flake8-max-line-length = 200
8 | flake8-show-source = true
9 | flake8-statistics = true
--------------------------------------------------------------------------------
/deepsim_btree/pytest.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/deepsim_btree/pytest_runner.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | #################################################################################
4 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
5 | # #
6 | # Licensed under the Apache License, Version 2.0 (the "License"). #
7 | # You may not use this file except in compliance with the License. #
8 | # You may obtain a copy of the License at #
9 | # #
10 | # http://www.apache.org/licenses/LICENSE-2.0 #
11 | # #
12 | # Unless required by applicable law or agreed to in writing, software #
13 | # distributed under the License is distributed on an "AS IS" BASIS, #
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15 | # See the License for the specific language governing permissions and #
16 | # limitations under the License. #
17 | #################################################################################
18 | """Tools to assist unit testing."""
19 | from __future__ import print_function
20 |
21 | import os
22 | import sys
23 | import rospy
24 | import pytest
25 |
26 |
27 | def get_output_file():
28 | for arg in sys.argv:
29 | if arg.startswith('--gtest_output'):
30 | return arg.split('=xml:')[1]
31 |
32 | raise RuntimeError('No output file has been passed')
33 |
34 |
35 | if __name__ == '__main__':
36 | output_file = get_output_file()
37 | test_module = rospy.get_param('test_module')
38 | runner_path = os.path.dirname(os.path.realpath(__file__))
39 | module_path = os.path.join(runner_path, test_module)
40 |
41 | sys.exit(
42 | pytest.main([module_path, '--junitxml={}'.format(output_file), '--pep257', '--flake8', '--timeout=30'])
43 | )
44 |
--------------------------------------------------------------------------------
/deepsim_btree/setup.cfg:
--------------------------------------------------------------------------------
1 | [metadata]
2 | description_file = README.md
3 | license_file = LICENSE.txt
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/composites/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/composites/test_parallel_selector.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable, Optional, Iterable
17 | from unittest import mock, TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim_btree.composites.parallel_selector import ParallelSelector
22 | from deepsim_btree.constants import Status
23 | from deepsim_btree.leaves import Success, Failure, Running
24 |
25 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
26 |
27 |
28 | class ParallelSelectorTest(TestCase):
29 | def setUp(self) -> None:
30 | pass
31 |
32 | def test_tick_success(self):
33 | children = [Failure(), Failure(), Success()]
34 | selector = ParallelSelector(children=children)
35 | status = selector.tick()
36 | assert status == Status.SUCCESS
37 |
38 | def test_tick_success_with_running_child(self):
39 | running_child = Running()
40 | children = [Failure(), Failure(), Success(), running_child]
41 | selector = ParallelSelector(children=children)
42 | status = selector.tick()
43 | assert status == Status.SUCCESS
44 | assert running_child.status == Status.INVALID
45 |
46 | def test_tick_failure(self):
47 | children = [Failure(), Failure(), Failure()]
48 | selector = ParallelSelector(children=children)
49 | status = selector.tick()
50 | assert status == Status.FAILURE
51 |
52 | def test_tick_empty(self):
53 | selector = ParallelSelector()
54 | status = selector.tick()
55 | assert status == Status.FAILURE
56 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/composites/test_parallel_sequence.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable, Optional, Iterable
17 | from unittest import mock, TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim_btree.composites.parallel_sequence import ParallelSequence
22 | from deepsim_btree.constants import Status
23 | from deepsim_btree.leaves import Success, Failure, Running
24 |
25 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
26 |
27 |
28 | class ParallelSequenceTest(TestCase):
29 | def setUp(self) -> None:
30 | pass
31 |
32 | def test_tick_success(self):
33 | children = [Success(), Success(), Success()]
34 | selector = ParallelSequence(children=children)
35 | status = selector.tick()
36 | assert status == Status.SUCCESS
37 |
38 | def test_tick_fails_with_running_child(self):
39 | running_child = Running()
40 | children = [running_child, Success(), Success(), Failure()]
41 | selector = ParallelSequence(children=children)
42 | status = selector.tick()
43 | assert status == Status.FAILURE
44 | assert running_child.status == Status.INVALID
45 |
46 | def test_tick_failure(self):
47 | children = [Success(), Success(), Failure(), Success()]
48 | selector = ParallelSequence(children=children)
49 | status = selector.tick()
50 | assert status == Status.FAILURE
51 |
52 | def test_tick_empty(self):
53 | selector = ParallelSequence()
54 | status = selector.tick()
55 | assert status == Status.SUCCESS
56 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/composites/test_rand_selector.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable, Optional, Iterable
17 | from unittest import mock, TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim_btree.composites.rand_selector import RandomSelector
22 | from deepsim_btree.constants import Status
23 | from deepsim_btree.leaves import Success, Failure, Running
24 |
25 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
26 |
27 |
28 | class RandomSelectorTest(TestCase):
29 | def setUp(self) -> None:
30 | pass
31 |
32 | def test_init(self):
33 | selector = RandomSelector()
34 | assert selector.current_child is None
35 | assert selector.seed is None
36 |
37 | def test_setter(self):
38 | selector = RandomSelector()
39 | assert selector.seed is None
40 | selector.seed = 3
41 | assert selector.seed == 3
42 |
43 | def test_current_child(self):
44 | running_child = Running()
45 | children = [Failure(), running_child, Failure()]
46 | selector = RandomSelector(children=children)
47 | status = selector.tick()
48 | assert status == Status.RUNNING
49 | assert selector.current_child == running_child
50 |
51 | def test_tick_success(self):
52 | children = [Failure(), Failure(), Success()]
53 | selector = RandomSelector(children=children)
54 | status = selector.tick()
55 | assert status == Status.SUCCESS
56 |
57 | def test_tick_failure(self):
58 | children = [Failure(), Failure(), Failure()]
59 | selector = RandomSelector(children=children)
60 | status = selector.tick()
61 | assert status == Status.FAILURE
62 |
63 | def test_tick_empty(self):
64 | selector = RandomSelector()
65 | status = selector.tick()
66 | assert status == Status.FAILURE
67 |
68 | def test_shuffle(self):
69 | running_child = Running()
70 | children = [running_child, Running(), Running()]
71 | selector = RandomSelector(children=children,
72 | seed=1)
73 | status = selector.tick()
74 | assert status == Status.RUNNING
75 | assert selector.current_child != running_child
76 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/composites/test_rand_sequence.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable, Optional, Iterable
17 | from unittest import mock, TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim_btree.composites.rand_sequence import RandomSequence
22 | from deepsim_btree.constants import Status
23 | from deepsim_btree.leaves import Success, Failure, Running
24 |
25 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
26 |
27 |
28 | class RandomSequenceTest(TestCase):
29 | def setUp(self) -> None:
30 | pass
31 |
32 | def test_init(self):
33 | selector = RandomSequence()
34 | assert selector.current_child is None
35 | assert selector.seed is None
36 |
37 | def test_setter(self):
38 | selector = RandomSequence()
39 | assert selector.seed is None
40 | selector.seed = 3
41 | assert selector.seed == 3
42 |
43 | def test_current_child(self):
44 | running_child = Running()
45 | children = [Success(), running_child, Success()]
46 | selector = RandomSequence(children=children)
47 | status = selector.tick()
48 | assert status == Status.RUNNING
49 | assert selector.current_child == running_child
50 |
51 | def test_tick_success(self):
52 | children = [Success(), Success(), Success()]
53 | selector = RandomSequence(children=children)
54 | status = selector.tick()
55 | assert status == Status.SUCCESS
56 |
57 | def test_tick_failure(self):
58 | children = [Success(), Success(), Failure(), Success()]
59 | selector = RandomSequence(children=children)
60 | status = selector.tick()
61 | assert status == Status.FAILURE
62 |
63 | def test_tick_empty(self):
64 | selector = RandomSequence()
65 | status = selector.tick()
66 | assert status == Status.SUCCESS
67 |
68 | def test_shuffle(self):
69 | running_child = Running()
70 | children = [running_child, Running(), Running()]
71 | selector = RandomSequence(children=children,
72 | seed=1)
73 | status = selector.tick()
74 | assert status == Status.RUNNING
75 | assert selector.current_child != running_child
76 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/composites/test_selector.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable, Optional, Iterable
17 | from unittest import mock, TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim_btree.composites.selector import Selector
22 | from deepsim_btree.constants import Status
23 | from deepsim_btree.leaves import Success, Failure, Running
24 |
25 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
26 |
27 |
28 | class SelectorTest(TestCase):
29 | def setUp(self) -> None:
30 | pass
31 |
32 | def test_init(self):
33 | selector = Selector()
34 | assert selector.current_child is None
35 |
36 | def test_current_child(self):
37 | running_child = Running()
38 | children = [Failure(), running_child, Failure()]
39 | selector = Selector(children=children)
40 | status = selector.tick()
41 | assert status == Status.RUNNING
42 | assert selector.current_child == running_child
43 |
44 | def test_tick_success(self):
45 | children = [Failure(), Failure(), Success()]
46 | selector = Selector(children=children)
47 | status = selector.tick()
48 | assert status == Status.SUCCESS
49 |
50 | def test_tick_failure(self):
51 | children = [Failure(), Failure(), Failure()]
52 | selector = Selector(children=children)
53 | status = selector.tick()
54 | assert status == Status.FAILURE
55 |
56 | def test_tick_empty(self):
57 | selector = Selector()
58 | status = selector.tick()
59 | assert status == Status.FAILURE
60 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/composites/test_sequence.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable, Optional, Iterable
17 | from unittest import mock, TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim_btree.composites.sequence import Sequence
22 | from deepsim_btree.constants import Status
23 | from deepsim_btree.leaves import Success, Failure, Running
24 |
25 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
26 |
27 |
28 | class SequenceTest(TestCase):
29 | def setUp(self) -> None:
30 | pass
31 |
32 | def test_init(self):
33 | sequence = Sequence()
34 | assert sequence.current_child is None
35 |
36 | def test_current_child(self):
37 | running_child = Running()
38 | children = [Success(), running_child, Success()]
39 | sequence = Sequence(children=children)
40 | status = sequence.tick()
41 | assert status == Status.RUNNING
42 | assert sequence.current_child == running_child
43 |
44 | def test_tick_success(self):
45 | children = [Success(), Success(), Success()]
46 | sequence = Sequence(children=children)
47 | status = sequence.tick()
48 | assert status == Status.SUCCESS
49 |
50 | def test_tick_failure(self):
51 | children = [Success(), Success(), Failure(), Success()]
52 | sequence = Sequence(children=children)
53 | status = sequence.tick()
54 | assert status == Status.FAILURE
55 |
56 | def test_tick_empty(self):
57 | sequence = Sequence()
58 | status = sequence.tick()
59 | assert status == Status.SUCCESS
60 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/decorators/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/decorators/test_repeater.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable, Optional, Iterable
17 | from unittest import mock, TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim_btree.decorators.repeater import Repeater
22 | from deepsim_btree.constants import Status
23 | from deepsim_btree.leaves import Success, Failure, Running
24 |
25 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
26 |
27 |
28 | class RepeaterTest(TestCase):
29 | def setUp(self) -> None:
30 | pass
31 |
32 | def test_init(self):
33 | child = Success()
34 | repeater = Repeater(child=child)
35 | assert repeater.name == "Repeater"
36 | assert repeater.repeat == 0
37 | assert repeater.run_count == 0
38 |
39 | def test_setter(self):
40 | child = Success()
41 | repeater = Repeater(child=child)
42 | assert repeater.repeat == 0
43 |
44 | repeater.repeat = 2
45 | assert repeater.repeat == 2
46 |
47 | def test_setter_during_running(self):
48 | child = Running()
49 | repeater = Repeater(child=child)
50 | assert repeater.repeat == 0
51 | repeater.tick()
52 | assert repeater.status == Status.RUNNING
53 | with self.assertRaises(RuntimeError):
54 | repeater.repeat = 2
55 |
56 | def test_stop(self):
57 | child = Success()
58 | repeater = Repeater(child=child)
59 | assert repeater.run_count == 0
60 | repeater.tick()
61 | assert repeater.run_count == 1
62 |
63 | repeater.stop()
64 | repeater.tick()
65 | assert repeater.run_count == 1
66 |
67 | def test_update(self):
68 | child = Success()
69 | repeater = Repeater(child=child)
70 | repeater.repeat = 3
71 | status = repeater.tick()
72 | assert status == Status.RUNNING
73 | status = repeater.tick()
74 | assert status == Status.RUNNING
75 | status = repeater.tick()
76 | assert status == Status.RUNNING
77 | status = repeater.tick()
78 | assert status == Status.SUCCESS
79 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree/test_leaves.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from typing import Any, Callable, Optional, Iterable
17 | from unittest import mock, TestCase
18 | from unittest.mock import patch, MagicMock, call
19 | import inspect
20 |
21 | from deepsim_btree.leaves import Success, Failure, Running
22 | from deepsim_btree.constants import Status
23 |
24 | myself: Callable[[], Any] = lambda: inspect.stack()[1][3]
25 |
26 |
27 | class BehaviourTest(TestCase):
28 | def setUp(self) -> None:
29 | pass
30 |
31 | def test_success(self):
32 | behavior = Success()
33 | assert behavior.name == "Success"
34 | status = behavior.tick()
35 | assert status == Status.SUCCESS
36 | status = behavior.tick()
37 | assert status == Status.SUCCESS
38 |
39 | def test_failure(self):
40 | behavior = Failure()
41 | assert behavior.name == "Failure"
42 | status = behavior.tick()
43 | assert status == Status.FAILURE
44 | status = behavior.tick()
45 | assert status == Status.FAILURE
46 |
47 | def test_running(self):
48 | behavior = Running()
49 | assert behavior.name == "Running"
50 | status = behavior.tick()
51 | assert status == Status.RUNNING
52 | status = behavior.tick()
53 | assert status == Status.RUNNING
54 |
--------------------------------------------------------------------------------
/deepsim_btree/test/test_deepsim_btree_import.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | import pytest
17 |
18 |
19 | def test_deepsim_btree_importable():
20 | import deepsim_btree # noqa: F401
21 |
--------------------------------------------------------------------------------
/deepsim_envs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.7.2)
2 | project(deepsim_envs)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | rospy
6 | std_srvs
7 | ude_ros_env
8 | deepsim
9 | )
10 |
11 | catkin_python_setup()
12 |
13 | catkin_package(
14 | CATKIN_DEPENDS
15 | rospy
16 | std_srvs
17 | ude_ros_env
18 | deepsim
19 | )
20 |
21 | ## Tests
22 |
23 | if(CATKIN_ENABLE_TESTING)
24 | find_package(rostest REQUIRED)
25 | add_rostest(pytest.launch)
26 | endif()
27 |
--------------------------------------------------------------------------------
/deepsim_envs/MANIFEST.in:
--------------------------------------------------------------------------------
1 |
2 | include VERSION
3 | include LICENSE.txt
4 | include README.md
--------------------------------------------------------------------------------
/deepsim_envs/README.md:
--------------------------------------------------------------------------------
1 | ## DeepSimEnvs
2 |
3 | The DeepSimEnv package is a part of DeepSim Toolkit that provides interfaces to build UDE compatible environment.
4 |
5 | ## Citation
6 |
7 | DeepSim whitepaper is available at https://arxiv.org/abs/2205.08034.
8 | If you reference or use DeepSim in your research, please cite:
9 |
10 | ```
11 | @misc{la2022deepsim,
12 | title={DeepSim: A Reinforcement Learning Environment Build Toolkit for ROS and Gazebo},
13 | author={Woong Gyu La and Lingjie Kong and Sunil Muralidhara and Pratik Nichat},
14 | year={2022},
15 | eprint={2205.08034},
16 | archivePrefix={arXiv},
17 | primaryClass={cs.LG}
18 | }
19 | ```
20 |
21 | ## License
22 |
23 | The source code is released under [Apache 2.0](https://aws.amazon.com/apache-2-0/).
24 |
25 | ## Resources
26 | * [DeepSim Gazebo Framework](https://github.com/aws-deepracer/deepsim/tree/main/deepsim)
27 | * [Unified Distributed Environment](https://github.com/aws-deepracer/ude)
--------------------------------------------------------------------------------
/deepsim_envs/VERSION:
--------------------------------------------------------------------------------
1 | 0.1.0
--------------------------------------------------------------------------------
/deepsim_envs/deepsim_envs/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | from deepsim_envs.agents.abs_agent import AbstractAgent
17 |
18 | from deepsim_envs.envs.area_interface import AreaInterface
19 | from deepsim_envs.envs.environment import Environment
20 |
--------------------------------------------------------------------------------
/deepsim_envs/deepsim_envs/agents/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim_envs/deepsim_envs/envs/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim_envs/deepsim_envs/envs/area_interface.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """A class for abstract area."""
17 | import abc
18 | from typing import Iterable, Dict
19 | from deepsim_envs.agents.abs_agent import AbstractAgent
20 |
21 | from ude import AgentID, Space
22 |
23 | # Python 2 and 3 compatible Abstract class
24 | ABC = abc.ABCMeta('ABC', (object,), {})
25 |
26 |
27 | class AreaInterface(ABC):
28 | """
29 | Area interface class.
30 | """
31 | @abc.abstractmethod
32 | def get_agents(self) -> Iterable[AbstractAgent]:
33 | """
34 | Returns agents in the area.
35 |
36 | Returns:
37 | Iterable[AbstractAgent]: the agents in the area.
38 | """
39 | raise NotImplementedError()
40 |
41 | @abc.abstractmethod
42 | def get_info(self) -> dict:
43 | """
44 | Returns area information.
45 |
46 | Returns:
47 | dict: the area information.
48 | """
49 | raise NotImplementedError()
50 |
51 | @abc.abstractmethod
52 | def reset(self) -> None:
53 | """
54 | Reset the area
55 | """
56 | raise NotImplementedError()
57 |
58 | @abc.abstractmethod
59 | def close(self) -> None:
60 | """
61 | Close the area
62 | """
63 | raise NotImplementedError()
64 |
65 | @property
66 | @abc.abstractmethod
67 | def observation_space(self) -> Dict[AgentID, Space]:
68 | """
69 | Returns the observation spaces of agents in env.
70 |
71 | Returns:
72 | Dict[AgentID, Space]: the observation spaces of agents in env.
73 | """
74 | raise NotImplementedError()
75 |
76 | @property
77 | @abc.abstractmethod
78 | def action_space(self) -> Dict[AgentID, Space]:
79 | """
80 | Returns the action spaces of agents in env.
81 |
82 | Returns:
83 | Dict[AgentID, Space]: the action spaces of agents in env.
84 | """
85 | raise NotImplementedError()
86 |
--------------------------------------------------------------------------------
/deepsim_envs/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | deepsim_envs
5 | Amazon Web Services
6 | 0.1.0
7 | Open-source library to provide DeepSim RL Environment interface compatible with UDE.
8 | AWS DeepRacer
9 | Apache License 2.0
10 | catkin
11 |
12 | rospy
13 | std_srvs
14 | ude_ros_env
15 | deepsim
16 |
17 | python3-pytest
18 |
19 |
--------------------------------------------------------------------------------
/deepsim_envs/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | junit_suite_name = pytest_tests
3 | flake8-ignore =
4 | *.py C816 D100 D101 D102 D103 D104 D105 D106 D107 D203 D212 D404 I202 E501 F401 F403 W503
5 | test/* ALL
6 | flake8-max-line-length = 200
7 | flake8-show-source = true
8 | flake8-statistics = true
--------------------------------------------------------------------------------
/deepsim_envs/pytest.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/deepsim_envs/pytest_runner.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | #################################################################################
4 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
5 | # #
6 | # Licensed under the Apache License, Version 2.0 (the "License"). #
7 | # You may not use this file except in compliance with the License. #
8 | # You may obtain a copy of the License at #
9 | # #
10 | # http://www.apache.org/licenses/LICENSE-2.0 #
11 | # #
12 | # Unless required by applicable law or agreed to in writing, software #
13 | # distributed under the License is distributed on an "AS IS" BASIS, #
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15 | # See the License for the specific language governing permissions and #
16 | # limitations under the License. #
17 | #################################################################################
18 | """Tools to assist unit testing."""
19 | from __future__ import print_function
20 |
21 | import os
22 | import sys
23 | import rospy
24 | import pytest
25 |
26 |
27 | def get_output_file():
28 | for arg in sys.argv:
29 | if arg.startswith('--gtest_output'):
30 | return arg.split('=xml:')[1]
31 |
32 | raise RuntimeError('No output file has been passed')
33 |
34 |
35 | if __name__ == '__main__':
36 | output_file = get_output_file()
37 | test_module = rospy.get_param('test_module')
38 | runner_path = os.path.dirname(os.path.realpath(__file__))
39 | module_path = os.path.join(runner_path, test_module)
40 |
41 | sys.exit(
42 | pytest.main([module_path, '--junitxml={}'.format(output_file), '--pep257', '--flake8', '--timeout=30'])
43 | )
44 |
--------------------------------------------------------------------------------
/deepsim_envs/setup.cfg:
--------------------------------------------------------------------------------
1 | [metadata]
2 | description_file = README.md
3 | license_file = LICENSE.txt
--------------------------------------------------------------------------------
/deepsim_envs/setup.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | """ This ensures modules and global scripts declared therein get installed
17 | ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
18 | """
19 | import os
20 | from setuptools import find_packages
21 | from distutils.core import setup
22 | from catkin_pkg.python_setup import generate_distutils_setup
23 |
24 |
25 | def read(fname):
26 | """
27 | Args:
28 | fname (str): dir path to read
29 | """
30 | with open(os.path.join(os.path.dirname(__file__), fname)) as f:
31 | return f.read()
32 |
33 |
34 | def read_version():
35 | return read("VERSION").strip()
36 |
37 |
38 | package_name = "deepsim_envs"
39 |
40 | # Declare minimal set for installation
41 | required_packages = [
42 | "setuptools",
43 | "ude>=0.1.0"
44 | ]
45 |
46 |
47 | test_required_packages = [
48 | "flake8>=3.5,<4.0.0",
49 | "pytest-flake8==1.0.7",
50 | "pytest-pep257==0.0.5",
51 | "pytest-timeout==1.4.2",
52 | ]
53 |
54 |
55 | setup_args = {
56 | "name": package_name,
57 | "version": read_version(),
58 | "packages": find_packages(where=".", exclude="test"),
59 | "package_dir": {"": "."},
60 | "description": "Open-source library to provide DeepSim RL Environment interface compatible with UDE.",
61 | "long_description": read("README.md"),
62 | "long_description_content_type": 'text/markdown',
63 | "author": "Amazon Web Services",
64 | "url": "https://github.com/aws-deepracer/deepsim/tree/main/deepsim_envs",
65 | "license": "Apache License 2.0",
66 | "keywords": "ML RL Amazon AWS AI DeepRacer",
67 | "classifiers": [
68 | "Development Status :: 4 - Beta",
69 | "Intended Audience :: Developers",
70 | "Natural Language :: English",
71 | "License :: OSI Approved :: Apache Software License",
72 | "Programming Language :: Python",
73 | "Programming Language :: Python :: 3.6",
74 | "Programming Language :: Python :: 3.7",
75 | "Programming Language :: Python :: 3.8",
76 | "Programming Language :: Python :: 3.9",
77 | ],
78 | "install_requires": required_packages,
79 | "tests_require": test_required_packages,
80 | }
81 |
82 | PACKAGE_IMPORT = generate_distutils_setup(**setup_args)
83 |
84 | setup(**PACKAGE_IMPORT)
85 |
--------------------------------------------------------------------------------
/deepsim_envs/test/agents/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim_envs/test/envs/__init__.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 |
--------------------------------------------------------------------------------
/deepsim_envs/test/test_deepsim_envs_import.py:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | import pytest
17 |
18 |
19 | def test_deepsim_envs_importable():
20 | import deepsim_envs # noqa: F401
21 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0.2)
2 | project(deepsim_gazebo_plugin)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | roslint
6 | roslib
7 | roscpp
8 | std_srvs
9 | std_msgs
10 | geometry_msgs
11 | gazebo_msgs
12 | gazebo_dev
13 | deepsim_msgs)
14 |
15 | find_package(Boost REQUIRED COMPONENTS thread)
16 |
17 | catkin_package(
18 | LIBRARIES
19 | deepsim_gazebo_plugin
20 |
21 | CATKIN_DEPENDS
22 | roslib
23 | roscpp
24 | gazebo_ros
25 | geometry_msgs
26 | std_srvs
27 | std_msgs
28 | gazebo_msgs
29 | deepsim_msgs)
30 |
31 | include_directories(
32 | include
33 | ${Boost_INCLUDE_DIRS}
34 | ${catkin_INCLUDE_DIRS})
35 |
36 | link_directories(${catkin_LIBRARY_DIRS})
37 |
38 | set(cxx_flags)
39 | foreach (item ${GAZEBO_CFLAGS})
40 | set(cxx_flags "${cxx_flags} ${item}")
41 | endforeach ()
42 |
43 | set(ld_flags)
44 | foreach (item ${GAZEBO_LDFLAGS})
45 | set(ld_flags "${ld_flags} ${item}")
46 | endforeach ()
47 |
48 | ## Plugins
49 | add_library(deepsim_gazebo_plugin
50 | src/deepsim_gazebo_system_plugin.cpp
51 | src/deepsim_gazebo_world_services.cpp
52 | src/deepsim_gazebo_state_services.cpp
53 | src/deepsim_gazebo_state.cpp
54 | src/deepsim_gazebo_visual_services.cpp
55 | src/deepsim_gazebo_visual_publisher.cpp
56 | src/converters/geometry_converter.cpp
57 | src/converters/visual_converter.cpp)
58 | add_dependencies(deepsim_gazebo_plugin ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
59 | set_target_properties(deepsim_gazebo_plugin PROPERTIES LINK_FLAGS "${ld_flags}")
60 | set_target_properties(deepsim_gazebo_plugin PROPERTIES COMPILE_FLAGS "${cxx_flags}")
61 | target_link_libraries(deepsim_gazebo_plugin ${catkin_LIBRARIES} ${Boost_LIBRARIES})
62 |
63 | install(TARGETS deepsim_gazebo_plugin
64 | LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
65 | )
66 |
67 | ## For examples
68 | install(DIRECTORY launch/
69 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
70 | )
71 | install(DIRECTORY models/
72 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/models
73 | )
74 | install(DIRECTORY worlds/
75 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/worlds
76 | )
77 |
78 | ## Skipping Copyrights check for now.
79 | set(ROSLINT_CPP_OPTS "--filter=-legal/copyright,-runtime/references,-runtime/init")
80 | roslint_cpp(
81 | src/deepsim_gazebo_system_plugin.cpp
82 | src/deepsim_gazebo_world_services.cpp
83 | src/deepsim_gazebo_state_services.cpp
84 | src/deepsim_gazebo_state.cpp
85 | src/deepsim_gazebo_visual_services.cpp
86 | src/deepsim_gazebo_visual_publisher.cpp
87 | src/converters/geometry_converter.cpp
88 | src/converters/visual_converter.cpp)
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/README.md:
--------------------------------------------------------------------------------
1 | ## DeepSim Gazebo PlugIn
2 |
3 | The DeepSim Gaezebo PlugIn package is a part of DeepSim Toolkit that provides a communication layer between DeepSim Gazebo Framework and Gazebo using ROS.
4 |
5 | ## Citation
6 |
7 | DeepSim whitepaper is available at https://arxiv.org/abs/2205.08034.
8 | If you reference or use DeepSim in your research, please cite:
9 |
10 | ```
11 | @misc{la2022deepsim,
12 | title={DeepSim: A Reinforcement Learning Environment Build Toolkit for ROS and Gazebo},
13 | author={Woong Gyu La and Lingjie Kong and Sunil Muralidhara and Pratik Nichat},
14 | year={2022},
15 | eprint={2205.08034},
16 | archivePrefix={arXiv},
17 | primaryClass={cs.LG}
18 | }
19 | ```
20 |
21 | ## License
22 |
23 | The source code is released under [Apache 2.0](https://aws.amazon.com/apache-2-0/).
24 |
25 | ## Resources
26 | * [DeepSim Gazebo Framework](https://github.com/aws-deepracer/deepsim/tree/main/deepsim)
27 | * [DeepSim Messages](https://github.com/aws-deepracer/deepsim/tree/main/deepsim_msgs)
28 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/include/deepsim_gazebo_plugin/converters/visual_converter.hpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////////
2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. //
3 | // //
4 | // Licensed under the Apache License, Version 2.0 (the "License"). //
5 | // You may not use this file except in compliance with the License. //
6 | // You may obtain a copy of the License at //
7 | // //
8 | // http://www.apache.org/licenses/LICENSE-2.0 //
9 | // //
10 | // Unless required by applicable law or agreed to in writing, software //
11 | // distributed under the License is distributed on an "AS IS" BASIS, //
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
13 | // See the License for the specific language governing permissions and //
14 | // limitations under the License. //
15 | ///////////////////////////////////////////////////////////////////////////////////
16 |
17 | #ifndef DEEPSIM_GAZEBO_PLUGIN__VISUAL_CONVERTER_HPP_
18 | #define DEEPSIM_GAZEBO_PLUGIN__VISUAL_CONVERTER_HPP_
19 |
20 | #include
21 | #include
22 | #include "deepsim_msgs/Visual.h"
23 |
24 | #include
25 |
26 | namespace deepsim_gazebo_plugin
27 | {
28 | class VisualConverter
29 | {
30 | public:
31 | /// \brief Specialized conversion from a Gazebo Color msg to std_msgs::ColorRGBA
32 | /// \param[in] msg gazebo color message to convert.
33 | /// \return A standard ColorRGBA
34 | static std_msgs::ColorRGBA Convert2StdColorRGBA(const gazebo::msgs::Color & msg);
35 |
36 | /// \brief Specialized setter from std_msgs::ColorRGBA to a Gazebo Color msg
37 | /// \param[in] msg Gazebo Color msg
38 | /// \param[in] in standard color message to convert.
39 | static void SetGazeboColor(gazebo::msgs::Color *_msg, const std_msgs::ColorRGBA & in);
40 |
41 | /// \brief Specialized conversion from gazebo::msgs::Visual to deepsim_msgs::Visual
42 | /// \param[in] link_name link name.
43 | /// \param[in] visual_name visual name.
44 | /// \param[in] msg gazebo Visual message to convert.
45 | /// \return A deepsim Visual message
46 | static deepsim_msgs::Visual Convert2DeepsimVisual(
47 | const std::string& link_name,
48 | const std::string& visual_name,
49 | const gazebo::msgs::Visual & msg);
50 |
51 | /// \brief Get a default Black Opaque color in Standrad Color RGBA
52 | /// \return A Standrad Color RGBA in Black Opaque
53 | static std_msgs::ColorRGBA StandardBlackOpaque();
54 | };
55 | } // namespace deepsim_gazebo_plugin
56 | #endif // DEEPSIM_GAZEBO_PLUGIN__VISUAL_CONVERTER_HPP_
57 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/include/deepsim_gazebo_plugin/deepsim_gazebo_state_services.hpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////////
2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. //
3 | // //
4 | // Licensed under the Apache License, Version 2.0 (the "License"). //
5 | // You may not use this file except in compliance with the License. //
6 | // You may obtain a copy of the License at //
7 | // //
8 | // http://www.apache.org/licenses/LICENSE-2.0 //
9 | // //
10 | // Unless required by applicable law or agreed to in writing, software //
11 | // distributed under the License is distributed on an "AS IS" BASIS, //
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
13 | // See the License for the specific language governing permissions and //
14 | // limitations under the License. //
15 | ///////////////////////////////////////////////////////////////////////////////////
16 |
17 | #ifndef DEEPSIM_GAZEBO_PLUGIN__DEEPSIM_GAZEBO_STATE_SERVICES_HPP_
18 | #define DEEPSIM_GAZEBO_PLUGIN__DEEPSIM_GAZEBO_STATE_SERVICES_HPP_
19 |
20 | #include
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 |
31 | #include
32 | #include
33 |
34 | #include "deepsim_msgs/GetModelStates.h"
35 | #include "deepsim_msgs/GetLinkStates.h"
36 | #include "deepsim_msgs/GetAllModelStates.h"
37 | #include "deepsim_msgs/GetAllLinkStates.h"
38 | #include "deepsim_msgs/SetModelStates.h"
39 | #include "deepsim_msgs/SetLinkStates.h"
40 |
41 | namespace deepsim_gazebo_plugin
42 | {
43 |
44 | class DeepsimGazeboStateServicesPrivate;
45 |
46 | class DeepsimGazeboStateServices
47 | {
48 | public:
49 | /// Constructor
50 | explicit DeepsimGazeboStateServices(
51 | std::mutex & _lock,
52 | ros::CallbackQueue & ros_callback_queue_);
53 |
54 | /// Destructor
55 | virtual ~DeepsimGazeboStateServices();
56 |
57 | /// \brief Create world related services.
58 | /// \param[in] _ros_node gazebo_ros::Node::SharedPtr
59 | /// The ros node pointer for logging and beyond.
60 | /// \param[in] _world gazebo_ros::Node::SharedPtr
61 | /// The gazebo world pointer to fetch additional entities.
62 | void CreateServices(
63 | const boost::shared_ptr _ros_node,
64 | const gazebo::physics::WorldPtr _world);
65 |
66 | private:
67 | std::unique_ptr impl_;
68 | };
69 | } // namespace deepsim_gazebo_plugin
70 | #endif // DEEPSIM_GAZEBO_PLUGIN__DEEPSIM_GAZEBO_STATE_SERVICES_HPP_
71 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/include/deepsim_gazebo_plugin/deepsim_gazebo_system_plugin.hpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////////
2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. //
3 | // //
4 | // Licensed under the Apache License, Version 2.0 (the "License"). //
5 | // You may not use this file except in compliance with the License. //
6 | // You may obtain a copy of the License at //
7 | // //
8 | // http://www.apache.org/licenses/LICENSE-2.0 //
9 | // //
10 | // Unless required by applicable law or agreed to in writing, software //
11 | // distributed under the License is distributed on an "AS IS" BASIS, //
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
13 | // See the License for the specific language governing permissions and //
14 | // limitations under the License. //
15 | ///////////////////////////////////////////////////////////////////////////////////
16 |
17 | #ifndef DEEPSIM_GAZEBO_PLUGIN__DEEPSIM_GAZEBO_SYSTEM_PLUGIN_HPP_
18 | #define DEEPSIM_GAZEBO_PLUGIN__DEEPSIM_GAZEBO_SYSTEM_PLUGIN_HPP_
19 |
20 | // ROS
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | // Boost
28 | #include
29 | #include
30 | #include
31 |
32 | // Gazebo
33 | #define protected public
34 | #include
35 | #undef protected
36 | #include
37 | #include
38 | #include
39 |
40 | namespace gazebo
41 | {
42 |
43 | class DeepSimGazeboSystemPluginPrivate;
44 |
45 | class DeepSimGazeboSystemPlugin : public SystemPlugin
46 | {
47 | public:
48 | /// Constructor
49 | DeepSimGazeboSystemPlugin();
50 |
51 | /// Destructor
52 | virtual ~DeepSimGazeboSystemPlugin();
53 |
54 | // Documentation inherited
55 | void Load(int argc, char ** argv) override;
56 |
57 | private:
58 | std::unique_ptr impl_;
59 | };
60 |
61 | } // namespace gazebo_plugins
62 | #endif // DEEPSIM_GAZEBO_PLUGIN__DEEPSIM_GAZEBO_SYSTEM_PLUGIN_HPP_
63 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/include/deepsim_gazebo_plugin/deepsim_gazebo_world_services.hpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////////
2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. //
3 | // //
4 | // Licensed under the Apache License, Version 2.0 (the "License"). //
5 | // You may not use this file except in compliance with the License. //
6 | // You may obtain a copy of the License at //
7 | // //
8 | // http://www.apache.org/licenses/LICENSE-2.0 //
9 | // //
10 | // Unless required by applicable law or agreed to in writing, software //
11 | // distributed under the License is distributed on an "AS IS" BASIS, //
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
13 | // See the License for the specific language governing permissions and //
14 | // limitations under the License. //
15 | ///////////////////////////////////////////////////////////////////////////////////
16 |
17 | #ifndef DEEPSIM_GAZEBO_PLUGIN__DEEPSIM_GAZEBO_WORLD_SERVICES_HPP_
18 | #define DEEPSIM_GAZEBO_PLUGIN__DEEPSIM_GAZEBO_WORLD_SERVICES_HPP_
19 |
20 | #include
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | #include "deepsim_msgs/GetLightNames.h"
30 |
31 |
32 | namespace deepsim_gazebo_plugin
33 | {
34 |
35 | class DeepsimGazeboWorldServicesPrivate;
36 |
37 | class DeepsimGazeboWorldServices
38 | {
39 | public:
40 | /// Constructor
41 | explicit DeepsimGazeboWorldServices(
42 | std::mutex & _lock,
43 | ros::CallbackQueue & ros_callback_queue_);
44 |
45 | /// Destructor
46 | virtual ~DeepsimGazeboWorldServices();
47 |
48 | /// \brief Create world related services.
49 | /// \param[in] _ros_node gazebo_ros::Node::SharedPtr
50 | /// The ros node pointer for logging and beyond.
51 | /// \param[in] _world gazebo_ros::Node::SharedPtr
52 | /// The gazebo world pointer to fetch additional entities.
53 | void CreateServices(
54 | const boost::shared_ptr _ros_node,
55 | const gazebo::physics::WorldPtr _world);
56 |
57 | private:
58 | std::unique_ptr impl_;
59 | };
60 | } // namespace deepsim_gazebo_plugin
61 | #endif // DEEPSIM_GAZEBO_PLUGIN__DEEPSIM_GAZEBO_WORLD_SERVICES_HPP_
62 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/launch/example_world.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/models/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-deepracer/deepsim/60f342358e1ead46139311bf8c14fe2c1c11afc6/deepsim_gazebo_plugin/models/.DS_Store
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/models/box/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | box
5 | 1.0
6 | model.sdf
7 |
8 |
9 | me
10 | somebody@somewhere.com
11 |
12 |
13 |
14 | A simple box.
15 |
16 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/models/box/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1 2 0 0 0 0
5 |
6 | 0 0 .5 0 0 0
7 |
8 |
9 | 1 1 1
10 |
11 |
12 |
13 |
14 | 1 1 1
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/models/cylinder/model.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | cylinder
5 | 1.0
6 | model.sdf
7 |
8 |
9 | me
10 | somebody@somewhere.com
11 |
12 |
13 |
14 | A simple cylinder.
15 |
16 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/models/cylinder/model.sdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1 2 0 0 0 0
5 |
6 | 0 0 .5 0 0 0
7 |
8 |
9 | 0.51
10 |
11 |
12 |
13 |
14 | 0.51
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | deepsim_gazebo_plugin
5 | Amazon Web Services
6 | 0.1.0
7 | Gazebo System Plugin for DeepSim Framework.
8 | AWS DeepRacer
9 | Apache License 2.0
10 | catkin
11 |
12 | roslint
13 |
14 | gazebo_ros
15 | gazebo
16 | gazebo_msgs
17 | geometry_msgs
18 | deepsim_msgs
19 | roscpp
20 | roslib
21 | std_msgs
22 | std_srvs
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/deepsim_gazebo_plugin/worlds/example_box.world:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | model://ground_plane
8 |
9 |
10 |
11 | model://sun
12 |
13 |
14 |
15 | 0 0 0.5 0 0 0
16 |
17 |
18 |
19 |
20 | 1 1 1
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | 1 1 1
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/deepsim_msgs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0.2)
2 | project(deepsim_msgs)
3 |
4 | find_package(catkin REQUIRED COMPONENTS
5 | std_msgs
6 | geometry_msgs
7 | gazebo_msgs
8 | std_srvs
9 | message_generation
10 | )
11 |
12 | add_message_files(
13 | DIRECTORY msg
14 | FILES
15 | Visual.msg
16 | Visuals.msg
17 | )
18 |
19 | add_service_files(DIRECTORY srv FILES
20 | GetLightNames.srv
21 | GetVisualNames.srv
22 | GetVisual.srv
23 | GetVisuals.srv
24 | GetLinkStates.srv
25 | GetModelStates.srv
26 | GetAllLinkStates.srv
27 | GetAllModelStates.srv
28 | GetAllVisuals.srv
29 | SetVisualMaterial.srv
30 | SetVisualMaterials.srv
31 | SetVisualTransparency.srv
32 | SetVisualTransparencies.srv
33 | SetVisualVisible.srv
34 | SetVisualVisibles.srv
35 | SetLinkStates.srv
36 | SetModelStates.srv
37 | )
38 |
39 | generate_messages(DEPENDENCIES
40 | std_msgs
41 | geometry_msgs
42 | gazebo_msgs
43 | )
44 |
45 | catkin_package(
46 | CATKIN_DEPENDS
47 | message_runtime
48 | std_msgs
49 | geometry_msgs
50 | gazebo_msgs
51 | std_srvs
52 | )
53 |
--------------------------------------------------------------------------------
/deepsim_msgs/README.md:
--------------------------------------------------------------------------------
1 | ## DeepSim Messages
2 |
3 | The DeepSim Messages package is a part of DeepSim Toolkit that defines the ROS communication messages between DeepSim Gazebo Framework and Gazebo.
4 |
5 | ## Citation
6 |
7 | DeepSim whitepaper is available at https://arxiv.org/abs/2205.08034.
8 | If you reference or use DeepSim in your research, please cite:
9 |
10 | ```
11 | @misc{la2022deepsim,
12 | title={DeepSim: A Reinforcement Learning Environment Build Toolkit for ROS and Gazebo},
13 | author={Woong Gyu La and Lingjie Kong and Sunil Muralidhara and Pratik Nichat},
14 | year={2022},
15 | eprint={2205.08034},
16 | archivePrefix={arXiv},
17 | primaryClass={cs.LG}
18 | }
19 | ```
20 |
21 | ## License
22 |
23 | The source code is released under [Apache 2.0](https://aws.amazon.com/apache-2-0/).
24 |
25 | ## Resources
26 | * [DeepSim Gazebo Framework](https://github.com/aws-deepracer/deepsim/tree/main/deepsim)
27 | * [DeepSim Gazebo Plugin](https://github.com/aws-deepracer/deepsim/tree/main/deepsim_gazebo_plugin)
28 |
--------------------------------------------------------------------------------
/deepsim_msgs/msg/Visual.msg:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Custom message for Visual
17 | string link_name
18 | string visual_name
19 | std_msgs/ColorRGBA ambient
20 | std_msgs/ColorRGBA diffuse
21 | std_msgs/ColorRGBA specular
22 | std_msgs/ColorRGBA emissive
23 | float64 transparency
24 | bool visible
25 | uint16 geometry_type
26 | string mesh_geom_filename
27 | geometry_msgs/Vector3 mesh_geom_scale
28 | geometry_msgs/Pose pose
--------------------------------------------------------------------------------
/deepsim_msgs/msg/Visuals.msg:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Custom message for an array of Visuals
17 | string[] link_name
18 | string[] visual_name
19 | std_msgs/ColorRGBA[] ambient
20 | std_msgs/ColorRGBA[] diffuse
21 | std_msgs/ColorRGBA[] specular
22 | std_msgs/ColorRGBA[] emissive
23 | float64[] transparency
24 | bool[] visible
25 | uint16[] geometry_type
26 | string[] mesh_geom_filename
27 | geometry_msgs/Vector3[] mesh_geom_scale
28 | geometry_msgs/Pose[] pose
--------------------------------------------------------------------------------
/deepsim_msgs/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | deepsim_msgs
5 | Amazon Web Services
6 | 0.1.0
7 | Message and service interfaces for DeepSim Framework.
8 | AWS DeepRacer
9 | Apache License 2.0
10 | catkin
11 |
12 | gazebo_msgs
13 | geometry_msgs
14 | std_msgs
15 | std_srvs
16 |
17 | message_generation
18 |
19 | message_runtime
20 |
21 |
--------------------------------------------------------------------------------
/deepsim_msgs/srv/GetAllLinkStates.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to retrieve all link states.
17 | ---
18 | gazebo_msgs/LinkState[] link_states
19 | bool success # return true if get info is successful
20 | string status_message # comments if available
--------------------------------------------------------------------------------
/deepsim_msgs/srv/GetAllModelStates.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to retrieve all model states.
17 | ---
18 | gazebo_msgs/ModelState[] model_states
19 | bool success # return true if get successful
20 | string status_message # comments if available
--------------------------------------------------------------------------------
/deepsim_msgs/srv/GetAllVisuals.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to retrieve all visuals.
17 | ---
18 | Visual[] visuals
19 | bool success # return true if get info is successful
20 | string status_message # comments if available
--------------------------------------------------------------------------------
/deepsim_msgs/srv/GetLightNames.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to retrieve all light names.
17 | ---
18 | string[] light_names
19 | bool success
20 | string status_message
--------------------------------------------------------------------------------
/deepsim_msgs/srv/GetLinkStates.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to retrieve link states.
17 | string[] link_names # name of link
18 | # link names are prefixed by model name, e.g. pr2::base_link
19 | string[] relative_entity_names # reference frame of returned information, must be a valid link
20 | # if empty, use inertial (gazebo world) frame
21 | # reference_frame names are prefixed by model name, e.g. pr2::base_link
22 | ---
23 | gazebo_msgs/LinkState[] link_states
24 | bool success # return true if get info is successful
25 | string status_message # comments if available
26 | int8[] status # status of each request: true if succeeded otherwise false
27 | string[] messages
--------------------------------------------------------------------------------
/deepsim_msgs/srv/GetModelStates.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to retrieve model states.
17 | string[] model_names # name of Gazebo Model
18 | string[] relative_entity_names # return pose and twist relative to this entity
19 | # an entity can be a model, body, or geom
20 | # be sure to use gazebo scoped naming notation (e.g. [model_name::body_name])
21 | # leave empty or "world" will use inertial world frame
22 | ---
23 | gazebo_msgs/ModelState[] model_states
24 | bool success # return true if get successful
25 | string status_message # comments if available
26 | int8[] status # status of each request: true if succeeded otherwise false
27 | string[] messages
--------------------------------------------------------------------------------
/deepsim_msgs/srv/GetVisual.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to retrieve Visual.
17 | string link_name
18 | string visual_name
19 | ---
20 | Visual visual
21 | bool success
22 | string status_message
--------------------------------------------------------------------------------
/deepsim_msgs/srv/GetVisualNames.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to retrieve Visual names from link names.
17 | string[] link_names
18 | ---
19 | string[] visual_names
20 | string[] link_names
21 | bool success
22 | string status_message
--------------------------------------------------------------------------------
/deepsim_msgs/srv/GetVisuals.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to retrieve Visuals with link and visual names.
17 | string[] link_names
18 | string[] visual_names
19 | ---
20 | Visual[] visuals
21 | bool success
22 | string status_message
23 | int8[] status # status of each request: true if succeeded otherwise false
24 | string[] messages
--------------------------------------------------------------------------------
/deepsim_msgs/srv/SetLinkStates.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to set link states.
17 | gazebo_msgs/LinkState[] link_states
18 | ---
19 | bool success # return true if set wrench successful
20 | string status_message # comments if available
21 | int8[] status # status of each request: true if succeeded otherwise false
22 | string[] messages
--------------------------------------------------------------------------------
/deepsim_msgs/srv/SetModelStates.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to set model states.
17 | gazebo_msgs/ModelState[] model_states
18 | ---
19 | bool success # return true if setting state successful
20 | string status_message # comments if available
21 | int8[] status # status of each request: true if succeeded otherwise false
22 | string[] messages
--------------------------------------------------------------------------------
/deepsim_msgs/srv/SetVisualMaterial.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to set visual material.
17 | string link_name
18 | string visual_name
19 | std_msgs/ColorRGBA ambient
20 | std_msgs/ColorRGBA diffuse
21 | std_msgs/ColorRGBA specular
22 | std_msgs/ColorRGBA emissive
23 | bool block
24 | ---
25 | bool success
26 | string status_message
--------------------------------------------------------------------------------
/deepsim_msgs/srv/SetVisualMaterials.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to set visual materials.
17 | string[] link_names
18 | string[] visual_names
19 | std_msgs/ColorRGBA[] ambients
20 | std_msgs/ColorRGBA[] diffuses
21 | std_msgs/ColorRGBA[] speculars
22 | std_msgs/ColorRGBA[] emissives
23 | bool block
24 | ---
25 | bool success
26 | string status_message
27 | int8[] status # status of each request: true if succeeded otherwise false
28 | string[] messages
--------------------------------------------------------------------------------
/deepsim_msgs/srv/SetVisualTransparencies.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to set visual transparencies.
17 | string[] link_names
18 | string[] visual_names
19 | float64[] transparencies
20 | bool block
21 | ---
22 | bool success
23 | string status_message
24 | int8[] status # status of each request: true if succeeded otherwise false
25 | string[] messages
--------------------------------------------------------------------------------
/deepsim_msgs/srv/SetVisualTransparency.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to set visual transparency.
17 | string link_name
18 | string visual_name
19 | float64 transparency
20 | bool block
21 | ---
22 | bool success
23 | string status_message
--------------------------------------------------------------------------------
/deepsim_msgs/srv/SetVisualVisible.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to set visual visible.
17 | string link_name
18 | string visual_name
19 | bool visible
20 | bool block
21 | ---
22 | bool success
23 | string status_message
--------------------------------------------------------------------------------
/deepsim_msgs/srv/SetVisualVisibles.srv:
--------------------------------------------------------------------------------
1 | #################################################################################
2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
3 | # #
4 | # Licensed under the Apache License, Version 2.0 (the "License"). #
5 | # You may not use this file except in compliance with the License. #
6 | # You may obtain a copy of the License at #
7 | # #
8 | # http://www.apache.org/licenses/LICENSE-2.0 #
9 | # #
10 | # Unless required by applicable law or agreed to in writing, software #
11 | # distributed under the License is distributed on an "AS IS" BASIS, #
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 | # See the License for the specific language governing permissions and #
14 | # limitations under the License. #
15 | #################################################################################
16 | # Service to set visual visibles.
17 | string[] link_names
18 | string[] visual_names
19 | int8[] visibles
20 | bool block
21 | ---
22 | bool success
23 | string status_message
24 | int8[] status # status of each request: true if succeeded otherwise false
25 | string[] messages
--------------------------------------------------------------------------------