├── .github ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── lint.yml │ ├── ros1.yml │ └── ros2.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── Makefile ├── NOTICE ├── README.md ├── entrypoint.sh ├── roboMakerSettings.json ├── robot_ws ├── .rosinstall └── src │ ├── LICENSE.txt │ └── hello_world_robot │ ├── CMakeLists.txt │ ├── deploymentScripts │ ├── post_launch_file.sh │ └── pre_launch_file.sh │ ├── launch │ ├── deploy_rotate.launch │ └── rotate.launch │ ├── nodes │ └── rotate.py │ ├── package.xml │ ├── setup.py │ └── src │ └── hello_world_robot │ └── __init__.py ├── scripts ├── build.sh ├── bundle.sh └── setup.sh └── simulation_ws ├── .rosinstall └── src ├── LICENSE.txt └── hello_world_simulation ├── CMakeLists.txt ├── launch ├── empty_world.launch ├── view_empty_world.launch └── worldforge_world.launch ├── package.xml └── worlds └── empty.world /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *Issue #, if available:* 2 | 3 | *Description of changes:* 4 | 5 | 6 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. 7 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: "Lint helloworld-sample-application-ros1" 2 | on: 3 | pull_request: 4 | 5 | jobs: 6 | ament_lint: 7 | runs-on: ubuntu-latest 8 | container: 9 | image: rostooling/setup-ros-docker:ubuntu-focal-ros-rolling-ros-base-latest 10 | strategy: 11 | fail-fast: false 12 | matrix: 13 | linter: [flake8, pep257, xmllint, copyright] 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: ros-tooling/action-ros-lint@v0.1 17 | with: 18 | distribution: rolling 19 | linter: ${{ matrix.linter }} 20 | package-name: | 21 | hello_world_simulation 22 | hello_world_robot -------------------------------------------------------------------------------- /.github/workflows/ros1.yml: -------------------------------------------------------------------------------- 1 | name: build-and-bundle 2 | on: 3 | pull_request: 4 | push: 5 | branches: 6 | - ros1 7 | schedule: 8 | - cron: '0 */2 * * *' # runs every 2 hrs on a daily basis 9 | 10 | jobs: 11 | build_and_bundle_ros1: 12 | strategy: 13 | matrix: 14 | distro: ['melodic'] 15 | gazebo: [9] 16 | include: 17 | - distro: melodic 18 | gazebo: 9 19 | ubuntu_distro: bionic 20 | runs-on: ubuntu-latest 21 | if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/ros2' }} 22 | name: 'Build and Bundle (ROS1)' 23 | container: 24 | image: ubuntu:${{ matrix.ubuntu_distro }} 25 | outputs: 26 | robot_ws_build_result: ${{ steps.robot_ws_build.outcome }} 27 | simulation_ws_build_result: ${{ steps.simulation_ws_build.outcome }} 28 | steps: 29 | - name: Checkout Branch 30 | uses: actions/checkout@v1 31 | - name: Scan using git-secrets 32 | uses: aws-robotics/aws-robomaker-github-actions/git-secrets-scan-action@3.0.6 33 | - id: robot_ws_build 34 | name: Build and Bundle Robot Workspace 35 | uses: aws-robotics/aws-robomaker-github-actions/robomaker-sample-app-ci@3.0.8 36 | with: 37 | ros-distro: ${{ matrix.distro }} 38 | workspace-dir: robot_ws 39 | generate-sources: true 40 | retries: 5 41 | - id: simulation_ws_build 42 | name: Build and Bundle Simulation Workspace 43 | uses: aws-robotics/aws-robomaker-github-actions/robomaker-sample-app-ci@3.0.8 44 | with: 45 | ros-distro: ${{ matrix.distro }} 46 | workspace-dir: simulation_ws 47 | retries: 5 48 | - name: Configure AWS Credentials 49 | uses: aws-actions/configure-aws-credentials@v1.5.4 50 | with: 51 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_ROS1 }} 52 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ROS1 }} 53 | aws-region: ${{ secrets.AWS_REGION }} 54 | if: ${{ github.event_name == 'schedule' && contains(steps.robot_ws_build.outcome, 'success') && contains(steps.simulation_ws_build.outcome, 'success') }} 55 | - id: upload_bundle 56 | name: Upload bundle to S3 57 | uses: aws-robotics/aws-robomaker-github-actions/s3-cp-action@3.0.6 58 | env: 59 | AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_ROS1 }} 60 | AWS_REGION: ${{ secrets.AWS_REGION }} 61 | FILES: 'sources.zip sources.tar.gz robot_ws.tar simulation_ws.tar' 62 | DEST: 'travis/hello-world/${{ matrix.distro }}/gazebo${{ matrix.gazebo }}/${{ steps.robot_ws_build.outputs.sample-app-version }}.${{ github.run_number }}/' 63 | if: ${{ github.event_name == 'schedule' && contains(steps.robot_ws_build.outcome, 'success') && contains(steps.simulation_ws_build.outcome, 'success') }} # upload to S3 on "schedule" build if the build was successful 64 | - name: Get time stamp 65 | id: time 66 | run: echo "::set-output name=timestamp::$(date +%s)" 67 | if: ${{ github.event_name == 'schedule' && contains(steps.robot_ws_build.outcome, 'success') && contains(steps.simulation_ws_build.outcome, 'success') }} 68 | - name: Update App-manifest version number 69 | id: update-app-manifest 70 | uses: aws-robotics/aws-robomaker-github-actions/codecommit-put-file-action@3.0.6 71 | env: 72 | AWS_CODECOMMIT_REPO_NAME: '${{ secrets.AWS_CODECOMMIT_REPO_NAME_PREFIX_HELLO_WORLD }}-${{ matrix.distro }}-gazebo${{ matrix.gazebo }}' 73 | AWS_CODECOMMIT_BRANCH_NAME: ${{ secrets.AWS_CODECOMMIT_BRANCH_NAME_HELLO_WORLD }} 74 | DEST_FILE_CONTENT: '{"application_version": "${{ steps.robot_ws_build.outputs.sample-app-version }}.${{ github.run_number }}", "timestamp":"${{ steps.time.outputs.timestamp }}"}' 75 | DEST_FILE_PATH: '/version.json' 76 | COMMIT_MSG: 'Updating to version ${{ steps.robot_ws_build.outputs.sample-app-version }}.${{ github.run_number }}. Commit for this version bump: ${{ github.sha }}.' 77 | USER_EMAIL: 'ros-contributions@amazon.com' 78 | USER_NAME: 'ros-contributions' 79 | if: ${{ github.event_name == 'schedule' && contains(steps.robot_ws_build.outcome, 'success') && contains(steps.simulation_ws_build.outcome, 'success') }} # Update app-manifest version number if the build was successful 80 | 81 | log_workflow_status_to_cloudwatch: 82 | runs-on: ubuntu-latest 83 | container: 84 | image: ubuntu:bionic 85 | needs: 86 | - build_and_bundle_ros1 87 | if: ${{ always() && github.event_name != 'pull_request' }} 88 | steps: 89 | - name: Configure AWS Credentials 90 | uses: aws-actions/configure-aws-credentials@v1.5.4 91 | with: 92 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_ROS1 }} 93 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ROS1 }} 94 | aws-region: ${{ secrets.AWS_REGION }} 95 | - name: Log Robot Workspace Build Status 96 | uses: ros-tooling/action-cloudwatch-metrics@0.0.4 97 | with: 98 | namespace: RobotWorkspaceBuild 99 | metric-value: ${{ contains(needs.build_and_bundle_ros1.outputs.robot_ws_build_result, 'success') }} 100 | - name: Log Simulation Workspace Build Status 101 | uses: ros-tooling/action-cloudwatch-metrics@0.0.4 102 | with: 103 | namespace: SimulationWorkspaceBuild 104 | metric-value: ${{ contains(needs.build_and_bundle_ros1.outputs.simulation_ws_build_result, 'success') }} 105 | - name: Log Bundle Upload Status 106 | uses: ros-tooling/action-cloudwatch-metrics@0.0.4 107 | with: 108 | namespace: BundleUpload 109 | metric-value: ${{ contains(needs.build_and_bundle_ros1.result, 'success') }} 110 | if: ${{ github.event_name == 'schedule' }} 111 | -------------------------------------------------------------------------------- /.github/workflows/ros2.yml: -------------------------------------------------------------------------------- 1 | name: build-and-bundle 2 | on: 3 | pull_request: 4 | push: 5 | branches: 6 | - ros2 7 | schedule: 8 | - cron: '0 */2 * * *' # runs every 2 hrs on a daily basis 9 | 10 | jobs: 11 | build_and_bundle_ros2: 12 | strategy: 13 | matrix: 14 | distro: ['foxy'] 15 | gazebo: [11] 16 | include: 17 | - distro: foxy 18 | gazebo: 11 19 | ubuntu_distro: focal 20 | runs-on: ubuntu-latest 21 | if: ${{ github.event_name == 'schedule' || github.ref == 'refs/heads/ros2' }} 22 | name: 'Build and Bundle (ROS2)' 23 | container: 24 | image: ubuntu:${{ matrix.ubuntu_distro }} 25 | outputs: 26 | robot_ws_build_result: ${{ steps.robot_ws_build.outcome }} 27 | simulation_ws_build_result: ${{ steps.simulation_ws_build.outcome }} 28 | steps: 29 | - name: Checkout Branch 30 | uses: actions/checkout@v1 31 | with: 32 | ref: 'ros2' 33 | - name: Scan using git-secrets 34 | uses: aws-robotics/aws-robomaker-github-actions/git-secrets-scan-action@3.0.6 35 | - id: robot_ws_build 36 | name: Build and Bundle Robot Workspace 37 | uses: aws-robotics/aws-robomaker-github-actions/robomaker-sample-app-ci@3.0.6 38 | with: 39 | ros-distro: ${{ matrix.distro }} 40 | workspace-dir: robot_ws 41 | generate-sources: true 42 | retries: 3 43 | - id: simulation_ws_build 44 | name: Build and Bundle Simulation Workspace 45 | uses: aws-robotics/aws-robomaker-github-actions/robomaker-sample-app-ci@3.0.6 46 | with: 47 | ros-distro: ${{ matrix.distro }} 48 | workspace-dir: simulation_ws 49 | retries: 3 50 | - name: Configure AWS Credentials 51 | uses: aws-actions/configure-aws-credentials@v1.5.4 52 | with: 53 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_ROS2 }} 54 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ROS2 }} 55 | aws-region: ${{ secrets.AWS_REGION }} 56 | if: ${{ github.event_name == 'schedule' && contains(steps.robot_ws_build.outcome, 'success') && contains(steps.simulation_ws_build.outcome, 'success') }} 57 | - id: upload_bundle 58 | name: Upload bundle to S3 59 | uses: aws-robotics/aws-robomaker-github-actions/s3-cp-action@3.0.6 60 | env: 61 | AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_ROS2 }} 62 | AWS_REGION: ${{ secrets.AWS_REGION }} 63 | FILES: 'sources.zip sources.tar.gz robot_ws.tar simulation_ws.tar' 64 | DEST: 'travis/hello-world/${{ matrix.distro }}/gazebo${{ matrix.gazebo }}/${{ steps.robot_ws_build.outputs.sample-app-version }}.${{ github.run_number }}/' 65 | if: ${{ github.event_name == 'schedule' && contains(steps.robot_ws_build.outcome, 'success') && contains(steps.simulation_ws_build.outcome, 'success') }} # upload to S3 on "schedule" build if the build was successful 66 | - name: Get time stamp 67 | id: time 68 | run: echo "::set-output name=timestamp::$(date +%s)" 69 | if: ${{ github.event_name == 'schedule' && contains(steps.robot_ws_build.outcome, 'success') && contains(steps.simulation_ws_build.outcome, 'success') }} 70 | - name: Update App-manifest version number 71 | id: update-app-manifest 72 | uses: aws-robotics/aws-robomaker-github-actions/codecommit-put-file-action@3.0.6 73 | env: 74 | AWS_CODECOMMIT_REPO_NAME: '${{ secrets.AWS_CODECOMMIT_REPO_NAME_PREFIX_HELLO_WORLD }}-${{ matrix.distro }}-gazebo${{ matrix.gazebo }}' 75 | AWS_CODECOMMIT_BRANCH_NAME: ${{ secrets.AWS_CODECOMMIT_BRANCH_NAME_HELLO_WORLD }} 76 | DEST_FILE_CONTENT: '{"application_version": "${{ steps.robot_ws_build.outputs.sample-app-version }}.${{ github.run_number }}", "timestamp":"${{ steps.time.outputs.timestamp }}"}' 77 | DEST_FILE_PATH: '/version.json' 78 | COMMIT_MSG: 'Updating to version ${{ steps.robot_ws_build.outputs.sample-app-version }}.${{ github.run_number }}. Commit for this version bump: ${{ github.sha }}.' 79 | USER_EMAIL: 'ros-contributions@amazon.com' 80 | USER_NAME: 'ros-contributions' 81 | if: ${{ github.event_name == 'schedule' && contains(steps.robot_ws_build.outcome, 'success') && contains(steps.simulation_ws_build.outcome, 'success') }} # Update app-manifest version number if the build was successful 82 | 83 | 84 | 85 | log_workflow_status_to_cloudwatch: 86 | runs-on: ubuntu-latest 87 | container: 88 | image: ubuntu:focal 89 | needs: 90 | - build_and_bundle_ros2 91 | if: ${{ always() && github.event_name != 'pull_request' }} 92 | steps: 93 | - name: Configure AWS Credentials 94 | uses: aws-actions/configure-aws-credentials@v1.5.4 95 | with: 96 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_ROS2 }} 97 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ROS2 }} 98 | aws-region: ${{ secrets.AWS_REGION }} 99 | - name: Log Robot Workspace Build Status 100 | uses: ros-tooling/action-cloudwatch-metrics@0.0.4 101 | with: 102 | metric-dimensions: >- 103 | [ 104 | { "Name": "github.event_name", "Value": "${{ github.event_name }}" }, 105 | { "Name": "github.ref", "Value": "refs/heads/ros2" }, 106 | { "Name": "github.repository", "Value": "${{ github.repository }}" } 107 | ] 108 | namespace: RobotWorkspaceBuild 109 | metric-value: ${{ contains(needs.build_and_bundle_ros2.outputs.robot_ws_build_result, 'success') }} 110 | - name: Log Simulation Workspace Build Status 111 | uses: ros-tooling/action-cloudwatch-metrics@0.0.4 112 | with: 113 | metric-dimensions: >- 114 | [ 115 | { "Name": "github.event_name", "Value": "${{ github.event_name }}" }, 116 | { "Name": "github.ref", "Value": "refs/heads/ros2" }, 117 | { "Name": "github.repository", "Value": "${{ github.repository }}" } 118 | ] 119 | namespace: SimulationWorkspaceBuild 120 | metric-value: ${{ contains(needs.build_and_bundle_ros2.outputs.simulation_ws_build_result, 'success') }} 121 | - name: Log Bundle Upload Status 122 | uses: ros-tooling/action-cloudwatch-metrics@0.0.4 123 | with: 124 | metric-dimensions: >- 125 | [ 126 | { "Name": "github.event_name", "Value": "${{ github.event_name }}" }, 127 | { "Name": "github.ref", "Value": "refs/heads/ros2" }, 128 | { "Name": "github.repository", "Value": "${{ github.repository }}" } 129 | ] 130 | namespace: BundleUpload 131 | metric-value: ${{ contains(needs.build_and_bundle_ros2.result, 'success') }} 132 | if: ${{ github.event_name == 'schedule' }} 133 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/build 2 | **/log 3 | **/install 4 | **/bundle 5 | **/deps -------------------------------------------------------------------------------- /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](https://github.com/aws/aws-robomaker-sample-application-helloworld/issues), or [recently closed](https://github.com/aws/aws-robomaker-sample-application-helloworld/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), 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 *master* 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'](https://github.com/aws/aws-robomaker-sample-application-helloworld/labels/help%20wanted) 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](https://github.com/aws/aws-robomaker-sample-application-helloworld/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 60 | 61 | We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. 62 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # ======== ROS/Colcon Dockerfile ======== 2 | # This sample Dockerfile will build a Docker image for AWS RoboMaker 3 | # in any ROS workspace where all of the dependencies are managed by rosdep. 4 | # 5 | # Adapt the file below to include your additional dependencies/configuration outside of rosdep. 6 | # ======================================= 7 | 8 | # ==== Arguments ==== 9 | # Override the below arguments to match your application configuration. 10 | # =================== 11 | 12 | # ROS Distribution (ex: melodic, foxy, etc.) 13 | ARG ROS_DISTRO=melodic 14 | # Application Name (ex: helloworld) 15 | ARG APP_NAME=robomaker_app 16 | # Path to workspace directory on the host (ex: ./robot_ws) 17 | ARG LOCAL_WS_DIR=workspace 18 | # User to create and use (default: robomaker) 19 | ARG USERNAME=robomaker 20 | # The gazebo version to use if applicable (ex: gazebo-9, gazebo-11) 21 | ARG GAZEBO_VERSION=gazebo-9 22 | # Where to store the built application in the runtime image. 23 | ARG IMAGE_WS_DIR=/home/$USERNAME/workspace 24 | 25 | # ======== ROS Build Stages ======== 26 | # ${ROS_DISTRO}-ros-base 27 | # -> ros-robomaker-base 28 | # -> ros-robomaker-application-base 29 | # -> ros-robomaker-build-stage 30 | # -> ros-robomaker-app-runtime-image 31 | # ================================== 32 | 33 | # ==== ROS Base Image ============ 34 | # If running in production, you may choose to build the ROS base image 35 | # from the source instruction-set to prevent impact from upstream changes. 36 | # ARG UBUNTU_DISTRO=focal 37 | # FROM public.ecr.aws/lts/ubuntu:${UBUNTU_DISTRO} as ros-base 38 | # Instruction for each ROS release maintained by OSRF can be found here: https://github.com/osrf/docker_images 39 | # ================================== 40 | 41 | # ==== Build Stage with AWS RoboMaker Dependencies ==== 42 | # This stage creates the robomaker user and installs dependencies required to run applications in RoboMaker. 43 | # ================================== 44 | 45 | FROM public.ecr.aws/docker/library/ros:${ROS_DISTRO}-ros-base AS ros-robomaker-base 46 | ARG USERNAME 47 | ARG IMAGE_WS_DIR 48 | 49 | RUN apt-get clean 50 | RUN apt-get update && apt-get install -y \ 51 | lsb \ 52 | unzip \ 53 | wget \ 54 | curl \ 55 | xterm \ 56 | python3-colcon-common-extensions \ 57 | devilspie \ 58 | xfce4-terminal 59 | 60 | RUN groupadd $USERNAME && \ 61 | useradd -ms /bin/bash -g $USERNAME $USERNAME && \ 62 | sh -c 'echo "$USERNAME ALL=(root) NOPASSWD:ALL" >> /etc/sudoers' 63 | 64 | USER $USERNAME 65 | WORKDIR /home/$USERNAME 66 | 67 | RUN mkdir -p $IMAGE_WS_DIR 68 | 69 | # ==== ROS Application Base ==== 70 | # This section installs exec dependencies for your ROS application. 71 | # Note: Make sure you have defined 'exec' and 'build' dependencies correctly in your package.xml files. 72 | # ======================================== 73 | FROM ros-robomaker-base as ros-robomaker-application-base 74 | ARG LOCAL_WS_DIR 75 | ARG IMAGE_WS_DIR 76 | ARG ROS_DISTRO 77 | ARG USERNAME 78 | 79 | WORKDIR $IMAGE_WS_DIR 80 | COPY --chown=$USERNAME:$USERNAME $LOCAL_WS_DIR/src $IMAGE_WS_DIR/src 81 | 82 | RUN sudo apt update && \ 83 | rosdep update && \ 84 | rosdep fix-permissions 85 | 86 | # Note: This will install all dependencies. 87 | # You could further optimize this by only defining the exec dependencies. 88 | # Then, install the build dependencies in the build image. 89 | RUN rosdep install --from-paths src --ignore-src -r -y 90 | 91 | # ==== ROS Workspace Build Stage ==== 92 | # In this stage, we will install copy source files, install build dependencies and run a build. 93 | # =================================== 94 | FROM ros-robomaker-application-base AS ros-robomaker-build-stage 95 | LABEL build_step="${APP_NAME}Workspace_Build" 96 | ARG APP_NAME 97 | ARG LOCAL_WS_DIR 98 | ARG IMAGE_WS_DIR 99 | 100 | RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ 101 | colcon build \ 102 | --install-base $IMAGE_WS_DIR/$APP_NAME 103 | 104 | # ==== ROS Robot Runtime Image ==== 105 | # In the final stage, we will copy the staged install directory to the runtime image. 106 | # ================================= 107 | FROM ros-robomaker-application-base AS ros-robomaker-app-runtime-image 108 | ARG APP_NAME 109 | ARG USERNAME 110 | ARG GAZEBO_VERSION 111 | 112 | ENV USERNAME=$USERNAME 113 | ENV APP_NAME=$APP_NAME 114 | ENV GAZEBO_VERSION=$GAZEBO_VERSION 115 | 116 | RUN rm -rf $IMAGE_WS_DIR/src 117 | 118 | COPY --from=ros-robomaker-build-stage $IMAGE_WS_DIR/$APP_NAME $IMAGE_WS_DIR/$APP_NAME 119 | 120 | # Add the application source file to the entrypoint. 121 | WORKDIR / 122 | COPY entrypoint.sh /entrypoint.sh 123 | RUN sudo chmod +x /entrypoint.sh && \ 124 | sudo chown -R $USERNAME /entrypoint.sh && \ 125 | sudo chown -R $USERNAME $IMAGE_WS_DIR/$APP_NAME 126 | 127 | ENTRYPOINT ["/entrypoint.sh"] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 4 | software and associated documentation files (the "Software"), to deal in the Software 5 | without restriction, including without limitation the rights to use, copy, modify, 6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 7 | permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all setup build build_robot build_simulation bundle bundle_robot bundle_simulation clean clean_robot_build clean_robot_bundle clean_simulation_build clean_simulation_bundle 2 | .DEFAULT_GOAL := all 3 | 4 | all: bundle 5 | 6 | # This forces each step in 'ci' to run in serial, but each step will run all of its commands in parallel 7 | ci: 8 | $(MAKE) setup 9 | $(MAKE) build 10 | $(MAKE) bundle 11 | 12 | setup: 13 | scripts/setup.sh 14 | 15 | build: build_robot build_simulation 16 | 17 | build_robot: 18 | scripts/build.sh ./robot_ws 19 | 20 | build_simulation: 21 | scripts/build.sh ./simulation_ws 22 | 23 | bundle: bundle_robot bundle_simulation 24 | 25 | bundle_robot: build_robot 26 | scripts/bundle.sh ./robot_ws 27 | 28 | bundle_simulation: build_simulation 29 | scripts/bundle.sh ./simulation_ws 30 | 31 | clean: clean_robot_build clean_robot_bundle clean_simulation_build clean_simulation_bundle 32 | 33 | clean_robot_build: 34 | rm -rf ./robot_ws/build ./robot_ws/install 35 | 36 | clean_robot_bundle: 37 | rm -rf ./robot_ws/bundle 38 | 39 | clean_simulation_build: 40 | rm -rf ./simulation_ws/build ./simulation_ws/install 41 | 42 | clean_simulation_bundle: 43 | rm -rf ./simulation_ws/bundle 44 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | This product includes software developed by 4 | Amazon Technologies, Inc (http://www.amazon.com/). 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AWS RoboMaker Sample Application - Hello World 2 | 3 | This demonstrates the structure of a ROS project that works with RoboMaker by creating a robot spinning in an empty world. 4 | 5 | _RoboMaker sample applications include third-party software licensed under open-source licenses and is provided for demonstration purposes only. Incorporation or use of RoboMaker sample applications in connection with your production workloads or a commercial products or devices may affect your legal rights or obligations under the applicable open-source licenses. Source code information can be found [here](https://github.com/aws-robotics/aws-robomaker-sample-application-helloworld)._ 6 | 7 | ## Installing Requirements 8 | 9 | The following will be installed: 10 | - [Colcon](https://colcon.readthedocs.io/en/released/user/installation.html) - Used for building and bundling the application. 11 | - [vcstool](https://github.com/dirk-thomas/vcstool#how-to-install-vcstool) - Used to pull in sample app dependencies that are only available from source, not from apt or pip. 12 | - [rosdep](http://wiki.ros.org/rosdep#Installing_rosdep) - rosdep is a command-line tool for installing system dependencies of ROS packages. 13 | - [ROS Melodic](http://wiki.ros.org/melodic/Installation/Ubuntu) - Other versions may work, however they have not been tested. ROS installation will be skipped if a ROS distro is already installed. 14 | 15 | ```bash 16 | source scripts/setup.sh 17 | ``` 18 | 19 | ## Build 20 | 21 | - *Robot Application* 22 | ```bash 23 | cd robot_ws 24 | colcon build 25 | ``` 26 | 27 | - *Simulation Application* 28 | ```bash 29 | cd simulation_ws 30 | colcon build 31 | ``` 32 | 33 | ## Run 34 | The `TURTLEBOT3_MODEL` environment variable is optional when running both robot and simulation application. Default value is `waffle_pi`. Valid values are `burger`, `waffle`, and `waffle_pi`. Set it by 35 | 36 | ```bash 37 | export TURTLEBOT3_MODEL= 38 | ``` 39 | 40 | Launch the application with the following commands: 41 | 42 | - *Running Robot Application on a Robot* 43 | ```bash 44 | source robot_ws/install/local_setup.sh 45 | roslaunch hello_world_robot deploy_rotate.launch 46 | ``` 47 | 48 | - *Running Robot Application in a Simulation* 49 | ```bash 50 | source robot_ws/install/local_setup.sh 51 | roslaunch hello_world_robot rotate.launch 52 | ``` 53 | 54 | - *Running Simulation Application* 55 | ```bash 56 | source simulation_ws/install/local_setup.sh 57 | roslaunch hello_world_simulation empty_world.launch 58 | ``` 59 | 60 | Note that when running robot applications on a robot, `use_sim_time` should be set to `false` (which is the default value in `deploy_rotate.launch.py`). When running robot applications along with simulation applications, `use_sim_time` should be set to `true` for both applications (which is the default value in both `rotate.launch.py` and `empty_word.launch.py`). 61 | 62 | When running simulation applications, run command with `gui:=true` to run gazebo client for visualization 63 | 64 | ## Run with a WorldForge world 65 | 66 | After exporting a world from WorldForge, we can unzip the content and move under simulation_ws package: 67 | 68 | ```bash 69 | unzip exported_world.zip 70 | mv aws_robomaker_worldforge_pkgs simulation_ws/src/ 71 | ``` 72 | 73 | Build it again 74 | 75 | ```bash 76 | cd simulation_ws 77 | colcon build 78 | ``` 79 | 80 | Launch the application with the following commands: 81 | 82 | ```bash 83 | source simulation_ws/install/local_setup.sh 84 | roslaunch hello_world_simulation worldforge_world.launch 85 | ``` 86 | 87 | By default, WorldForge packages will load the exported world. To override, specify the environment variable `WORLD_ID`. 88 | 89 | ```bash 90 | # use worldId found in "src/aws_robomaker_worldforge_worlds/worlds" 91 | # e.g, generation_05wq8sybdcn2_world_1 92 | export WORLD_ID= 93 | ``` 94 | 95 | ## Using this sample with RoboMaker 96 | 97 | You first need to install [Docker](https://docs.docker.com/get-docker/) and [VCS Import Tool](http://wiki.ros.org/vcstool) (if you use VCS Import Tool). Python 3.5 or above is required. 98 | 99 | ```bash 100 | pip3 install vcstool 101 | ``` 102 | 103 | After Docker and VCS Import Tool is installed you need to build your robot or simulation docker images: 104 | 105 | ```bash 106 | # Import dependencies defined in .rosinstall to each source directory using vcs import 107 | vcs import robot_ws < robot_ws/.rosinstall 108 | vcs import simulation_ws < simulation_ws/.rosinstall 109 | 110 | # Building Robot Application Docker Image 111 | DOCKER_BUILDKIT=1 docker build . \ 112 | --build-arg ROS_DISTRO=melodic \ 113 | --build-arg LOCAL_WS_DIR=./robot_ws \ 114 | --build-arg APP_NAME=helloworld-robot-app \ 115 | -t robomaker-helloworld-robot-app 116 | 117 | # Building Simulation Application Docker Image 118 | DOCKER_BUILDKIT=1 docker build . \ 119 | --build-arg GAZEBO_VERSION=gazebo-9 \ 120 | --build-arg ROS_DISTRO=melodic \ 121 | --build-arg LOCAL_WS_DIR=./simulation_ws \ 122 | --build-arg APP_NAME=helloworld-sim-app \ 123 | -t robomaker-helloworld-sim-app 124 | ``` 125 | 126 | This produces the Docker Images `robomaker-helloworld-robot-app` and `robomaker-helloworld-sim-app` respectively which you can view by running: 127 | 128 | ```bash 129 | # Listing your Docker Images 130 | docker images 131 | ``` 132 | 133 | You'll need to [upload these images to Amazon ECR](https://docs.aws.amazon.com/robomaker/latest/dg/development-publish-app-containers.html), then you can use these files to 134 | [create a robot application](https://docs.aws.amazon.com/robomaker/latest/dg/create-robot-application.html), 135 | [create a simulation application](https://docs.aws.amazon.com/robomaker/latest/dg/create-simulation-application.html), 136 | and [create a simulation job](https://docs.aws.amazon.com/robomaker/latest/dg/create-simulation-job.html) in RoboMaker. Visit the [preparing-ros-application-and-simulation-containers-for-aws-robomaker](https://aws.amazon.com/blogs/robotics/preparing-ros-application-and-simulation-containers-for-aws-robomaker/#:~:text=Bash-,Publish%20docker%20images%20to%20Amazon%20ECR,-Containers%20used%20by) blog post to find the steps to upload these docker images to Amazon ECR. 137 | 138 | ## ROS Nodes launched by this Sample 139 | 140 | ### Nodes created by this sample 141 | 142 | ``` 143 | /rotate 144 | ``` 145 | 146 | ## ROS Topics used by this Sample 147 | 148 | ``` 149 | /clock 150 | /cmd_vel 151 | ``` 152 | 153 | ## License 154 | 155 | MIT-0 - See LICENSE for further information 156 | 157 | ## How to Contribute 158 | 159 | Create issues and pull requests against this Repository on Github 160 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | source "/home/$USERNAME/workspace/$APP_NAME/setup.bash" 4 | if [[ -f "/usr/share/$GAZEBO_VERSION/setup.sh" ]] 5 | then 6 | source /usr/share/$GAZEBO_VERSION/setup.sh 7 | fi 8 | printenv 9 | exec "${@:1}" -------------------------------------------------------------------------------- /roboMakerSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "runConfigurations": [{ 3 | "id": "HelloWorld_Cfg01", 4 | "name": "HelloWorld Robot", 5 | "type": "colcon build", 6 | "cfg": { 7 | "workingDir": "./HelloWorld/robot_ws", 8 | "cmdArgs": "" 9 | } 10 | }, { 11 | "id": "HelloWorld_Cfg02", 12 | "name": "HelloWorld Robot", 13 | "type": "colcon bundle", 14 | "cfg": { 15 | "workingDir": "./HelloWorld/robot_ws", 16 | "cmdArgs": "" 17 | } 18 | }, { 19 | "id": "HelloWorld_Cfg03", 20 | "name": "HelloWorld Simulation", 21 | "type": "colcon build", 22 | "cfg": { 23 | "workingDir": "./HelloWorld/simulation_ws", 24 | "cmdArgs": "" 25 | } 26 | }, { 27 | "id": "HelloWorld_Cfg04", 28 | "name": "HelloWorld Simulation", 29 | "type": "colcon bundle", 30 | "cfg": { 31 | "workingDir": "./HelloWorld/simulation_ws", 32 | "cmdArgs": "" 33 | } 34 | }, { 35 | "id": "HelloWorld_SimulationJob1", 36 | "name": "HelloWorld", 37 | "type": "simulation", 38 | "cfg": { 39 | "robotApp": { 40 | "name": "RoboMakerHelloWorldRobot", 41 | "s3Bucket": "", 42 | "sourceBundleFile": "./HelloWorld/robot_ws/bundle/output.tar", 43 | "architecture": "X86_64", 44 | "robotSoftwareSuite": { 45 | "version": "", 46 | "name": "ROS" 47 | }, 48 | "launchConfig": { 49 | "packageName": "hello_world_robot", 50 | "launchFile": "rotate.launch", 51 | "environmentVariables": { 52 | "TURTLEBOT3_MODEL": "waffle_pi" 53 | } 54 | } 55 | }, 56 | "simulationApp": { 57 | "name": "RoboMakerHelloWorldSimulation", 58 | "s3Bucket": "", 59 | "sourceBundleFile": "./HelloWorld/simulation_ws/bundle/output.tar", 60 | "architecture": "X86_64", 61 | "launchConfig": { 62 | "packageName": "hello_world_simulation", 63 | "launchFile": "empty_world.launch", 64 | "environmentVariables": { 65 | "TURTLEBOT3_MODEL": "waffle_pi" 66 | } 67 | }, 68 | "robotSoftwareSuite": { 69 | "version": "", 70 | "name": "ROS" 71 | }, 72 | "simulationSoftwareSuite": { 73 | "name": "Gazebo", 74 | "version": "" 75 | }, 76 | "renderingEngine": { 77 | "name": "OGRE", 78 | "version": "1.x" 79 | } 80 | }, 81 | "simulation": { 82 | "outputLocation": "", 83 | "failureBehavior": "Fail", 84 | "maxJobDurationInSeconds": 28800, 85 | "iamRole": "" 86 | } 87 | } 88 | }, 89 | { 90 | "id": "HelloWorld_wf1", 91 | "type": "workflow", 92 | "name": "HelloWorld - Build and Bundle All", 93 | "runCfgIds": ["HelloWorld_Cfg01", "HelloWorld_Cfg02", "HelloWorld_Cfg03", "HelloWorld_Cfg04"] 94 | } 95 | ] 96 | } 97 | -------------------------------------------------------------------------------- /robot_ws/.rosinstall: -------------------------------------------------------------------------------- 1 | - git: {local-name: src/deps/turtlebot3-description-reduced-mesh, uri: "https://github.com/aws-robotics/turtlebot3-description-reduced-mesh.git", version: "ros1"} -------------------------------------------------------------------------------- /robot_ws/src/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2018 Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /robot_ws/src/hello_world_robot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set minimum required version of cmake, project name and compile options 3 | ################################################################################ 4 | cmake_minimum_required(VERSION 2.8.3) 5 | project(hello_world_robot) 6 | 7 | ################################################################################ 8 | # Find catkin packages and libraries for catkin and system dependencies 9 | ################################################################################ 10 | find_package(catkin REQUIRED COMPONENTS 11 | rospy 12 | std_msgs 13 | sensor_msgs 14 | geometry_msgs 15 | nav_msgs 16 | turtlebot3_description # required to install .rviz model 17 | ) 18 | 19 | ################################################################################ 20 | # Setup for python modules and scripts 21 | ################################################################################ 22 | catkin_python_setup() 23 | 24 | ################################################################################ 25 | # Declare ROS messages, services and actions 26 | ################################################################################ 27 | 28 | ################################################################################ 29 | # Declare ROS dynamic reconfigure parameters 30 | ################################################################################ 31 | 32 | ################################################################################ 33 | # Declare catkin specific configuration to be passed to dependent projects 34 | ################################################################################ 35 | catkin_package( 36 | CATKIN_DEPENDS 37 | rospy 38 | std_msgs 39 | sensor_msgs 40 | geometry_msgs 41 | nav_msgs 42 | message_runtime 43 | ) 44 | 45 | ################################################################################ 46 | # Build 47 | ################################################################################ 48 | include_directories( 49 | include 50 | ${catkin_INCLUDE_DIRS} 51 | ) 52 | 53 | ################################################################################ 54 | # Install 55 | ################################################################################ 56 | catkin_install_python(PROGRAMS 57 | nodes/rotate.py 58 | DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} 59 | ) 60 | 61 | install(DIRECTORY launch 62 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 63 | ) 64 | 65 | install(DIRECTORY deploymentScripts 66 | DESTINATION ${CATKIN_GLOBAL_SHARE_DESTINATION} 67 | ) 68 | 69 | # Copy the rviz model for easier access in AWS RoboMaker RViz 70 | install(FILES ${turtlebot3_description_DIR}/../rviz/model.rviz 71 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/rviz 72 | RENAME turtlebot3_model.rviz 73 | ) 74 | ################################################################################ 75 | # Test 76 | ################################################################################ 77 | -------------------------------------------------------------------------------- /robot_ws/src/hello_world_robot/deploymentScripts/post_launch_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a script which can be run after launching the ROS processes. 3 | # You can include a post-check of ROS processes in this post-launch file. 4 | # Non-zero exit status from script would cause robot deployment failure. 5 | # Use "deploymentScripts/post_launch_file.sh" as the postLaunchFile path. 6 | 7 | echo Hello World, post-launch 8 | -------------------------------------------------------------------------------- /robot_ws/src/hello_world_robot/deploymentScripts/pre_launch_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a script which can be run before running the ROS launch file. 3 | # You can include a pre-check of robot environment in this pre-launch file. 4 | # Non-zero exit status from script would cause robot deployment failure. 5 | # Use "deploymentScripts/pre_launch_file.sh" as the preLaunchFile path. 6 | 7 | echo Hello World, pre-launch 8 | -------------------------------------------------------------------------------- /robot_ws/src/hello_world_robot/launch/deploy_rotate.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /robot_ws/src/hello_world_robot/launch/rotate.launch: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /robot_ws/src/hello_world_robot/nodes/rotate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | # software and associated documentation files (the "Software"), to deal in the Software 7 | # without restriction, including without limitation the rights to use, copy, modify, 8 | # merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | # permit persons to whom the Software is furnished to do so. 10 | # 11 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 13 | # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 14 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 15 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 16 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | 18 | 19 | from geometry_msgs.msg import Twist 20 | 21 | import rospy 22 | 23 | 24 | class Rotator(): 25 | 26 | def __init__(self): 27 | self._cmd_pub = rospy.Publisher('/cmd_vel', Twist, queue_size=1) 28 | 29 | def rotate_forever(self): 30 | self.twist = Twist() 31 | 32 | r = rospy.Rate(10) 33 | while not rospy.is_shutdown(): 34 | self.twist.angular.z = 0.1 35 | self._cmd_pub.publish(self.twist) 36 | rospy.loginfo('Rotating robot: %s', self.twist) 37 | r.sleep() 38 | 39 | 40 | def main(): 41 | rospy.init_node('rotate') 42 | try: 43 | rotator = Rotator() 44 | rotator.rotate_forever() 45 | except rospy.ROSInterruptException: 46 | pass 47 | 48 | 49 | if __name__ == '__main__': 50 | main() 51 | -------------------------------------------------------------------------------- /robot_ws/src/hello_world_robot/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | hello_world_robot 4 | 1.4.1 5 | 6 | AWS RoboMaker robot package with a rotating Turtlebot3 7 | 8 | MIT 9 | AWS RoboMaker 10 | AWS RoboMaker 11 | catkin 12 | rospy 13 | actionlib 14 | interactive_markers 15 | std_msgs 16 | sensor_msgs 17 | geometry_msgs 18 | nav_msgs 19 | visualization_msgs 20 | actionlib_msgs 21 | robot_state_publisher 22 | turtlebot3_msgs 23 | turtlebot3_description 24 | turtlebot3_description_reduced_mesh 25 | xacro 26 | message_generation 27 | message_runtime 28 | message_runtime 29 | turtlebot3_bringup 30 | 31 | -------------------------------------------------------------------------------- /robot_ws/src/hello_world_robot/setup.py: -------------------------------------------------------------------------------- 1 | # ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD 2 | # See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html 3 | 4 | from distutils.core import setup 5 | 6 | from catkin_pkg.python_setup import generate_distutils_setup 7 | 8 | # fetch values from package.xml 9 | setup_args = generate_distutils_setup( 10 | packages=['hello_world_robot'], 11 | package_dir={'': 'src'} 12 | ) 13 | 14 | setup(**setup_args) 15 | -------------------------------------------------------------------------------- /robot_ws/src/hello_world_robot/src/hello_world_robot/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-robotics/aws-robomaker-sample-application-helloworld/b2a2143653ca41dcc41d18de0b9da93ad2bb04e2/robot_ws/src/hello_world_robot/src/hello_world_robot/__init__.py -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | COLCON_LOG_PATH="$@/logs" colcon build --base-paths "$@" --build-base "$@/build" --install-base "$@/install" 4 | -------------------------------------------------------------------------------- /scripts/bundle.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | COLCON_LOG_PATH="$@/logs" colcon bundle --base-paths "$@" --build-base "$@/build" --install-base "$@/install" --bundle-base "$@/bundle" 4 | -------------------------------------------------------------------------------- /scripts/setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -ex 3 | 4 | while [[ "$#" -gt 0 ]]; do 5 | case $1 in 6 | --install-ros) ros_distro=$2; shift ;; 7 | esac 8 | shift 9 | done 10 | 11 | supported_ros_distros=("melodic") 12 | 13 | install_ros(){ 14 | echo "Installing ROS $ros_distro" 15 | #Install ROS Prerequisites 16 | apt update 17 | apt-get install -y lsb-release gnupg2 curl && apt-get clean all 18 | rm -f "/etc/apt/sources.list.d/ros-latest.list" 19 | sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' 20 | apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 21 | curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | apt-key add - 22 | apt update 23 | 24 | #Install ROS $ros_distro 25 | apt install -y ros-$ros_distro-desktop-full 26 | source /opt/ros/$ros_distro/setup.bash 27 | } 28 | 29 | 30 | setup_sample_app(){ 31 | echo "Setting up sample application. Installing tools and dependencies." 32 | #setup key for colcon bundle 33 | apt-key adv --fetch-keys 'http://packages.osrfoundation.org/gazebo.key' 34 | apt update 35 | apt install -y python-rosdep git 36 | if [ ! -f "/etc/ros/rosdep/sources.list.d/20-default.list" ]; 37 | then 38 | rosdep init 39 | fi 40 | rosdep update 41 | 42 | apt-get install -y python3-apt python3-pip python3-vcstool 43 | pip3 install -U setuptools colcon-common-extensions colcon-ros-bundle 44 | 45 | cd robot_ws 46 | vcs import < .rosinstall 47 | rosdep install --from-paths src --ignore-src -r -y 48 | cd .. 49 | 50 | cd simulation_ws 51 | vcs import < .rosinstall 52 | rosdep install --from-paths src --ignore-src -r -y 53 | # need to install pyparsing==2.0.2 at the end to make sure that it overwrites 54 | # pyparsing-3.0 to make sure colcon build works 55 | pip3 install -U pyparsing==2.0.2 56 | cd .. 57 | } 58 | 59 | if [ -d "/opt/ros" ]; 60 | then 61 | echo "A ROS installation already exists in your environment." 62 | if [ ! -z "$ros_distro" ]; 63 | then 64 | echo "Ignoring request to install $ros_distro because a ROS installation already exists in your environment." 65 | fi 66 | 67 | found_supported_ros=false 68 | #check if their ros installation(s) are supported 69 | for distro in $supported_ros_distros 70 | do 71 | if [ -d "/opt/ros/$distro" ] 72 | then 73 | source /opt/ros/$distro/setup.bash 74 | #save to verify installation below 75 | ros_distro=$distro 76 | found_supported_ros=true 77 | break 78 | fi 79 | done 80 | 81 | #if supported versions are not found 82 | if [ ! found_supported_ros ] 83 | then 84 | echo "ERROR: your installed ROS Distro(s) is not supported. Exiting." 85 | exit 1 86 | fi 87 | 88 | elif [ -z "$ros_distro" ]; 89 | then 90 | echo "No ROS Installation was found and no ROS Distro was specified. Defaulting to installing ROS Melodic" 91 | ros_distro="melodic" 92 | install_ros 93 | source /opt/ros/$ros_distro/setup.bash 94 | elif [[ " ${supported_ros_distros[@]} " =~ " ${ros_distro} " ]]; #check if item in list 95 | then 96 | echo "No ROS Installation found. Installing $ros_distro" 97 | install_ros 98 | source /opt/ros/$ros_distro/setup.bash 99 | elif [[ ! " ${supported_ros_distros[@]} " =~ " ${ros_distro} " ]]; #check if item in list 100 | then 101 | echo "The selected ROS Distro $ros_distro is not supported. Exiting." 102 | exit 0 103 | fi 104 | 105 | #Verify Installation 106 | if [ $ROS_DISTRO != $ros_distro ]; 107 | then 108 | echo "The ROS installation was unsuccessful, Sample Application setup cannot continue. Exiting." 109 | exit 1 110 | else 111 | echo "ROS Installation was successful, continuing with Sample Application setup." 112 | fi 113 | 114 | 115 | setup_sample_app 116 | -------------------------------------------------------------------------------- /simulation_ws/.rosinstall: -------------------------------------------------------------------------------- 1 | - git: {local-name: src/deps/turtlebot3-description-reduced-mesh, uri: "https://github.com/aws-robotics/turtlebot3-description-reduced-mesh.git", version: "ros1"} -------------------------------------------------------------------------------- /simulation_ws/src/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2018 Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /simulation_ws/src/hello_world_simulation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(hello_world_simulation) 3 | 4 | find_package(catkin REQUIRED COMPONENTS 5 | gazebo_ros 6 | turtlebot3_description # required to install .rviz model 7 | ) 8 | 9 | catkin_package(DEPENDS gazebo_ros) 10 | 11 | install(DIRECTORY launch worlds 12 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} 13 | ) 14 | 15 | # Copy the rviz model for easier access in AWS RoboMaker RViz 16 | install(FILES ${turtlebot3_description_DIR}/../rviz/model.rviz 17 | DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/rviz 18 | RENAME turtlebot3_model.rviz 19 | ) 20 | -------------------------------------------------------------------------------- /simulation_ws/src/hello_world_simulation/launch/empty_world.launch: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /simulation_ws/src/hello_world_simulation/launch/view_empty_world.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /simulation_ws/src/hello_world_simulation/launch/worldforge_world.launch: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /simulation_ws/src/hello_world_simulation/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | hello_world_simulation 4 | 1.4.1 5 | 6 | AWS RoboMaker simulation package with a TurtleBot3 in an empty Gazebo world. 7 | 8 | MIT 9 | AWS RoboMaker 10 | AWS RoboMaker 11 | catkin 12 | gazebo_ros 13 | gazebo_plugins 14 | 15 | turtlebot3_description 16 | gazebo 17 | 18 | -------------------------------------------------------------------------------- /simulation_ws/src/hello_world_simulation/worlds/empty.world: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 0.8 -0.75 0.35 0 0.25 2.35 13 | 14 | 15 | 16 | 17 | 18 | model://sun 19 | 20 | 21 | 22 | 23 | model://ground_plane 24 | 25 | 26 | 27 | 1000.0 28 | 0.001 29 | 1 30 | 31 | 32 | quick 33 | 150 34 | 0 35 | 1.400000 36 | 1 37 | 38 | 39 | 0.00001 40 | 0.2 41 | 2000.000000 42 | 0.01000 43 | 44 | 45 | 46 | 47 | 0.4 0.4 0.4 1 48 | 0.7 0.7 0.7 1 49 | true 50 | 51 | 52 | 53 | --------------------------------------------------------------------------------