├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── good-first-issue.md ├── dependabot.yml └── workflows │ ├── ci-check-docs.yml │ ├── ci-format.yaml │ ├── ci-humble.yaml │ ├── ci-rolling.yaml │ └── update-pre-commit.yml ├── .pre-commit-config.yaml ├── Docker ├── Dockerfile └── entrypoint.sh ├── LICENSE ├── README.md ├── doc ├── img │ ├── cart.gif │ ├── gazebo_ros2_control_diff_drive.gif │ ├── gazebo_ros2_control_position.gif │ ├── gripper.gif │ └── moveit2.gif └── index.rst ├── gazebo_ros2_control ├── CHANGELOG.rst ├── CMakeLists.txt ├── README.md ├── gazebo_hardware_plugins.xml ├── include │ └── gazebo_ros2_control │ │ ├── gazebo_ros2_control_plugin.hpp │ │ ├── gazebo_system.hpp │ │ └── gazebo_system_interface.hpp ├── package.xml └── src │ ├── gazebo_ros2_control_plugin.cpp │ └── gazebo_system.cpp └── gazebo_ros2_control_demos ├── CHANGELOG.rst ├── CMakeLists.txt ├── config ├── cart_controller.yaml ├── cart_controller_effort.yaml ├── cart_controller_position.yaml ├── cart_controller_position_with_pids.yaml ├── cart_controller_velocity.yaml ├── config.rviz ├── diff_drive_controller.yaml ├── diff_drive_controller_namespaced.yaml ├── gripper_controller_effort.yaml ├── gripper_controller_position.yaml └── tricycle_drive_controller.yaml ├── examples ├── example_diff_drive.cpp ├── example_effort.cpp ├── example_gripper.cpp ├── example_position.cpp ├── example_position_pid.cpp ├── example_tricycle_drive.cpp └── example_velocity.cpp ├── launch ├── cart_example_effort.launch.py ├── cart_example_position.launch.py ├── cart_example_velocity.launch.py ├── diff_drive.launch.py ├── diff_drive_namespaced.launch.py ├── diff_drive_pair_namespaced.launch.py ├── gripper_mimic_joint_example_effort.launch.py ├── gripper_mimic_joint_example_position.launch.py ├── pendulum_example_effort.launch.py ├── pendulum_example_position.launch.py ├── tricycle_drive.launch.py ├── vertical_cart_example_position_pid.launch.py ├── vertical_cart_example_position_pids_in_yaml.launch.py └── vertical_cart_example_velocity_pid.launch.py ├── package.xml └── urdf ├── test_cart_effort.xacro.urdf ├── test_cart_position.xacro.urdf ├── test_cart_velocity.xacro.urdf ├── test_diff_drive.xacro.urdf ├── test_diff_drive_namespaced.xacro.urdf ├── test_gripper_mimic_joint_effort.xacro.urdf ├── test_gripper_mimic_joint_position.xacro.urdf ├── test_pendulum_effort.xacro.urdf ├── test_pendulum_position.xacro.urdf ├── test_tricycle_drive.xacro.urdf ├── test_vertical_cart_position_pid.xacro.urdf ├── test_vertical_cart_position_pids_in_yaml.xacro.urdf └── test_vertical_cart_velocity_pid.xacro.urdf /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Environment (please complete the following information):** 27 | - OS: [e.g. Ubuntu Noble] 28 | - Version [e.g. Jazzy] 29 | - Anything that may be unusual about your environment 30 | 31 | **Additional context** 32 | Add any other context about the problem here, especially include any modifications to ros2_control that relate to this issue. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/good-first-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Good first issue 3 | about: Create an issue to welcome a new contributor into the community. 4 | title: '' 5 | labels: ["good first issue"] 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Background 11 | 12 | Overview of your issue here. 13 | 14 | ## Instructions 15 | Hi, this is a `good-first-issue` issue. This means we've worked to make it more legible to people who either **haven't contributed to our codebase before, or even folks who haven't contributed to open source before**. 16 | 17 | We're interested in helping you take the first step, and can answer questions and help you out along the way. Note that we're especially interested in contributions from underrepresented groups! 18 | 19 | We know that creating a pull request is the biggest barrier for new contributors. This issue is for you 💝 20 | 21 | If you have contributed before, **consider leaving this PR for someone new**, and looking through our general [bug](https://github.com/ros-controls/ros2_control/labels/bug) issues. Thanks! 22 | 23 | ### 🤔 What you will need to know. 24 | 25 | Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you through the process. 26 | 27 | ### 📋 Step by Step 28 | 29 | - [ ] 🙋 **Claim this issue**: Comment below. If someone else has claimed it, ask if they've opened a pull request already and if they're stuck -- maybe you can help them solve a problem or move it along! 30 | 31 | - [ ] 🗄️ **Create a local workspace** for making your changes and testing [following these instructions](https://docs.ros.org/en/rolling/Tutorials/Workspace/Creating-A-Workspace.html), for Step 3 use "Download Source Code" section with [these instructions](https://control.ros.org/master/doc/getting_started/getting_started.html#building-from-source). 32 | 33 | - [ ] 🍴 **Fork the repository** using the handy button at the top of the repository page and **clone** it into `~/ws_ros2_control/src/ros-controls/ros2_control`, [here is a guide that you can follow](https://guides.github.com/activities/forking/) (You will have to remove or empty the existing `ros2_control` folder before cloning your own fork) 34 | 35 | - [ ] **Checkout a new branch** using `git checkout -b ` 36 | 37 | - [ ] 🤖 **Apply `pre-commit`** auto formatting, by running `pip3 install pre-commit` and running `pre-commit install` in the ros2_control repo. 38 | 39 | - [ ] 💾 **Commit and Push** your changes 40 | 41 | - [ ] 🔀 **Start a Pull Request** to request to merge your code into `master`. There are two ways that you can start a pull request: 42 | 1. If you are not familiar with GitHub or how to create a pull request, [here is a guide you can follow](https://guides.github.com/activities/hello-world/) on how GitHub works. 43 | 44 | - [ ] 🏁 **Done** Ask in comments for a review :) 45 | 46 | ### Is someone else already working on this? 47 | 48 | 🔗- We encourage contributors to link to the original issue in their pull request so all users can easily see if someone's already started on it. 49 | 50 | 👥- **If someone seems stuck, offer them some help!** 51 | 52 | ### 🤔❓ Questions? 53 | 54 | Don’t hesitate to ask questions or to get help if you feel like you are getting stuck. For example leave a comment below! 55 | Furthermore, you find helpful resources here: 56 | * [ROS 2 Control Contribution Guide](https://control.ros.org/master/doc/contributing/contributing.html) 57 | * [ROS 2 Tutorials](https://docs.ros.org/en/rolling/Tutorials.html) 58 | * [Robotics Stack Exchange](https://robotics.stackexchange.com) 59 | 60 | **Good luck with your first issue!** 61 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | # Workflow files stored in the 10 | # default location of `.github/workflows` 11 | directory: "/" 12 | schedule: 13 | interval: "weekly" 14 | - package-ecosystem: "github-actions" 15 | # Workflow files stored in the 16 | # default location of `.github/workflows` 17 | directory: "/" 18 | schedule: 19 | interval: "weekly" 20 | target-branch: "humble" 21 | -------------------------------------------------------------------------------- /.github/workflows/ci-check-docs.yml: -------------------------------------------------------------------------------- 1 | name: Check Docs 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | 7 | jobs: 8 | check-docs: 9 | name: Check Docs 10 | uses: ros-controls/control.ros.org/.github/workflows/reusable-sphinx-check-single-version.yml@rolling 11 | with: 12 | GAZEBO_ROS2_CONTROL_PR: ${{ github.ref }} 13 | -------------------------------------------------------------------------------- /.github/workflows/ci-format.yaml: -------------------------------------------------------------------------------- 1 | # This is a format job. Pre-commit has a first-party GitHub action, so we use 2 | # that: https://github.com/pre-commit/action 3 | 4 | name: Format 5 | 6 | on: 7 | workflow_dispatch: 8 | pull_request: 9 | 10 | jobs: 11 | pre-commit: 12 | name: Format 13 | runs-on: ubuntu-22.04 14 | steps: 15 | - uses: actions/checkout@v4 16 | - uses: actions/setup-python@v5 17 | with: 18 | python-version: 3.10.6 19 | - name: Install system hooks 20 | run: sudo apt install -qq cppcheck ament-cmake-uncrustify ament-cmake-pep257 21 | - uses: pre-commit/action@v3.0.1 22 | with: 23 | extra_args: --all-files --hook-stage manual 24 | -------------------------------------------------------------------------------- /.github/workflows/ci-humble.yaml: -------------------------------------------------------------------------------- 1 | name: gazebo_ros2_control CI - Humble 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - humble 7 | push: 8 | branches: 9 | - humble 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | container: 15 | image: osrf/ros:humble-desktop 16 | steps: 17 | - uses: actions/checkout@v4 18 | - name: Setup colcon workspace 19 | id: configure 20 | run: | 21 | cd .. 22 | mkdir -p /home/ros2_ws/src 23 | cp -r gazebo_ros2_control /home/ros2_ws/src/ 24 | apt-get update && apt-get upgrade -q -y 25 | apt-get update && apt-get install -q -y --no-install-recommends \ 26 | dirmngr \ 27 | gnupg2 \ 28 | lsb-release \ 29 | python3-colcon-ros 30 | cd /home/ros2_ws/src/ 31 | rosdep update 32 | rosdep install --from-paths ./ -i -y --rosdistro humble \ 33 | --ignore-src 34 | - name: Build project 35 | id: build 36 | run: | 37 | cd /home/ros2_ws/ 38 | . /opt/ros/humble/local_setup.sh 39 | colcon build --packages-up-to gazebo_ros2_control_demos 40 | - name: Run tests 41 | id: test 42 | run: | 43 | cd /home/ros2_ws/ 44 | . /opt/ros/humble/local_setup.sh 45 | colcon test --event-handlers console_direct+ --packages-select gazebo_ros2_control gazebo_ros2_control_demos 46 | colcon test-result 47 | build_testing: 48 | runs-on: ubuntu-latest 49 | container: 50 | image: osrf/ros:humble-desktop 51 | steps: 52 | - uses: actions/checkout@v4 53 | - name: Setup colcon workspace 54 | id: configure 55 | run: | 56 | cd .. 57 | mkdir -p /home/ros2_ws/src 58 | cp -r gazebo_ros2_control /home/ros2_ws/src/ 59 | curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg 60 | sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2-testing/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list' 61 | apt-get update && apt-get upgrade -q -y 62 | apt-get update && apt-get install -q -y --no-install-recommends \ 63 | dirmngr \ 64 | gnupg2 \ 65 | lsb-release \ 66 | python3-colcon-ros 67 | cd /home/ros2_ws/src/ 68 | rosdep update 69 | rosdep install --from-paths ./ -i -y --rosdistro humble \ 70 | --ignore-src 71 | - name: Build project 72 | id: build 73 | run: | 74 | cd /home/ros2_ws/ 75 | . /opt/ros/humble/local_setup.sh 76 | colcon build --packages-up-to gazebo_ros2_control_demos 77 | - name: Run tests 78 | id: test 79 | run: | 80 | cd /home/ros2_ws/ 81 | . /opt/ros/humble/local_setup.sh 82 | colcon test --event-handlers console_direct+ --packages-select gazebo_ros2_control gazebo_ros2_control_demos 83 | colcon test-result 84 | -------------------------------------------------------------------------------- /.github/workflows/ci-rolling.yaml: -------------------------------------------------------------------------------- 1 | name: gazebo_ros2_control - Rolling 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | push: 8 | branches: 9 | - master 10 | 11 | env: 12 | ROS_DISTRO: humble 13 | 14 | jobs: 15 | build: 16 | runs-on: ubuntu-latest 17 | container: 18 | image: osrf/ros:humble-desktop 19 | steps: 20 | - uses: actions/checkout@v4 21 | - name: Setup colcon workspace 22 | id: configure 23 | run: | 24 | apt-get update && apt-get upgrade -q -y 25 | apt-get install -q -y --no-install-recommends \ 26 | dirmngr \ 27 | gnupg2 \ 28 | lsb-release \ 29 | python3-colcon-ros 30 | cd .. 31 | mkdir -p /home/ros2_ws/src 32 | vcs import --input https://raw.githubusercontent.com/ros-controls/ros2_control_ci/master/ros_controls.rolling-on-$ROS_DISTRO.repos /home/ros2_ws/src 33 | rm -rf /home/ros2_ws/src/ros-controls/gazebo_ros2_control 34 | cp -r gazebo_ros2_control /home/ros2_ws/src/ros-controls/ 35 | cd /home/ros2_ws/src/ 36 | rosdep update --rosdistro=$ROS_DISTRO 37 | rosdep install --from-paths ./ -i -y --rosdistro $ROS_DISTRO \ 38 | --ignore-src | grep -E '(executing command)|(Setting up)' 39 | - name: Build project 40 | id: build 41 | run: | 42 | cd /home/ros2_ws/ 43 | . /opt/ros/$ROS_DISTRO/local_setup.sh 44 | colcon build --packages-up-to gazebo_ros2_control_demos 45 | - name: Run tests 46 | id: test 47 | run: | 48 | cd /home/ros2_ws/ 49 | . /opt/ros/$ROS_DISTRO/local_setup.sh 50 | colcon test --event-handlers console_direct+ --packages-select gazebo_ros2_control gazebo_ros2_control_demos 51 | colcon test-result 52 | build_testing: 53 | runs-on: ubuntu-latest 54 | container: 55 | image: osrf/ros:humble-desktop 56 | steps: 57 | - uses: actions/checkout@v4 58 | - name: Setup colcon workspace 59 | id: configure 60 | run: | 61 | curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg 62 | sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2-testing/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list' 63 | apt-get update && apt-get upgrade -q -y 64 | apt-get install -q -y --no-install-recommends \ 65 | dirmngr \ 66 | gnupg2 \ 67 | lsb-release \ 68 | python3-colcon-ros 69 | cd .. 70 | mkdir -p /home/ros2_ws/src 71 | vcs import --input https://raw.githubusercontent.com/ros-controls/ros2_control_ci/master/ros_controls.rolling-on-$ROS_DISTRO.repos /home/ros2_ws/src 72 | rm -rf /home/ros2_ws/src/ros-controls/gazebo_ros2_control 73 | cp -r gazebo_ros2_control /home/ros2_ws/src/ros-controls/ 74 | cd /home/ros2_ws/src/ 75 | rosdep update --rosdistro=$ROS_DISTRO 76 | rosdep install --from-paths ./ -i -y --rosdistro $ROS_DISTRO \ 77 | --ignore-src | grep -E '(executing command)|(Setting up)' 78 | - name: Build project 79 | id: build 80 | run: | 81 | cd /home/ros2_ws/ 82 | . /opt/ros/$ROS_DISTRO/local_setup.sh 83 | colcon build --packages-up-to gazebo_ros2_control_demos 84 | - name: Run tests 85 | id: test 86 | run: | 87 | cd /home/ros2_ws/ 88 | . /opt/ros/$ROS_DISTRO/local_setup.sh 89 | colcon test --event-handlers console_direct+ --packages-select gazebo_ros2_control gazebo_ros2_control_demos 90 | colcon test-result 91 | -------------------------------------------------------------------------------- /.github/workflows/update-pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: Auto Update pre-commit 2 | # Update pre-commit config and create PR if changes are detected 3 | # author: Christoph Fröhlich 4 | 5 | on: 6 | workflow_dispatch: 7 | # schedule: 8 | # - cron: '0 0 1 * *' # Runs at 00:00, on day 1 of the month 9 | 10 | jobs: 11 | auto_update_and_create_pr: 12 | uses: ros-controls/ros2_control_ci/.github/workflows/reusable-update-pre-commit.yml@master 13 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # To use: 2 | # 3 | # pre-commit run -a 4 | # 5 | # Or: 6 | # 7 | # pre-commit install # (runs every time you commit in git) 8 | # 9 | # To update this file: 10 | # 11 | # pre-commit autoupdate 12 | # 13 | # See https://github.com/pre-commit/pre-commit 14 | 15 | repos: 16 | # Standard hooks 17 | - repo: https://github.com/pre-commit/pre-commit-hooks 18 | rev: v5.0.0 19 | hooks: 20 | - id: check-added-large-files 21 | - id: check-ast 22 | - id: check-case-conflict 23 | - id: check-docstring-first 24 | - id: check-merge-conflict 25 | - id: check-symlinks 26 | - id: check-xml 27 | - id: check-yaml 28 | - id: debug-statements 29 | - id: end-of-file-fixer 30 | - id: mixed-line-ending 31 | - id: trailing-whitespace 32 | exclude_types: [rst] 33 | - id: fix-byte-order-marker 34 | 35 | 36 | # Python hooks 37 | - repo: https://github.com/asottile/pyupgrade 38 | rev: v3.19.1 39 | hooks: 40 | - id: pyupgrade 41 | args: [--py36-plus] 42 | 43 | # # PEP 257 44 | - repo: local 45 | hooks: 46 | - id: ament_pep257 47 | name: ament_pep257 48 | description: Format files with pep257. 49 | entry: ament_pep257 50 | language: system 51 | args: ["--ignore=D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404"] 52 | 53 | - repo: https://github.com/pycqa/flake8 54 | rev: 7.1.1 55 | hooks: 56 | - id: flake8 57 | args: ["--extend-ignore=E501"] 58 | 59 | # CPP hooks 60 | - repo: local 61 | hooks: 62 | - id: ament_uncrustify 63 | name: ament_uncrustify 64 | description: Format files with uncrustify. 65 | entry: ament_uncrustify 66 | language: system 67 | files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$ 68 | args: ["--reformat"] 69 | 70 | - repo: local 71 | hooks: 72 | - id: ament_cppcheck 73 | name: ament_cppcheck 74 | description: Static code analysis of C/C++ files. 75 | stages: [pre-commit] 76 | entry: ament_cppcheck 77 | language: system 78 | files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ 79 | 80 | # Maybe use https://github.com/cpplint/cpplint instead 81 | - repo: local 82 | hooks: 83 | - id: ament_cpplint 84 | name: ament_cpplint 85 | description: Static code analysis of C/C++ files. 86 | stages: [pre-commit] 87 | entry: ament_cpplint 88 | language: system 89 | files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$ 90 | args: ["--linelength=100", "--filter=-whitespace/newline"] 91 | 92 | # Cmake hooks 93 | - repo: local 94 | hooks: 95 | - id: ament_lint_cmake 96 | name: ament_lint_cmake 97 | description: Check format of CMakeLists.txt files. 98 | stages: [pre-commit] 99 | entry: ament_lint_cmake 100 | language: system 101 | files: CMakeLists\.txt$ 102 | 103 | # Copyright 104 | - repo: local 105 | hooks: 106 | - id: ament_copyright 107 | name: ament_copyright 108 | description: Check if copyright notice is available in all files. 109 | stages: [pre-commit] 110 | entry: ament_copyright 111 | language: system 112 | 113 | # Docs - RestructuredText hooks 114 | - repo: https://github.com/PyCQA/doc8 115 | rev: v1.1.2 116 | hooks: 117 | - id: doc8 118 | args: ['--max-line-length=100', '--ignore=D001'] 119 | exclude: CHANGELOG\.rst$ 120 | 121 | - repo: https://github.com/pre-commit/pygrep-hooks 122 | rev: v1.10.0 123 | hooks: 124 | - id: rst-backticks 125 | exclude: CHANGELOG\.rst$ 126 | - id: rst-directive-colons 127 | - id: rst-inline-touching-normal 128 | 129 | # Spellcheck in comments and docs 130 | # skipping of *.svg files is not working... 131 | - repo: https://github.com/codespell-project/codespell 132 | rev: v2.4.1 133 | hooks: 134 | - id: codespell 135 | args: ['--write-changes'] 136 | exclude: CHANGELOG\.rst|\.(svg|pyc)$ 137 | 138 | - repo: https://github.com/python-jsonschema/check-jsonschema 139 | rev: 0.31.1 140 | hooks: 141 | - id: check-github-workflows 142 | args: ["--verbose"] 143 | - id: check-github-actions 144 | args: ["--verbose"] 145 | - id: check-dependabot 146 | args: ["--verbose"] 147 | -------------------------------------------------------------------------------- /Docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM osrf/ros:rolling-desktop 2 | 3 | # Make sure everything is up to date before building from source 4 | RUN apt-get update \ 5 | && apt-get upgrade -y \ 6 | && apt-get clean 7 | 8 | RUN apt-get update && apt-get install -q -y --no-install-recommends \ 9 | dirmngr \ 10 | gnupg2 \ 11 | lsb-release \ 12 | python3-colcon-ros \ 13 | && apt-get clean 14 | 15 | RUN mkdir -p /home/ros2_ws/src \ 16 | && cd /home/ros2_ws/src/ \ 17 | && git clone https://github.com/ros-controls/gazebo_ros2_control \ 18 | && rosdep fix-permissions && rosdep update \ 19 | && rosdep install --from-paths ./ -i -y --rosdistro rolling \ 20 | --ignore-src 21 | 22 | RUN cd /home/ros2_ws/ \ 23 | && . /opt/ros/rolling/setup.sh \ 24 | && colcon build --merge-install 25 | 26 | COPY entrypoint.sh /entrypoint.sh 27 | ENTRYPOINT ["/entrypoint.sh"] 28 | 29 | CMD ros2 launch gazebo_ros2_control_demos cart_example_position.launch.py 30 | -------------------------------------------------------------------------------- /Docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /opt/ros/rolling/setup.sh 4 | . /home/ros2_ws/install/setup.sh 5 | exec "$@" 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | 204 | ---------- 205 | 206 | BSD 3-Clause License 207 | 208 | Copyright (c) 2021, Open Source Robotics Foundation, Inc. 209 | All rights reserved. 210 | 211 | Redistribution and use in source and binary forms, with or without 212 | modification, are permitted provided that the following conditions are met: 213 | 214 | * Redistributions of source code must retain the above copyright notice, this 215 | list of conditions and the following disclaimer. 216 | 217 | * Redistributions in binary form must reproduce the above copyright notice, 218 | this list of conditions and the following disclaimer in the documentation 219 | and/or other materials provided with the distribution. 220 | 221 | * Neither the name of the copyright holder nor the names of its 222 | contributors may be used to endorse or promote products derived from 223 | this software without specific prior written permission. 224 | 225 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 226 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 227 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 228 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 229 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 230 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 231 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 232 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 233 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 234 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 235 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gazebo_ros2_control 2 | 3 | This is a ROS 2 package for integrating the `ros2_control` controller architecture with the [Gazebo Classic](https://classic.gazebosim.org/) simulator. 4 | 5 | > **Gazebo Classic went end-of-life in January of 2025. There won't be any updates to gazebo_ros2_control anymore.** 6 | > 7 | > We strongly recommend all users migrate from Gazebo Classic (numbered releases) to modern Gazebo (formerly known as Ignition 3, lettered releases). To use ros2_control with newer versions of Gazebo take a look at [gz_ros2_control](https://github.com/ros-controls/gz_ros2_control). 8 | > 9 | > Furthermore, Gazebo Classic is not released to Ubuntu Noble. As a consequence, gazebo_ros2_control never was released to Jazzy and Rolling/Noble. 10 | 11 | This package provides a Gazebo plugin which instantiates a `ros2_control` controller manager and connects it to a Gazebo model. 12 | 13 | ## Documentation 14 | See the [documentation file](doc/index.rst) or [control.ros.org](https://control.ros.org/master/doc/gazebo_ros2_control/doc/index.html). 15 | 16 | ## Build status 17 | 18 | ROS 2 Distro | Branch | Build status | Documentation 19 | :----------: | :----: | :----------: | :-----------: 20 | **Rolling** | [`master`](https://github.com/ros-controls/gazebo_ros2_control/tree/master) | [![Gazebo ros2 control CI](https://github.com/ros-controls/gazebo_ros2_control/actions/workflows/ci-rolling.yaml/badge.svg?branch=master)](https://github.com/ros-controls/gazebo_ros2_control/actions/workflows/ci-rolling.yaml) | [Documentation](https://control.ros.org/master/doc/gazebo_ros2_control/doc/index.html) 21 | **Jazzy** | [`master`](https://github.com/ros-controls/gazebo_ros2_control/tree/master) | [![Gazebo ros2 control CI](https://github.com/ros-controls/gazebo_ros2_control/actions/workflows/ci-rolling.yaml/badge.svg?branch=master)](https://github.com/ros-controls/gazebo_ros2_control/actions/workflows/ci-rolling.yaml) | [Documentation](https://control.ros.org/jazzy/doc/gazebo_ros2_control/doc/index.html) 22 | **Humble** | [`humble`](https://github.com/ros-controls/gazebo_ros2_control/tree/humble) | [![Gazebo ros2 control CI](https://github.com/ros-controls/gazebo_ros2_control/actions/workflows/ci-humble.yaml/badge.svg?branch=humble)](https://github.com/ros-controls/gazebo_ros2_control/actions/workflows/ci-humble.yaml) | [Documentation](https://control.ros.org/humble/doc/gazebo_ros2_control/doc/index.html) 23 | -------------------------------------------------------------------------------- /doc/img/cart.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/gazebo_ros2_control/b48c8aed563539fb0c8ee98e2c2f0604708b8aa5/doc/img/cart.gif -------------------------------------------------------------------------------- /doc/img/gazebo_ros2_control_diff_drive.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/gazebo_ros2_control/b48c8aed563539fb0c8ee98e2c2f0604708b8aa5/doc/img/gazebo_ros2_control_diff_drive.gif -------------------------------------------------------------------------------- /doc/img/gazebo_ros2_control_position.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/gazebo_ros2_control/b48c8aed563539fb0c8ee98e2c2f0604708b8aa5/doc/img/gazebo_ros2_control_position.gif -------------------------------------------------------------------------------- /doc/img/gripper.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/gazebo_ros2_control/b48c8aed563539fb0c8ee98e2c2f0604708b8aa5/doc/img/gripper.gif -------------------------------------------------------------------------------- /doc/img/moveit2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros-controls/gazebo_ros2_control/b48c8aed563539fb0c8ee98e2c2f0604708b8aa5/doc/img/moveit2.gif -------------------------------------------------------------------------------- /gazebo_ros2_control/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package gazebo_ros2_control 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.7.4 (2025-05-18) 6 | ------------------ 7 | * Set use_sim_time parameter prior to node creation 8 | * Update upstream PID API (`#395 `_) 9 | * Fix namespacing for multiple instances of gazebo_ros2_control plugin (`#181 `_) 10 | * Contributors: Ben Holden, Christoph Fröhlich 11 | 12 | 0.7.3 (2024-09-17) 13 | ------------------ 14 | * Add support for getting PID parameters from loaded parameters (`#374 `_) 15 | Co-authored-by: Christoph Fröhlich 16 | Co-authored-by: Alejandro Hernández Cordero 17 | * propagate gazebo remapping and other arguments to the controller node (`#370 `_) 18 | * Contributors: Sai Kishor Kothakota 19 | 20 | 0.7.2 (2024-07-09) 21 | ------------------ 22 | * Propagate the node clock and logging interface to ResourceManager (`#357 `_) 23 | * Simplify access for robot description from CM by overriding RM (`#349 `_) 24 | * Initialize antiwindup variable properly (`#326 `_) 25 | * Change initial pose of pendulum (`#312 `_) 26 | Co-authored-by: chameau5050 <54971185+chameau5050@users.noreply.github.com> 27 | * Rewrite mimic joints (`#297 `_) 28 | Co-authored-by: Alejandro Hernández Cordero 29 | * Update precommit config (`#298 `_) 30 | Co-authored-by: Alejandro Hernández Cordero 31 | * Fix incorrect force-torque sensor vec population (`#296 `_) 32 | * Update gazebo_ros2_control_plugin.cpp (`#286 `_) 33 | * set the robot description parameter (`#277 `_) (`#285 `_) 34 | (cherry picked from commit 7f23568a31ec812c3745af89d1f3bc54ac787af0) 35 | Co-authored-by: AB 36 | * Fix crashing due to an invalid parameter in the initial value. (`#271 `_) 37 | Co-authored-by: Alejandro Hernández Cordero 38 | * Contributors: Christoph Fröhlich, Mateus Menezes, Sai Kishor Kothakota, Tobias Fischer, Wiktor Bajor, mergify[bot] 39 | 40 | 0.7.1 (2024-01-24) 41 | ------------------ 42 | * Load the URDF to the resource_manager before parsing it to CM (`#262 `_) 43 | * Load the URDF to the resource_manager before parsing it to CM constructor (fixes https://github.com/ros-controls/ros2_control/issues/1299) 44 | * Use lexical casts (`#260 `_) 45 | Co-authored-by: Alejandro Hernández Cordero 46 | * Fix links in documentation (`#263 `_) 47 | * Added controller manager xml argument (`#255 `_) 48 | * Contributors: Alejandro Hernández Cordero, Christoph Fröhlich, Sai Kishor Kothakota, Silvio Traversaro 49 | 50 | 0.7.0 (2024-01-04) 51 | ------------------ 52 | * Add `hold_joints` parameter (`#251 `_) 53 | * Fix stuck passive joints (`#237 `_) 54 | * Contributors: Christoph Fröhlich, Johannes Huemer 55 | 56 | 0.6.2 (2023-08-23) 57 | ------------------ 58 | * Catch pluginlib exceptions (`#229 `_) 59 | Co-authored-by: Alejandro Hernández Cordero 60 | * Set the C++ version to 17 (`#221 `_) 61 | * Removed unused var (`#220 `_) 62 | * Remove plugin export from ROS 1 (`#212 `_) 63 | * Forced zero vel in position mode to avoid sagging (`#213 `_) 64 | * Contributors: Alejandro Hernández Cordero, Christoph Fröhlich, gwalck 65 | 66 | 0.6.1 (2023-06-09) 67 | ------------------ 68 | * Add pre-commit and CI-format (`#206 `_) 69 | * Add pre-commit and ci-format 70 | * Compile with ROS iron and rolling (`#202 `_) 71 | * Contributors: Alejandro Hernández Cordero, Christoph Fröhlich 72 | 73 | 0.6.0 (2023-05-23) 74 | ------------------ 75 | * add copy operator to SafeEnum (`#197 `_) 76 | * Fixed rolling compilation (`#195 `_) 77 | * Export all dependencies (`#183 `_) (`#184 `_) 78 | * Contributors: Alejandro Hernández Cordero, Noel Jiménez García, Adrian Zwiener 79 | 80 | 0.5.1 (2023-02-07) 81 | ------------------ 82 | * Various bug fixes (`#177 `_) 83 | * Contributors: AndyZe 84 | 85 | 0.5.0 (2023-01-06) 86 | ------------------ 87 | * Force setting use_sim_time parameter when using plugin. (`#171 `_) 88 | * Improve error message if robot_description\_ param is wrong (`#168 `_) 89 | * Rename hw info class type to plugin name (`#169 `_) 90 | * Removed warning (`#162 `_) 91 | * Mimic joint should have the same control mode as mimicked joint. (`#154 `_) 92 | * Enable loading params from multiple yaml files (`#149 `_) 93 | * Contributors: Alejandro Hernández Cordero, Christoph Fröhlich, Denis Štogl, Tony Najjar 94 | 95 | 0.4.0 (2022-08-09) 96 | ------------------ 97 | * Implemented perform_command_mode_switch override in GazeboSystem (`#136 `_) 98 | * added namespace to controller manager (`#147 `_) 99 | * Activate all hardware in URDF (`#144 `_) 100 | * activated all hardware by default (`#143 `_) 101 | * Fix setting initial values if command interfaces are not defined. (`#110 `_) 102 | * changed name to GazeboSystem (`#142 `_) 103 | * Contributors: Denis Štogl, Keegan Sotebeer, Maciej Bednarczyk 104 | 105 | 0.3.1 (2022-07-05) 106 | ------------------ 107 | * Added logic for activating hardware interfaces (`#139 `_) 108 | * Adjust repo URL (`#134 `_) 109 | * Contributors: Alejandro Hernández Cordero, Bence Magyar 110 | 111 | 0.3.0 (2022-05-27) 112 | ------------------ 113 | * Merge pull request `#120 `_ from ros-simulation/ahcorde/main/117 114 | Adapted to Humble 115 | * make linters happy 116 | * Merge remote-tracking branch 'denis/using-under-namespace' into ahcorde/main/117 117 | * update read/write interface functions of ros2_control parts 118 | This is needed since the ros2_control interfaces have been update 119 | * Declare dependency of gazebo_hardware_plugins to urdf in CMakeLists.txt (`#117 `_) 120 | * ros2_control is now having usings under its namespace. 121 | * Fix mimic joint for effort command (`#109 `_) 122 | * Support for mimic joints and example with gripper. (`#107 `_) 123 | * Contributors: Alejandro Hernández Cordero, Christoph Fröhlich, Denis Štogl, Manuel M, Martin Wudenka, ahcorde 124 | 125 | 0.0.8 (2022-01-28) 126 | ------------------ 127 | * Enable setting default position of the simulated robot using ros2_control URDF tag. (`#100 `_) 128 | * Contributors: Denis Štogl 129 | 130 | 0.0.7 (2021-12-03) 131 | ------------------ 132 | * Pass ROS time instead of SYSTEM time to update function (`#97 `_) 133 | * Contributors: Błażej Sowa 134 | 135 | 0.0.6 (2021-11-18) 136 | ------------------ 137 | * Fix ros2_control resource manager in galatic (`#96 `_) 138 | * Contributors: Alejandro Hernández Cordero 139 | 140 | 0.0.4 (2021-10-26) 141 | ------------------ 142 | * Added testing CI (`#93 `_) 143 | Co-authored-by: Bence Magyar 144 | Co-authored-by: Bence Magyar 145 | * fix maintainer email (`#92 `_) 146 | * Galactic: Pass time and period to update function (`#88 `_) 147 | * Export interfaces created in init (`#83 `_) 148 | * Add Imu and FT state interfaces (`#65 `_) 149 | Co-authored-by: Jordan Palacios 150 | * Contributors: Alejandro Hernández Cordero, Bence Magyar, Błażej Sowa, Victor Lopez 151 | 152 | 0.0.3 (2021-06-16) 153 | ------------------ 154 | * Forward sdf ros remappings to loaded controllers (`#80 `_) 155 | Co-authored-by: Jonatan Olofsson 156 | * Join with the controller manager's executor thread on exit (`#79 `_) 157 | * Ensure that sim_joints\_ always has the same number of elements as the… (`#77 `_) 158 | * Write joints on each simulation update period (`#78 `_) 159 | * Contributors: Jonatan Olofsson, Kenneth Bogert, Victor Lopez 160 | 161 | 0.0.2 (2021-04-19) 162 | ------------------ 163 | * add ros parameters file to node context (`#60 `_) 164 | Co-authored-by: ahcorde 165 | * Expose include path (`#58 `_) 166 | * Added License file (`#55 `_) 167 | * Fixed state interfaces (`#53 `_) 168 | * Contributors: Alejandro Hernández Cordero, Chen Bainian, Karsten Knese 169 | 170 | 0.0.1 (2021-02-05) 171 | ------------------ 172 | * Updated with ros2-control Foxy API (`#44 `_) 173 | Co-authored-by: Karsten Knese 174 | * Added initial version of gazebo_ros2_control (`#1 `_) 175 | * Contributors: Alejandro Hernández Cordero, Louise Poubel, Karsten Knese, Bence Magyar 176 | -------------------------------------------------------------------------------- /gazebo_ros2_control/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5.0) 2 | project(gazebo_ros2_control) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | find_package(angles REQUIRED) 6 | find_package(controller_manager REQUIRED) 7 | find_package(control_toolbox REQUIRED) 8 | find_package(gazebo_dev REQUIRED) 9 | find_package(gazebo_ros REQUIRED) 10 | find_package(hardware_interface REQUIRED) 11 | find_package(pluginlib REQUIRED) 12 | find_package(rclcpp REQUIRED) 13 | find_package(yaml_cpp_vendor REQUIRED) 14 | 15 | # Default to C++17 16 | if(NOT CMAKE_CXX_STANDARD) 17 | set(CMAKE_CXX_STANDARD 17) 18 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 19 | endif() 20 | 21 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 22 | add_compile_options(-Wall -Wextra -Wconversion -Wno-sign-conversion -Wpedantic -Wnon-virtual-dtor -Woverloaded-virtual) 23 | endif() 24 | 25 | include_directories(include) 26 | link_directories( 27 | ${gazebo_dev_LIBRARY_DIRS} 28 | ) 29 | 30 | # Libraries 31 | add_library(${PROJECT_NAME} SHARED 32 | src/gazebo_ros2_control_plugin.cpp 33 | ) 34 | ament_target_dependencies(${PROJECT_NAME} 35 | angles 36 | controller_manager 37 | control_toolbox 38 | gazebo_dev 39 | gazebo_ros 40 | hardware_interface 41 | pluginlib 42 | rclcpp 43 | yaml_cpp_vendor 44 | ) 45 | 46 | add_library(gazebo_hardware_plugins SHARED 47 | src/gazebo_system.cpp 48 | ) 49 | ament_target_dependencies(gazebo_hardware_plugins 50 | angles 51 | control_toolbox 52 | gazebo_dev 53 | hardware_interface 54 | rclcpp 55 | ) 56 | 57 | ## Install 58 | install(TARGETS 59 | ${PROJECT_NAME} 60 | gazebo_hardware_plugins 61 | ARCHIVE DESTINATION lib 62 | LIBRARY DESTINATION lib 63 | RUNTIME DESTINATION bin 64 | ) 65 | 66 | ament_export_include_directories( 67 | include 68 | ) 69 | 70 | ament_export_dependencies( 71 | ament_cmake 72 | angles 73 | controller_manager 74 | gazebo_dev 75 | gazebo_ros 76 | hardware_interface 77 | pluginlib 78 | rclcpp 79 | yaml_cpp_vendor 80 | ) 81 | 82 | ament_export_libraries( 83 | ${PROJECT_NAME} 84 | gazebo_hardware_plugins 85 | ) 86 | 87 | if(BUILD_TESTING) 88 | find_package(ament_cmake_gtest REQUIRED) 89 | find_package(ament_lint_auto REQUIRED) 90 | ament_lint_auto_find_test_dependencies() 91 | endif() 92 | 93 | install(DIRECTORY include/${PROJECT_NAME}/ 94 | DESTINATION include/${PROJECT_NAME} 95 | ) 96 | 97 | pluginlib_export_plugin_description_file(gazebo_ros2_control gazebo_hardware_plugins.xml) 98 | 99 | ament_package() 100 | -------------------------------------------------------------------------------- /gazebo_ros2_control/README.md: -------------------------------------------------------------------------------- 1 | # Gazebo ros_control Interfaces 2 | 3 | This is a ROS 2 package for integrating the [ros2_control](https://github.com/ros-controls/ros2_control) controller architecture 4 | with the [Gazebo Classic](https://classic.gazebosim.org/) simulator. 5 | 6 | This package provides a Gazebo plugin which instantiates a ros_control 7 | controller manager and connects it to a Gazebo model. 8 | -------------------------------------------------------------------------------- /gazebo_ros2_control/gazebo_hardware_plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | GazeboPositionJoint 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /gazebo_ros2_control/include/gazebo_ros2_control/gazebo_ros2_control_plugin.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013, Open Source Robotics Foundation. All rights reserved. 2 | // Copyright (c) 2013, The Johns Hopkins University. All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // 14 | // * Neither the name of the Open Source Robotics Foundation nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* Author: Dave Coleman, Jonathan Bohren 31 | Desc: Gazebo plugin for ros_control that allows 'hardware_interfaces' to be plugged in 32 | using pluginlib 33 | */ 34 | 35 | #ifndef GAZEBO_ROS2_CONTROL__GAZEBO_ROS2_CONTROL_PLUGIN_HPP_ 36 | #define GAZEBO_ROS2_CONTROL__GAZEBO_ROS2_CONTROL_PLUGIN_HPP_ 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #include "controller_manager/controller_manager.hpp" 43 | 44 | #include "gazebo/common/common.hh" 45 | #include "gazebo/physics/Model.hh" 46 | 47 | namespace gazebo_ros2_control 48 | { 49 | class GazeboRosControlPrivate; 50 | 51 | class GazeboRosControlPlugin : public gazebo::ModelPlugin 52 | { 53 | public: 54 | GazeboRosControlPlugin(); 55 | 56 | ~GazeboRosControlPlugin(); 57 | 58 | // Overloaded Gazebo entry point 59 | void Load(gazebo::physics::ModelPtr parent, sdf::ElementPtr sdf) override; 60 | 61 | private: 62 | /// Private data pointer 63 | std::unique_ptr impl_; 64 | }; 65 | } // namespace gazebo_ros2_control 66 | 67 | #endif // GAZEBO_ROS2_CONTROL__GAZEBO_ROS2_CONTROL_PLUGIN_HPP_ 68 | -------------------------------------------------------------------------------- /gazebo_ros2_control/include/gazebo_ros2_control/gazebo_system.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | #ifndef GAZEBO_ROS2_CONTROL__GAZEBO_SYSTEM_HPP_ 17 | #define GAZEBO_ROS2_CONTROL__GAZEBO_SYSTEM_HPP_ 18 | 19 | #define VELOCITY_PID_PARAMS_PREFIX "vel_" 20 | #define POSITION_PID_PARAMS_PREFIX "pos_" 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "angles/angles.h" 27 | 28 | #include "control_toolbox/pid.hpp" 29 | #include "gazebo_ros2_control/gazebo_system_interface.hpp" 30 | 31 | #include "std_msgs/msg/bool.hpp" 32 | 33 | namespace gazebo_ros2_control 34 | { 35 | using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn; 36 | 37 | // Forward declaration 38 | class GazeboSystemPrivate; 39 | 40 | // These class must inherit `gazebo_ros2_control::GazeboSystemInterface` which implements a 41 | // simulated `ros2_control` `hardware_interface::SystemInterface`. 42 | 43 | class GazeboSystem : public GazeboSystemInterface 44 | { 45 | public: 46 | // Documentation Inherited 47 | CallbackReturn on_init(const hardware_interface::HardwareInfo & system_info) 48 | override; 49 | 50 | // Documentation Inherited 51 | std::vector export_state_interfaces() override; 52 | 53 | // Documentation Inherited 54 | std::vector export_command_interfaces() override; 55 | 56 | // Documentation Inherited 57 | CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override; 58 | 59 | // Documentation Inherited 60 | CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override; 61 | 62 | // Documentation Inherited 63 | hardware_interface::return_type perform_command_mode_switch( 64 | const std::vector & start_interfaces, 65 | const std::vector & stop_interfaces) override; 66 | 67 | // Documentation Inherited 68 | hardware_interface::return_type read( 69 | const rclcpp::Time & time, 70 | const rclcpp::Duration & period) override; 71 | 72 | // Documentation Inherited 73 | hardware_interface::return_type write( 74 | const rclcpp::Time & time, 75 | const rclcpp::Duration & period) override; 76 | 77 | // Documentation Inherited 78 | bool initSim( 79 | rclcpp::Node::SharedPtr & model_nh, 80 | gazebo::physics::ModelPtr parent_model, 81 | const hardware_interface::HardwareInfo & hardware_info, 82 | sdf::ElementPtr sdf) override; 83 | 84 | private: 85 | void registerJoints( 86 | const hardware_interface::HardwareInfo & hardware_info, 87 | gazebo::physics::ModelPtr parent_model); 88 | 89 | void registerSensors( 90 | const hardware_interface::HardwareInfo & hardware_info, 91 | gazebo::physics::ModelPtr parent_model); 92 | 93 | bool extractPID( 94 | const std::string & prefix, 95 | const hardware_interface::ComponentInfo & joint_info, control_toolbox::Pid & pid); 96 | 97 | bool extractPIDFromParameters( 98 | const std::string & control_mode, const std::string & joint_name, control_toolbox::Pid & pid); 99 | 100 | /// \brief Private data class 101 | std::unique_ptr dataPtr; 102 | }; 103 | 104 | } // namespace gazebo_ros2_control 105 | 106 | #endif // GAZEBO_ROS2_CONTROL__GAZEBO_SYSTEM_HPP_ 107 | -------------------------------------------------------------------------------- /gazebo_ros2_control/include/gazebo_ros2_control/gazebo_system_interface.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | #ifndef GAZEBO_ROS2_CONTROL__GAZEBO_SYSTEM_INTERFACE_HPP_ 17 | #define GAZEBO_ROS2_CONTROL__GAZEBO_SYSTEM_INTERFACE_HPP_ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "gazebo/physics/Joint.hh" 24 | #include "gazebo/physics/Model.hh" 25 | #include "gazebo/physics/physics.hh" 26 | 27 | #include "hardware_interface/system_interface.hpp" 28 | 29 | #include "rclcpp/rclcpp.hpp" 30 | 31 | 32 | namespace gazebo_ros2_control 33 | { 34 | 35 | template::type> 36 | class SafeEnum 37 | { 38 | public: 39 | SafeEnum() 40 | : mFlags(0) {} 41 | explicit SafeEnum(ENUM singleFlag) 42 | : mFlags(singleFlag) {} 43 | SafeEnum(const SafeEnum & original) 44 | : mFlags(original.mFlags) {} 45 | ~SafeEnum() = default; 46 | 47 | SafeEnum & operator=(const SafeEnum & original) = default; 48 | SafeEnum & operator|=(ENUM addValue) {mFlags |= addValue; return *this;} 49 | SafeEnum operator|(ENUM addValue) {SafeEnum result(*this); result |= addValue; return result;} 50 | SafeEnum & operator&=(ENUM maskValue) {mFlags &= maskValue; return *this;} 51 | SafeEnum operator&(ENUM maskValue) {SafeEnum result(*this); result &= maskValue; return result;} 52 | SafeEnum operator~() {SafeEnum result(*this); result.mFlags = ~result.mFlags; return result;} 53 | explicit operator bool() {return mFlags != 0;} 54 | 55 | protected: 56 | UNDERLYING mFlags; 57 | }; 58 | 59 | // SystemInterface provides API-level access to read and command joint properties. 60 | class GazeboSystemInterface 61 | : public hardware_interface::SystemInterface 62 | { 63 | public: 64 | /// \brief Initialize the system interface 65 | /// param[in] model_nh pointer to the ros2 node 66 | /// param[in] parent_model pointer to the model 67 | /// param[in] control_hardware vector filled with information about robot's control resources 68 | /// param[in] sdf pointer to the SDF 69 | virtual bool initSim( 70 | rclcpp::Node::SharedPtr & model_nh, 71 | gazebo::physics::ModelPtr parent_model, 72 | const hardware_interface::HardwareInfo & hardware_info, 73 | sdf::ElementPtr sdf) = 0; 74 | 75 | // Methods used to control a joint. 76 | enum ControlMethod_ 77 | { 78 | NONE = 0, 79 | POSITION = (1 << 0), 80 | VELOCITY = (1 << 1), 81 | EFFORT = (1 << 2), 82 | VELOCITY_PID = (1 << 3), 83 | POSITION_PID = (1 << 4), 84 | }; 85 | 86 | typedef SafeEnum ControlMethod; 87 | 88 | protected: 89 | rclcpp::Node::SharedPtr nh_; 90 | }; 91 | 92 | } // namespace gazebo_ros2_control 93 | 94 | #endif // GAZEBO_ROS2_CONTROL__GAZEBO_SYSTEM_INTERFACE_HPP_ 95 | -------------------------------------------------------------------------------- /gazebo_ros2_control/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | gazebo_ros2_control 4 | 0.7.4 5 | gazebo_ros2_control 6 | 7 | Alejandro Hernandez 8 | 9 | BSD 10 | Apache License 2.0 11 | 12 | http://ros.org/wiki/gazebo_ros_control 13 | https://github.com/ros-controls/gazebo_ros2_control/issues 14 | https://github.com/ros-controls/gazebo_ros2_control/ 15 | 16 | Jonathan Bohren 17 | Dave Coleman 18 | 19 | ament_cmake 20 | 21 | angles 22 | controller_manager 23 | control_toolbox 24 | gazebo_dev 25 | gazebo_ros 26 | hardware_interface 27 | pluginlib 28 | rclcpp 29 | std_msgs 30 | yaml_cpp_vendor 31 | 32 | ament_lint_common 33 | ament_lint_auto 34 | ament_cmake_gtest 35 | 36 | 37 | ament_cmake 38 | 39 | 40 | -------------------------------------------------------------------------------- /gazebo_ros2_control/src/gazebo_ros2_control_plugin.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013, Open Source Robotics Foundation. All rights reserved. 2 | // Copyright (c) 2013, The Johns Hopkins University. All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // 14 | // * Neither the name of the Open Source Robotics Foundation nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | /* Author: Dave Coleman, Jonathan Bohren 31 | Desc: Gazebo plugin for ros2_control that allows 'hardware_interfaces' to be plugged in 32 | using pluginlib 33 | */ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include "gazebo_ros/node.hpp" 43 | 44 | #include "gazebo_ros2_control/gazebo_ros2_control_plugin.hpp" 45 | #include "gazebo_ros2_control/gazebo_system.hpp" 46 | 47 | #include "pluginlib/class_loader.hpp" 48 | 49 | #include "rclcpp/rclcpp.hpp" 50 | 51 | #include "hardware_interface/resource_manager.hpp" 52 | #include "hardware_interface/component_parser.hpp" 53 | #include "hardware_interface/types/hardware_interface_type_values.hpp" 54 | 55 | #include "yaml-cpp/yaml.h" 56 | 57 | using namespace std::chrono_literals; 58 | 59 | namespace gazebo_ros2_control 60 | { 61 | class GazeboResourceManager : public hardware_interface::ResourceManager 62 | { 63 | public: 64 | GazeboResourceManager( 65 | rclcpp::Node::SharedPtr & node, 66 | gazebo::physics::ModelPtr parent_model, 67 | sdf::ElementPtr sdf) 68 | : hardware_interface::ResourceManager( 69 | node->get_node_clock_interface(), node->get_node_logging_interface()), 70 | gazebo_system_loader_("gazebo_ros2_control", 71 | "gazebo_ros2_control::GazeboSystemInterface"), 72 | logger_(node->get_logger().get_child("GazeboResourceManager")) 73 | { 74 | node_ = node; 75 | parent_model_ = parent_model; 76 | sdf_ = sdf; 77 | } 78 | 79 | GazeboResourceManager(const GazeboResourceManager &) = delete; 80 | 81 | // Called from Controller Manager when robot description is initialized from callback 82 | bool load_and_initialize_components( 83 | const std::string & urdf, 84 | unsigned int update_rate) override 85 | { 86 | components_are_loaded_and_initialized_ = true; 87 | 88 | const auto hardware_info = hardware_interface::parse_control_resources_from_urdf(urdf); 89 | 90 | for (const auto & individual_hardware_info : hardware_info) { 91 | std::string robot_hw_sim_type_str_ = individual_hardware_info.hardware_plugin_name; 92 | RCLCPP_DEBUG( 93 | logger_, "Load hardware interface %s ...", 94 | robot_hw_sim_type_str_.c_str()); 95 | 96 | // Load hardware 97 | std::unique_ptr gazeboSystem; 98 | std::scoped_lock guard(resource_interfaces_lock_, claimed_command_interfaces_lock_); 99 | try { 100 | gazeboSystem = std::unique_ptr( 101 | gazebo_system_loader_.createUnmanagedInstance(robot_hw_sim_type_str_)); 102 | } catch (pluginlib::PluginlibException & ex) { 103 | RCLCPP_ERROR( 104 | logger_, 105 | "The plugin failed to load for some reason. Error: %s\n", 106 | ex.what()); 107 | continue; 108 | } 109 | 110 | // initialize simulation requirements 111 | if (!gazeboSystem->initSim( 112 | node_, 113 | parent_model_, 114 | individual_hardware_info, 115 | sdf_)) 116 | { 117 | RCLCPP_FATAL( 118 | logger_, "Could not initialize robot simulation interface"); 119 | components_are_loaded_and_initialized_ = false; 120 | break; 121 | } 122 | RCLCPP_DEBUG( 123 | logger_, "Initialized robot simulation interface %s!", 124 | robot_hw_sim_type_str_.c_str()); 125 | 126 | // initialize hardware 127 | import_component(std::move(gazeboSystem), individual_hardware_info); 128 | } 129 | 130 | return components_are_loaded_and_initialized_; 131 | } 132 | 133 | private: 134 | std::shared_ptr node_; 135 | gazebo::physics::ModelPtr parent_model_; 136 | sdf::ElementPtr sdf_; 137 | 138 | /// \brief Interface loader 139 | pluginlib::ClassLoader gazebo_system_loader_; 140 | 141 | rclcpp::Logger logger_; 142 | }; 143 | class GazeboRosControlPrivate 144 | { 145 | public: 146 | GazeboRosControlPrivate() = default; 147 | 148 | virtual ~GazeboRosControlPrivate() = default; 149 | 150 | // Called by the world update start event 151 | void Update(); 152 | 153 | // Called on world reset 154 | virtual void Reset(); 155 | 156 | // Node Handles 157 | gazebo_ros::Node::SharedPtr model_nh_; 158 | 159 | // Pointer to the model 160 | gazebo::physics::ModelPtr parent_model_; 161 | 162 | // Pointer to the update event connection 163 | gazebo::event::ConnectionPtr update_connection_; 164 | 165 | // Interface loader 166 | boost::shared_ptr> robot_hw_sim_loader_; 168 | 169 | // Executor to spin the controller 170 | rclcpp::executors::MultiThreadedExecutor::SharedPtr executor_; 171 | 172 | // Thread where the executor will sping 173 | std::thread thread_executor_spin_; 174 | 175 | // Flag to stop the executor thread when this plugin is exiting 176 | bool stop_; 177 | 178 | // Controller manager 179 | std::shared_ptr controller_manager_; 180 | 181 | // Available controllers 182 | std::vector> controllers_; 183 | 184 | // Timing 185 | rclcpp::Duration control_period_ = rclcpp::Duration(1, 0); 186 | 187 | // Last time the update method was called 188 | rclcpp::Time last_update_sim_time_ros_ = rclcpp::Time((int64_t)0, RCL_ROS_TIME); 189 | }; 190 | 191 | GazeboRosControlPlugin::GazeboRosControlPlugin() 192 | : impl_(std::make_unique()) 193 | { 194 | } 195 | 196 | GazeboRosControlPlugin::~GazeboRosControlPlugin() 197 | { 198 | // Stop controller manager thread 199 | impl_->stop_ = true; 200 | impl_->executor_->remove_node(impl_->controller_manager_); 201 | impl_->executor_->cancel(); 202 | impl_->thread_executor_spin_.join(); 203 | 204 | // Disconnect from gazebo events 205 | impl_->update_connection_.reset(); 206 | } 207 | 208 | // Overloaded Gazebo entry point 209 | void GazeboRosControlPlugin::Load(gazebo::physics::ModelPtr parent, sdf::ElementPtr sdf) 210 | { 211 | RCLCPP_INFO_STREAM( 212 | rclcpp::get_logger("gazebo_ros2_control"), 213 | "Loading gazebo_ros2_control plugin"); 214 | 215 | // Save pointers to the model 216 | impl_->parent_model_ = parent; 217 | 218 | // Get parameters/settings for controllers from ROS param server 219 | // Initialize ROS node 220 | impl_->model_nh_ = gazebo_ros::Node::Get(sdf); 221 | 222 | RCLCPP_INFO( 223 | impl_->model_nh_->get_logger(), "Starting gazebo_ros2_control plugin in namespace: %s", 224 | impl_->model_nh_->get_namespace()); 225 | 226 | RCLCPP_INFO( 227 | impl_->model_nh_->get_logger(), "Starting gazebo_ros2_control plugin in ROS 2 node: %s", 228 | impl_->model_nh_->get_name()); 229 | 230 | // Error message if the model couldn't be found 231 | if (!impl_->parent_model_) { 232 | RCLCPP_ERROR_STREAM(impl_->model_nh_->get_logger(), "parent model is NULL"); 233 | return; 234 | } 235 | 236 | // Check that ROS has been initialized 237 | if (!rclcpp::ok()) { 238 | RCLCPP_FATAL_STREAM( 239 | impl_->model_nh_->get_logger(), 240 | "A ROS node for Gazebo has not been initialized, unable to load plugin. " << 241 | "Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' in the gazebo_ros package)"); 242 | return; 243 | } 244 | 245 | // Hold joints if no control mode is active? 246 | bool hold_joints = true; // default 247 | if (sdf->HasElement("hold_joints")) { 248 | hold_joints = 249 | sdf->GetElement("hold_joints")->Get(); 250 | } 251 | 252 | // Get controller manager node name 253 | std::string controllerManagerNodeName{"controller_manager"}; 254 | 255 | if (sdf->HasElement("controller_manager_name")) { 256 | controllerManagerNodeName = sdf->GetElement("controller_manager_name")->Get(); 257 | } 258 | 259 | // There's currently no direct way to set parameters to the plugin's node 260 | // So we have to parse the plugin file manually and set it to the node's context. 261 | auto rcl_context = impl_->model_nh_->get_node_base_interface()->get_context()->get_rcl_context(); 262 | std::vector arguments = {"--ros-args"}; 263 | 264 | if (sdf->HasElement("parameters")) { 265 | sdf::ElementPtr argument_sdf = sdf->GetElement("parameters"); 266 | while (argument_sdf) { 267 | std::string argument = argument_sdf->Get(); 268 | RCLCPP_INFO(impl_->model_nh_->get_logger(), "Loading parameter files %s", argument.c_str()); 269 | arguments.push_back(RCL_PARAM_FILE_FLAG); 270 | arguments.push_back(argument); 271 | argument_sdf = argument_sdf->GetNextElement("parameters"); 272 | } 273 | } else { 274 | RCLCPP_ERROR( 275 | impl_->model_nh_->get_logger(), "No parameter file provided. Configuration might be wrong"); 276 | } 277 | 278 | if (sdf->HasElement("ros")) { 279 | sdf = sdf->GetElement("ros"); 280 | // Get list of remapping rules from SDF 281 | if (sdf->HasElement("remapping")) { 282 | sdf::ElementPtr argument_sdf = sdf->GetElement("remapping"); 283 | 284 | while (argument_sdf) { 285 | std::string argument = argument_sdf->Get(); 286 | arguments.push_back(RCL_REMAP_FLAG); 287 | arguments.push_back(argument); 288 | argument_sdf = argument_sdf->GetNextElement("remapping"); 289 | } 290 | } 291 | } 292 | 293 | std::vector argv; 294 | for (const auto & arg : arguments) { 295 | argv.push_back(reinterpret_cast(arg.data())); 296 | } 297 | rcl_arguments_t rcl_args = rcl_get_zero_initialized_arguments(); 298 | rcl_ret_t rcl_ret = rcl_parse_arguments( 299 | static_cast(argv.size()), 300 | argv.data(), rcl_get_default_allocator(), &rcl_args); 301 | rcl_context->global_arguments = rcl_args; 302 | if (rcl_ret != RCL_RET_OK) { 303 | RCLCPP_ERROR(impl_->model_nh_->get_logger(), "parser error %s\n", rcl_get_error_string().str); 304 | rcl_reset_error(); 305 | return; 306 | } 307 | if (rcl_arguments_get_param_files_count(&rcl_args) < 1) { 308 | RCLCPP_ERROR( 309 | impl_->model_nh_->get_logger(), "failed to parse input yaml file(s)"); 310 | return; 311 | } 312 | 313 | // Get the Gazebo simulation period 314 | rclcpp::Duration gazebo_period( 315 | std::chrono::duration_cast( 316 | std::chrono::duration( 317 | impl_->parent_model_->GetWorld()->Physics()->GetMaxStepSize()))); 318 | 319 | rclcpp::Node::SharedPtr node_ros2 = std::dynamic_pointer_cast( 320 | impl_->model_nh_); 321 | try { 322 | node_ros2->declare_parameter("hold_joints", rclcpp::ParameterValue(hold_joints)); 323 | } catch (const rclcpp::exceptions::ParameterAlreadyDeclaredException & e) { 324 | RCLCPP_ERROR( 325 | impl_->model_nh_->get_logger(), "Parameter 'hold_joints' has already been declared, %s", 326 | e.what()); 327 | } catch (const rclcpp::exceptions::InvalidParametersException & e) { 328 | RCLCPP_ERROR( 329 | impl_->model_nh_->get_logger(), "Parameter 'hold_joints' has invalid name, %s", e.what()); 330 | } catch (const rclcpp::exceptions::InvalidParameterValueException & e) { 331 | RCLCPP_ERROR( 332 | impl_->model_nh_->get_logger(), "Parameter 'hold_joints' value is invalid, %s", e.what()); 333 | } catch (const rclcpp::exceptions::InvalidParameterTypeException & e) { 334 | RCLCPP_ERROR( 335 | impl_->model_nh_->get_logger(), "Parameter 'hold_joints' value has wrong type, %s", 336 | e.what()); 337 | } 338 | 339 | impl_->executor_ = std::make_shared(); 340 | 341 | std::unique_ptr resource_manager_ = 342 | std::make_unique( 343 | node_ros2, 344 | impl_->parent_model_, sdf); 345 | 346 | // Create the controller manager 347 | RCLCPP_INFO(impl_->model_nh_->get_logger(), "Loading controller_manager"); 348 | rclcpp::NodeOptions options = controller_manager::get_cm_node_options(); 349 | // Force setting of use_sime_time parameter 350 | arguments.push_back("--param"); 351 | arguments.push_back("use_sim_time:=True"); 352 | options.arguments(arguments); 353 | impl_->controller_manager_.reset( 354 | new controller_manager::ControllerManager( 355 | std::move(resource_manager_), 356 | impl_->executor_, 357 | controllerManagerNodeName, 358 | impl_->model_nh_->get_namespace(), options)); 359 | impl_->executor_->add_node(impl_->controller_manager_); 360 | 361 | auto cm_update_rate = impl_->controller_manager_->get_update_rate(); 362 | impl_->control_period_ = rclcpp::Duration( 363 | std::chrono::duration_cast( 364 | std::chrono::duration(1.0 / static_cast(cm_update_rate)))); 365 | // Check the period against the simulation period 366 | if (impl_->control_period_ < gazebo_period) { 367 | RCLCPP_ERROR_STREAM( 368 | impl_->model_nh_->get_logger(), 369 | "Desired controller update period (" << impl_->control_period_.seconds() << 370 | " s) is faster than the gazebo simulation period (" << 371 | gazebo_period.seconds() << " s)."); 372 | } else if (impl_->control_period_ > gazebo_period) { 373 | RCLCPP_WARN_STREAM( 374 | impl_->model_nh_->get_logger(), 375 | " Desired controller update period (" << impl_->control_period_.seconds() << 376 | " s) is slower than the gazebo simulation period (" << 377 | gazebo_period.seconds() << " s)."); 378 | } 379 | 380 | impl_->stop_ = false; 381 | auto spin = [this]() 382 | { 383 | while (rclcpp::ok() && !impl_->stop_) { 384 | impl_->executor_->spin_once(); 385 | } 386 | }; 387 | impl_->thread_executor_spin_ = std::thread(spin); 388 | 389 | // Listen to the update event. This event is broadcast every simulation iteration. 390 | impl_->update_connection_ = 391 | gazebo::event::Events::ConnectWorldUpdateBegin( 392 | boost::bind( 393 | &GazeboRosControlPrivate::Update, 394 | impl_.get())); 395 | 396 | // Wait for CM to receive robot description from the topic and then initialize Resource Manager 397 | while (!impl_->controller_manager_->is_resource_manager_initialized()) { 398 | RCLCPP_WARN( 399 | impl_->model_nh_->get_logger(), 400 | "Waiting RM to load and initialize hardware..."); 401 | std::this_thread::sleep_for(std::chrono::microseconds(2000000)); 402 | } 403 | 404 | RCLCPP_INFO(impl_->model_nh_->get_logger(), "Loaded gazebo_ros2_control."); 405 | } 406 | 407 | // Called by the world update start event 408 | void GazeboRosControlPrivate::Update() 409 | { 410 | // Get the simulation time and period 411 | gazebo::common::Time gz_time_now = parent_model_->GetWorld()->SimTime(); 412 | rclcpp::Time sim_time_ros(gz_time_now.sec, gz_time_now.nsec, RCL_ROS_TIME); 413 | rclcpp::Duration sim_period = sim_time_ros - last_update_sim_time_ros_; 414 | 415 | if (sim_period >= control_period_) { 416 | controller_manager_->read(sim_time_ros, sim_period); 417 | controller_manager_->update(sim_time_ros, sim_period); 418 | last_update_sim_time_ros_ = sim_time_ros; 419 | } 420 | 421 | // Always set commands on joints, otherwise at low control frequencies the joints tremble 422 | // as they are updated at a fraction of gazebo sim time 423 | // use same time as for read and update call - this is how it is done is ros2_control_node 424 | controller_manager_->write(sim_time_ros, sim_period); 425 | } 426 | 427 | // Called on world reset 428 | void GazeboRosControlPrivate::Reset() 429 | { 430 | // Reset timing variables to not pass negative update periods to controllers on world reset 431 | last_update_sim_time_ros_ = rclcpp::Time((int64_t)0, RCL_ROS_TIME); 432 | } 433 | 434 | // Register this plugin with the simulator 435 | GZ_REGISTER_MODEL_PLUGIN(GazeboRosControlPlugin) 436 | } // namespace gazebo_ros2_control 437 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 | Changelog for package gazebo_ros2_control_demos 3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 | 5 | 0.7.4 (2025-05-18) 6 | ------------------ 7 | * Fix namespacing for multiple instances of gazebo_ros2_control plugin (`#181 `_) 8 | * Contributors: Ben Holden, Christoph Froehlich 9 | 10 | 0.7.3 (2024-09-17) 11 | ------------------ 12 | * Add support for getting PID parameters from loaded parameters (`#374 `_) 13 | Co-authored-by: Christoph Fröhlich 14 | Co-authored-by: Alejandro Hernández Cordero 15 | * Revert "Add namespaced example" 16 | This reverts commit 49507137ef6eb4e1a4c8d4352d9a163ddd462d81. 17 | * Add namespaced example 18 | * Contributors: Christoph Froehlich, Sai Kishor Kothakota 19 | 20 | 0.7.2 (2024-07-09) 21 | ------------------ 22 | * Add missing dependency (`#350 `_) 23 | * Remove stamped twist parameter (`#333 `_) 24 | Co-authored-by: Alejandro Hernández Cordero 25 | * Change initial pose of pendulum (`#312 `_) 26 | Co-authored-by: chameau5050 <54971185+chameau5050@users.noreply.github.com> 27 | * Change initial pose of pendulum (`#313 `_) 28 | * Add an example with a passive joint (`#172 `_) 29 | Co-authored-by: Alejandro Hernández Cordero 30 | * Rewrite mimic joints (`#297 `_) 31 | Co-authored-by: Alejandro Hernández Cordero 32 | * Fix topic (`#291 `_) 33 | * Cleanup of demos (`#290 `_) 34 | * Contributors: Christoph Fröhlich, mergify[bot] 35 | 36 | 0.7.1 (2024-01-24) 37 | ------------------ 38 | 39 | 0.7.0 (2024-01-04) 40 | ------------------ 41 | * replace Twist with TwistStamped (`#249 `_) 42 | * Rename cartpole (`#252 `_) 43 | Co-authored-by: Alejandro Hernández Cordero 44 | * Replace double quotes with single ones (`#243 `_) 45 | * Cleanup controller config (`#232 `_) 46 | * Remove wrong yaml entries 47 | * Rename effort_controller 48 | * Contributors: Alejandro Hernández Cordero, Christoph Fröhlich 49 | 50 | 0.6.2 (2023-08-23) 51 | ------------------ 52 | * Set the C++ version to 17 (`#221 `_) 53 | * Update diff_drive_controller.yaml (`#224 `_) 54 | The wrong base frame is set. The name of the link in the URDF is chassis. 55 | * Contributors: Alejandro Hernández Cordero, David V. Lu!! 56 | 57 | 0.6.1 (2023-06-09) 58 | ------------------ 59 | * Add pre-commit and CI-format (`#206 `_) 60 | * Add pre-commit and ci-format 61 | * Contributors: Christoph Fröhlich 62 | 63 | 0.6.0 (2023-05-23) 64 | ------------------ 65 | * Clean shutdown position example (`#196 `_) 66 | * Remove publish_rate parameter (`#179 `_) 67 | * Contributors: Alejandro Hernández Cordero, Tony Najjar 68 | 69 | 0.5.1 (2023-02-07) 70 | ------------------ 71 | 72 | 0.5.0 (2023-01-06) 73 | ------------------ 74 | * Add tricycle controller demo (`#145 `_) 75 | * Contributors: Tony Najjar 76 | 77 | 0.4.0 (2022-08-09) 78 | ------------------ 79 | * fix demo launch 80 | * Fix setting initial values if command interfaces are not defined. (`#110 `_) 81 | * Contributors: Bence Magyar, Denis Štogl, Maciej Bednarczyk 82 | 83 | 0.3.1 (2022-07-05) 84 | ------------------ 85 | * Fixed CMake source file extension (`#140 `_) 86 | * Adding simulation time parameter for the controller manager (`#138 `_) 87 | Adding the simulation parameter so that the controller manager uses the simulation time instead of the ROS time. The '/odom' and corresponding tf will only be published if this parameter is set to true. 88 | * Adjust repo URL (`#134 `_) 89 | * Changed launch variable name (`#130 `_) 90 | * Contributors: Alejandro Hernández Cordero, Bence Magyar, Eslam Salah, Jakub "Deli" Delicat 91 | 92 | 0.3.0 (2022-05-27) 93 | ------------------ 94 | * [Forward port main] Added diff drive example (`#113 `_) (`#129 `_) 95 | * Merge pull request `#120 `_ from ros-simulation/ahcorde/main/117 96 | Adapted to Humble 97 | * make linters happy 98 | * Update to Humble API 99 | * Support for mimic joints and example with gripper. (`#107 `_) 100 | * Contributors: Alejandro Hernández Cordero, Denis Štogl, ahcorde 101 | 102 | 0.0.8 (2022-01-28) 103 | ------------------ 104 | * Enable setting default position of the simulated robot using ros2_control URDF tag. (`#100 `_) 105 | * Contributors: Denis Štogl 106 | 107 | 0.0.7 (2021-12-03) 108 | ------------------ 109 | 110 | 0.0.6 (2021-11-18) 111 | ------------------ 112 | * Fix ros2_control resource manager in galatic (`#96 `_) 113 | * Contributors: Alejandro Hernández Cordero 114 | 115 | 0.0.4 (2021-10-26) 116 | ------------------ 117 | * fix maintainer email (`#92 `_) 118 | * Galactic: Pass time and period to update function (`#88 `_) 119 | * Update severity of msgs to proper level (`#91 `_) 120 | * Add Imu and FT state interfaces (`#65 `_) 121 | Co-authored-by: Jordan Palacios 122 | * Contributors: Alejandro Hernández Cordero, Andy McEvoy, Bence Magyar, Victor Lopez 123 | 124 | 0.0.3 (2021-06-16) 125 | ------------------ 126 | * Update code with recent change in ros2_control (`#81 `_) 127 | * Adding ros2_control dependency to demos (`#74 `_) (`#76 `_) 128 | * Contributors: Alejandro Hernández Cordero, Ron Marrero 129 | 130 | 0.0.2 (2021-04-19) 131 | ------------------ 132 | * Remove Unnecessary parameter in demo (`#68 `_) 133 | * Add effort_controller exec_depend on demos (`#69 `_) 134 | * add ros parameters file to node context (`#60 `_) 135 | Co-authored-by: ahcorde 136 | * add ros2_controllers as exec dependency (`#56 `_) 137 | fixes `#49 `_ 138 | * Contributors: Alejandro Hernández Cordero, Karsten Knese 139 | 140 | 0.0.1 (2021-02-05) 141 | ------------------ 142 | * Updated with ros2-control Foxy API (`#44 `_) 143 | Co-authored-by: Karsten Knese 144 | * Updated with recent ros2_control changes (`#34 `_) 145 | * Added initial demos in gazebo_ros2_control_demos (`#2 `_) 146 | Co-authored-by: Louise Poubel 147 | * Contributors: Alejandro Hernández Cordero, Louise Poubel, Karsten Knese, Bence Magyar 148 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5.0) 2 | project(gazebo_ros2_control_demos) 3 | 4 | # Default to C11 5 | if(NOT CMAKE_C_STANDARD) 6 | set(CMAKE_C_STANDARD 11) 7 | endif() 8 | # Default to C++17 9 | if(NOT CMAKE_CXX_STANDARD) 10 | set(CMAKE_CXX_STANDARD 17) 11 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 12 | endif() 13 | 14 | if(NOT WIN32) 15 | add_compile_options(-Wall -Wextra -Wpedantic) 16 | endif() 17 | 18 | find_package(ament_cmake REQUIRED) 19 | find_package(control_msgs REQUIRED) 20 | find_package(geometry_msgs REQUIRED) 21 | find_package(rclcpp REQUIRED) 22 | find_package(rclcpp_action REQUIRED) 23 | find_package(std_msgs REQUIRED) 24 | 25 | install(DIRECTORY 26 | launch 27 | config 28 | urdf 29 | DESTINATION share/${PROJECT_NAME}/ 30 | ) 31 | 32 | add_executable(example_position examples/example_position.cpp) 33 | ament_target_dependencies(example_position 34 | rclcpp 35 | rclcpp_action 36 | control_msgs 37 | ) 38 | 39 | add_executable(example_velocity examples/example_velocity.cpp) 40 | ament_target_dependencies(example_velocity 41 | rclcpp 42 | std_msgs 43 | ) 44 | 45 | add_executable(example_effort examples/example_effort.cpp) 46 | ament_target_dependencies(example_effort 47 | rclcpp 48 | std_msgs 49 | ) 50 | 51 | add_executable(example_gripper examples/example_gripper.cpp) 52 | ament_target_dependencies(example_gripper 53 | rclcpp 54 | std_msgs 55 | ) 56 | 57 | add_executable(example_position_pid examples/example_position_pid.cpp) 58 | ament_target_dependencies(example_position_pid 59 | rclcpp 60 | std_msgs 61 | ) 62 | 63 | add_executable(example_diff_drive examples/example_diff_drive.cpp) 64 | ament_target_dependencies(example_diff_drive 65 | rclcpp 66 | geometry_msgs 67 | ) 68 | 69 | add_executable(example_tricycle_drive examples/example_tricycle_drive.cpp) 70 | ament_target_dependencies(example_tricycle_drive 71 | rclcpp 72 | geometry_msgs 73 | ) 74 | 75 | if(BUILD_TESTING) 76 | find_package(ament_cmake_gtest REQUIRED) 77 | find_package(ament_lint_auto REQUIRED) 78 | 79 | ament_lint_auto_find_test_dependencies() 80 | endif() 81 | 82 | ## Install 83 | install( 84 | TARGETS 85 | example_position 86 | example_position_pid 87 | example_velocity 88 | example_effort 89 | example_diff_drive 90 | example_tricycle_drive 91 | example_gripper 92 | DESTINATION 93 | lib/${PROJECT_NAME} 94 | ) 95 | 96 | ament_package() 97 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/cart_controller.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | 5 | joint_trajectory_controller: 6 | type: joint_trajectory_controller/JointTrajectoryController 7 | 8 | joint_state_broadcaster: 9 | type: joint_state_broadcaster/JointStateBroadcaster 10 | 11 | joint_trajectory_controller: 12 | ros__parameters: 13 | joints: 14 | - slider_to_cart 15 | command_interfaces: 16 | - position 17 | state_interfaces: 18 | - position 19 | - velocity 20 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/cart_controller_effort.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | 5 | effort_controller: 6 | type: effort_controllers/JointGroupEffortController 7 | 8 | joint_state_broadcaster: 9 | type: joint_state_broadcaster/JointStateBroadcaster 10 | 11 | effort_controller: 12 | ros__parameters: 13 | joints: 14 | - slider_to_cart 15 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/cart_controller_position.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | 5 | position_controller: 6 | type: position_controllers/JointGroupPositionController 7 | 8 | joint_state_broadcaster: 9 | type: joint_state_broadcaster/JointStateBroadcaster 10 | 11 | position_controller: 12 | ros__parameters: 13 | joints: 14 | - slider_to_cart 15 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/cart_controller_position_with_pids.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | 5 | position_controller: 6 | type: position_controllers/JointGroupPositionController 7 | 8 | joint_state_broadcaster: 9 | type: joint_state_broadcaster/JointStateBroadcaster 10 | 11 | position_controller: 12 | ros__parameters: 13 | joints: 14 | - slider_to_cart 15 | 16 | gazebo_ros2_control: 17 | ros__parameters: 18 | pid_gains: 19 | position: 20 | slider_to_cart: {kp: 100.0, kd: 10.0, ki: 1.0, max_integral_error: 10000.0} 21 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/cart_controller_velocity.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | 5 | velocity_controller: 6 | type: velocity_controllers/JointGroupVelocityController 7 | 8 | joint_state_broadcaster: 9 | type: joint_state_broadcaster/JointStateBroadcaster 10 | 11 | imu_sensor_broadcaster: 12 | type: imu_sensor_broadcaster/IMUSensorBroadcaster 13 | 14 | velocity_controller: 15 | ros__parameters: 16 | joints: 17 | - slider_to_cart 18 | 19 | imu_sensor_broadcaster: 20 | ros__parameters: 21 | sensor_name: cart_imu_sensor 22 | frame_id: imu 23 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/config.rviz: -------------------------------------------------------------------------------- 1 | Panels: 2 | - Class: rviz_common/Displays 3 | Help Height: 78 4 | Name: Displays 5 | Property Tree Widget: 6 | Expanded: 7 | - /Global Options1 8 | - /Status1 9 | - /TF1 10 | - /RobotModel1 11 | - /RobotModel1/Status1 12 | - /RobotModel1/Description Topic1 13 | Splitter Ratio: 0.5 14 | Tree Height: 741 15 | - Class: rviz_common/Selection 16 | Name: Selection 17 | - Class: rviz_common/Tool Properties 18 | Expanded: 19 | - /2D Goal Pose1 20 | - /Publish Point1 21 | Name: Tool Properties 22 | Splitter Ratio: 0.5886790156364441 23 | - Class: rviz_common/Views 24 | Expanded: 25 | - /Current View1 26 | Name: Views 27 | Splitter Ratio: 0.5 28 | - Class: rviz_common/Time 29 | Experimental: false 30 | Name: Time 31 | SyncMode: 0 32 | SyncSource: "" 33 | Visualization Manager: 34 | Class: "" 35 | Displays: 36 | - Alpha: 0.5 37 | Cell Size: 1 38 | Class: rviz_default_plugins/Grid 39 | Color: 160; 160; 164 40 | Enabled: true 41 | Line Style: 42 | Line Width: 0.029999999329447746 43 | Value: Lines 44 | Name: Grid 45 | Normal Cell Count: 0 46 | Offset: 47 | X: 0 48 | Y: 0 49 | Z: 0 50 | Plane: XY 51 | Plane Cell Count: 10 52 | Reference Frame: 53 | Value: true 54 | - Class: rviz_default_plugins/TF 55 | Enabled: true 56 | Frame Timeout: 15 57 | Frames: 58 | All Enabled: true 59 | base_link: 60 | Value: true 61 | chassis: 62 | Value: true 63 | left_wheel: 64 | Value: true 65 | odom: 66 | Value: true 67 | right_wheel: 68 | Value: true 69 | steering_link: 70 | Value: true 71 | wheel_front_link: 72 | Value: true 73 | Marker Scale: 1 74 | Name: TF 75 | Show Arrows: true 76 | Show Axes: true 77 | Show Names: true 78 | Tree: 79 | odom: 80 | base_link: 81 | chassis: 82 | left_wheel: 83 | {} 84 | right_wheel: 85 | {} 86 | steering_link: 87 | wheel_front_link: 88 | {} 89 | Update Interval: 0 90 | Value: true 91 | - Alpha: 1 92 | Class: rviz_default_plugins/RobotModel 93 | Collision Enabled: true 94 | Description File: "" 95 | Description Source: Topic 96 | Description Topic: 97 | Depth: 5 98 | Durability Policy: Volatile 99 | History Policy: Keep Last 100 | Reliability Policy: Reliable 101 | Value: /robot_description 102 | Enabled: true 103 | Links: 104 | All Links Enabled: true 105 | Expand Joint Details: false 106 | Expand Link Details: false 107 | Expand Tree: false 108 | Link Tree Style: Links in Alphabetic Order 109 | base_link: 110 | Alpha: 1 111 | Show Axes: false 112 | Show Trail: false 113 | chassis: 114 | Alpha: 1 115 | Show Axes: false 116 | Show Trail: false 117 | Value: true 118 | left_wheel: 119 | Alpha: 1 120 | Show Axes: false 121 | Show Trail: false 122 | Value: true 123 | right_wheel: 124 | Alpha: 1 125 | Show Axes: false 126 | Show Trail: false 127 | Value: true 128 | steering_link: 129 | Alpha: 1 130 | Show Axes: false 131 | Show Trail: false 132 | Value: true 133 | wheel_front_link: 134 | Alpha: 1 135 | Show Axes: false 136 | Show Trail: false 137 | Value: true 138 | Mass Properties: 139 | Inertia: false 140 | Mass: false 141 | Name: RobotModel 142 | TF Prefix: "" 143 | Update Interval: 0 144 | Value: true 145 | Visual Enabled: true 146 | Enabled: true 147 | Global Options: 148 | Background Color: 48; 48; 48 149 | Fixed Frame: odom 150 | Frame Rate: 30 151 | Name: root 152 | Tools: 153 | - Class: rviz_default_plugins/Interact 154 | Hide Inactive Objects: true 155 | - Class: rviz_default_plugins/MoveCamera 156 | - Class: rviz_default_plugins/Select 157 | - Class: rviz_default_plugins/FocusCamera 158 | - Class: rviz_default_plugins/Measure 159 | Line color: 128; 128; 0 160 | - Class: rviz_default_plugins/SetInitialPose 161 | Covariance x: 0.25 162 | Covariance y: 0.25 163 | Covariance yaw: 0.06853891909122467 164 | Topic: 165 | Depth: 5 166 | Durability Policy: Volatile 167 | History Policy: Keep Last 168 | Reliability Policy: Reliable 169 | Value: /initialpose 170 | - Class: rviz_default_plugins/SetGoal 171 | Topic: 172 | Depth: 5 173 | Durability Policy: Volatile 174 | History Policy: Keep Last 175 | Reliability Policy: Reliable 176 | Value: /goal_pose 177 | - Class: rviz_default_plugins/PublishPoint 178 | Single click: true 179 | Topic: 180 | Depth: 5 181 | Durability Policy: Volatile 182 | History Policy: Keep Last 183 | Reliability Policy: Reliable 184 | Value: /clicked_point 185 | Transformation: 186 | Current: 187 | Class: rviz_default_plugins/TF 188 | Value: true 189 | Views: 190 | Current: 191 | Class: rviz_default_plugins/Orbit 192 | Distance: 9.402809143066406 193 | Enable Stereo Rendering: 194 | Stereo Eye Separation: 0.05999999865889549 195 | Stereo Focal Distance: 1 196 | Swap Stereo Eyes: false 197 | Value: false 198 | Focal Point: 199 | X: -0.8695068955421448 200 | Y: -0.05153140798211098 201 | Z: -0.16355116665363312 202 | Focal Shape Fixed Size: true 203 | Focal Shape Size: 0.05000000074505806 204 | Invert Z Axis: false 205 | Name: Current View 206 | Near Clip Distance: 0.009999999776482582 207 | Pitch: 0.2903985381126404 208 | Target Frame: 209 | Value: Orbit (rviz) 210 | Yaw: 3.6204142570495605 211 | Saved: ~ 212 | Window Geometry: 213 | Displays: 214 | collapsed: false 215 | Height: 1032 216 | Hide Left Dock: false 217 | Hide Right Dock: true 218 | QMainWindow State: 000000ff00000000fd0000000400000000000002380000036efc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b0000036e000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f0000036efc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003b0000036e000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007800000003efc0100000002fb0000000800540069006d00650100000000000007800000025300fffffffb0000000800540069006d00650100000000000004500000000000000000000005420000036e00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 219 | Selection: 220 | collapsed: false 221 | Time: 222 | collapsed: false 223 | Tool Properties: 224 | collapsed: false 225 | Views: 226 | collapsed: true 227 | Width: 1920 228 | X: 1920 229 | Y: 24 230 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/diff_drive_controller.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | use_sim_time: true 5 | 6 | joint_state_broadcaster: 7 | type: joint_state_broadcaster/JointStateBroadcaster 8 | 9 | diff_drive_base_controller: 10 | type: diff_drive_controller/DiffDriveController 11 | 12 | diff_drive_base_controller: 13 | ros__parameters: 14 | left_wheel_names: ["left_wheel_joint"] 15 | right_wheel_names: ["right_wheel_joint"] 16 | 17 | wheel_separation: 1.25 18 | #wheels_per_side: 1 # actually 2, but both are controlled by 1 signal 19 | wheel_radius: 0.3 20 | 21 | wheel_separation_multiplier: 1.0 22 | left_wheel_radius_multiplier: 1.0 23 | right_wheel_radius_multiplier: 1.0 24 | 25 | publish_rate: 50.0 26 | odom_frame_id: odom 27 | base_frame_id: chassis 28 | pose_covariance_diagonal : [0.001, 0.001, 0.0, 0.0, 0.0, 0.01] 29 | twist_covariance_diagonal: [0.001, 0.0, 0.0, 0.0, 0.0, 0.01] 30 | 31 | open_loop: true 32 | enable_odom_tf: true 33 | 34 | cmd_vel_timeout: 0.5 35 | #publish_limited_velocity: true 36 | #velocity_rolling_window_size: 10 37 | 38 | # Velocity and acceleration limits 39 | # Whenever a min_* is unspecified, default to -max_* 40 | linear.x.has_velocity_limits: true 41 | linear.x.has_acceleration_limits: true 42 | linear.x.has_jerk_limits: false 43 | linear.x.max_velocity: 1.0 44 | linear.x.min_velocity: -1.0 45 | linear.x.max_acceleration: 1.0 46 | linear.x.max_jerk: 0.0 47 | linear.x.min_jerk: 0.0 48 | 49 | angular.z.has_velocity_limits: true 50 | angular.z.has_acceleration_limits: true 51 | angular.z.has_jerk_limits: false 52 | angular.z.max_velocity: 1.0 53 | angular.z.min_velocity: -1.0 54 | angular.z.max_acceleration: 1.0 55 | angular.z.min_acceleration: -1.0 56 | angular.z.max_jerk: 0.0 57 | angular.z.min_jerk: 0.0 58 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/diff_drive_controller_namespaced.yaml: -------------------------------------------------------------------------------- 1 | /**/controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | use_sim_time: true 5 | 6 | joint_state_broadcaster: 7 | type: joint_state_broadcaster/JointStateBroadcaster 8 | 9 | diff_drive_base_controller: 10 | type: diff_drive_controller/DiffDriveController 11 | 12 | /**/diff_drive_base_controller: 13 | ros__parameters: 14 | left_wheel_names: ["left_wheel_joint"] 15 | right_wheel_names: ["right_wheel_joint"] 16 | 17 | wheel_separation: 1.25 18 | wheel_radius: 0.3 19 | 20 | wheel_separation_multiplier: 1.0 21 | left_wheel_radius_multiplier: 1.0 22 | right_wheel_radius_multiplier: 1.0 23 | 24 | publish_rate: 50.0 25 | odom_frame_id: odom 26 | base_frame_id: chassis 27 | pose_covariance_diagonal : [0.001, 0.001, 0.0, 0.0, 0.0, 0.01] 28 | twist_covariance_diagonal: [0.001, 0.0, 0.0, 0.0, 0.0, 0.01] 29 | 30 | open_loop: true 31 | enable_odom_tf: true 32 | 33 | cmd_vel_timeout: 0.5 34 | #publish_limited_velocity: true 35 | #velocity_rolling_window_size: 10 36 | 37 | # Velocity and acceleration limits 38 | # Whenever a min_* is unspecified, default to -max_* 39 | linear.x.max_velocity: 1.0 40 | linear.x.min_velocity: -1.0 41 | linear.x.max_acceleration: 1.0 42 | linear.x.max_jerk: 0.0 43 | linear.x.min_jerk: 0.0 44 | 45 | angular.z.max_velocity: 1.0 46 | angular.z.min_velocity: -1.0 47 | angular.z.max_acceleration: 1.0 48 | angular.z.min_acceleration: -1.0 49 | angular.z.max_jerk: 0.0 50 | angular.z.min_jerk: 0.0 51 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/gripper_controller_effort.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | 5 | gripper_controller: 6 | type: forward_command_controller/ForwardCommandController 7 | 8 | joint_state_broadcaster: 9 | type: joint_state_broadcaster/JointStateBroadcaster 10 | 11 | gripper_controller: 12 | ros__parameters: 13 | joints: 14 | - right_finger_joint 15 | interface_name: effort 16 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/gripper_controller_position.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 100 # Hz 4 | 5 | gripper_controller: 6 | type: forward_command_controller/ForwardCommandController 7 | 8 | joint_state_broadcaster: 9 | type: joint_state_broadcaster/JointStateBroadcaster 10 | 11 | gripper_controller: 12 | ros__parameters: 13 | joints: 14 | - right_finger_joint 15 | interface_name: position 16 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/config/tricycle_drive_controller.yaml: -------------------------------------------------------------------------------- 1 | controller_manager: 2 | ros__parameters: 3 | update_rate: 50 # Hz 4 | use_sim_time: true 5 | 6 | tricycle_controller: 7 | type: tricycle_controller/TricycleController 8 | 9 | joint_state_broadcaster: 10 | type: joint_state_broadcaster/JointStateBroadcaster 11 | 12 | joint_state_broadcaster: 13 | ros__parameters: 14 | extra_joints: ["right_wheel_joint", "left_wheel_joint"] 15 | 16 | tricycle_controller: 17 | ros__parameters: 18 | # Model 19 | traction_joint_name: traction_joint # Name of traction joint in URDF 20 | steering_joint_name: steering_joint # Name of steering joint in URDF 21 | wheel_radius: 0.3 # Radius of front wheel 22 | wheelbase: 1.7 # Distance between center of back wheels and front wheel 23 | 24 | # Odometry 25 | odom_frame_id: odom 26 | base_frame_id: base_link 27 | open_loop: false # if True, uses cmd_vel instead of hardware interface feedback to compute odometry 28 | enable_odom_tf: true # If True, publishes odom<-base_link TF 29 | odom_only_twist: false # If True, publishes on /odom only linear.x and angular.z; Useful for computing odometry in another node, e.g robot_localization's ekf 30 | pose_covariance_diagonal: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # Need to be set if fusing odom with other localization source 31 | twist_covariance_diagonal: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # Need to be set if fusing odom with other localization source 32 | velocity_rolling_window_size: 10 # Rolling window size of rcppmath::RollingMeanAccumulator applied on linear and angular speeds published on odom 33 | 34 | # Rate Limiting 35 | traction: # All values should be positive 36 | # min_velocity: 0.0 37 | # max_velocity: 1000.0 38 | # min_acceleration: 0.0 39 | max_acceleration: 5.0 40 | # min_deceleration: 0.0 41 | max_deceleration: 8.0 42 | # min_jerk: 0.0 43 | # max_jerk: 1000.0 44 | steering: 45 | min_position: -1.57 46 | max_position: 1.57 47 | # min_velocity: 0.0 48 | max_velocity: 1.0 49 | # min_acceleration: 0.0 50 | # max_acceleration: 1000.0 51 | 52 | # cmd_vel input 53 | cmd_vel_timeout: 500 # In milliseconds. Timeout to stop if no cmd_vel is received 54 | 55 | # Debug 56 | publish_ackermann_command: true # Publishes AckermannDrive. The speed does not comply to the msg definition, it the wheel angular speed in rad/s. 57 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/examples/example_diff_drive.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | 19 | #include 20 | 21 | using namespace std::chrono_literals; 22 | 23 | int main(int argc, char * argv[]) 24 | { 25 | rclcpp::init(argc, argv); 26 | 27 | std::shared_ptr node = 28 | std::make_shared("diff_drive_test_node"); 29 | 30 | auto publisher = node->create_publisher( 31 | "/diff_drive_base_controller/cmd_vel", 10); 32 | 33 | RCLCPP_INFO(node->get_logger(), "node created"); 34 | 35 | geometry_msgs::msg::TwistStamped command; 36 | 37 | command.header.stamp = node->now(); 38 | 39 | command.twist.linear.x = 0.2; 40 | command.twist.linear.y = 0.0; 41 | command.twist.linear.z = 0.0; 42 | 43 | command.twist.angular.x = 0.0; 44 | command.twist.angular.y = 0.0; 45 | command.twist.angular.z = 0.1; 46 | 47 | while (1) { 48 | publisher->publish(command); 49 | std::this_thread::sleep_for(50ms); 50 | rclcpp::spin_some(node); 51 | } 52 | rclcpp::shutdown(); 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/examples/example_effort.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "rclcpp/rclcpp.hpp" 20 | 21 | #include "std_msgs/msg/float64_multi_array.hpp" 22 | 23 | std::shared_ptr node; 24 | 25 | int main(int argc, char * argv[]) 26 | { 27 | rclcpp::init(argc, argv); 28 | 29 | node = std::make_shared("effort_test_node"); 30 | 31 | auto publisher = node->create_publisher( 32 | "/effort_controller/commands", 10); 33 | 34 | RCLCPP_INFO(node->get_logger(), "node created"); 35 | 36 | std_msgs::msg::Float64MultiArray commands; 37 | 38 | using namespace std::chrono_literals; 39 | 40 | commands.data.push_back(0); 41 | publisher->publish(commands); 42 | std::this_thread::sleep_for(1s); 43 | 44 | commands.data[0] = 100; 45 | publisher->publish(commands); 46 | std::this_thread::sleep_for(1s); 47 | 48 | commands.data[0] = -200; 49 | publisher->publish(commands); 50 | std::this_thread::sleep_for(1s); 51 | 52 | commands.data[0] = 0; 53 | publisher->publish(commands); 54 | std::this_thread::sleep_for(1s); 55 | rclcpp::shutdown(); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/examples/example_gripper.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Stogl Robotics Consulting UG (haftungsbeschränkt) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "rclcpp/rclcpp.hpp" 20 | 21 | #include "std_msgs/msg/float64_multi_array.hpp" 22 | 23 | std::shared_ptr node; 24 | 25 | int main(int argc, char * argv[]) 26 | { 27 | rclcpp::init(argc, argv); 28 | 29 | node = std::make_shared("gripper_test_node"); 30 | 31 | auto publisher = node->create_publisher( 32 | "/gripper_controller/commands", 10); 33 | 34 | RCLCPP_INFO(node->get_logger(), "node created"); 35 | 36 | std_msgs::msg::Float64MultiArray commands; 37 | 38 | using namespace std::chrono_literals; 39 | 40 | commands.data.push_back(0); 41 | publisher->publish(commands); 42 | std::this_thread::sleep_for(1s); 43 | 44 | commands.data[0] = 0.38; 45 | publisher->publish(commands); 46 | std::this_thread::sleep_for(1s); 47 | 48 | commands.data[0] = 0.19; 49 | publisher->publish(commands); 50 | std::this_thread::sleep_for(1s); 51 | 52 | commands.data[0] = 0; 53 | publisher->publish(commands); 54 | std::this_thread::sleep_for(1s); 55 | rclcpp::shutdown(); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/examples/example_position.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "rclcpp/rclcpp.hpp" 20 | #include "rclcpp_action/rclcpp_action.hpp" 21 | 22 | #include "control_msgs/action/follow_joint_trajectory.hpp" 23 | 24 | std::shared_ptr node; 25 | bool common_goal_accepted = false; 26 | rclcpp_action::ResultCode common_resultcode = rclcpp_action::ResultCode::UNKNOWN; 27 | int common_action_result_code = control_msgs::action::FollowJointTrajectory_Result::SUCCESSFUL; 28 | 29 | void common_goal_response( 30 | rclcpp_action::ClientGoalHandle 31 | ::SharedPtr goal_handle) 32 | { 33 | RCLCPP_DEBUG( 34 | node->get_logger(), "common_goal_response time: %f", 35 | rclcpp::Clock().now().seconds()); 36 | if (!goal_handle) { 37 | common_goal_accepted = false; 38 | printf("Goal rejected\n"); 39 | } else { 40 | common_goal_accepted = true; 41 | printf("Goal accepted\n"); 42 | } 43 | } 44 | 45 | void common_result_response( 46 | const rclcpp_action::ClientGoalHandle 47 | ::WrappedResult & result) 48 | { 49 | printf("common_result_response time: %f\n", rclcpp::Clock().now().seconds()); 50 | common_resultcode = result.code; 51 | common_action_result_code = result.result->error_code; 52 | switch (result.code) { 53 | case rclcpp_action::ResultCode::SUCCEEDED: 54 | printf("SUCCEEDED result code\n"); 55 | break; 56 | case rclcpp_action::ResultCode::ABORTED: 57 | printf("Goal was aborted\n"); 58 | return; 59 | case rclcpp_action::ResultCode::CANCELED: 60 | printf("Goal was canceled\n"); 61 | return; 62 | default: 63 | printf("Unknown result code\n"); 64 | return; 65 | } 66 | } 67 | 68 | void common_feedback( 69 | rclcpp_action::ClientGoalHandle::SharedPtr, 70 | const std::shared_ptr feedback) 71 | { 72 | std::cout << "feedback->desired.positions :"; 73 | for (auto & x : feedback->desired.positions) { 74 | std::cout << x << "\t"; 75 | } 76 | std::cout << std::endl; 77 | std::cout << "feedback->desired.velocities :"; 78 | for (auto & x : feedback->desired.velocities) { 79 | std::cout << x << "\t"; 80 | } 81 | std::cout << std::endl; 82 | } 83 | 84 | int main(int argc, char * argv[]) 85 | { 86 | rclcpp::init(argc, argv); 87 | 88 | node = std::make_shared("trajectory_test_node"); 89 | 90 | std::cout << "node created" << std::endl; 91 | 92 | rclcpp_action::Client::SharedPtr action_client; 93 | action_client = rclcpp_action::create_client( 94 | node->get_node_base_interface(), 95 | node->get_node_graph_interface(), 96 | node->get_node_logging_interface(), 97 | node->get_node_waitables_interface(), 98 | "/joint_trajectory_controller/follow_joint_trajectory"); 99 | 100 | bool response = 101 | action_client->wait_for_action_server(std::chrono::seconds(1)); 102 | if (!response) { 103 | throw std::runtime_error("could not get action server"); 104 | } 105 | std::cout << "Created action server" << std::endl; 106 | 107 | std::vector joint_names = {"slider_to_cart"}; 108 | 109 | std::vector points; 110 | trajectory_msgs::msg::JointTrajectoryPoint point; 111 | point.time_from_start = rclcpp::Duration::from_seconds(0.0); // start asap 112 | point.positions.resize(joint_names.size()); 113 | 114 | point.positions[0] = 0.0; 115 | 116 | trajectory_msgs::msg::JointTrajectoryPoint point2; 117 | point2.time_from_start = rclcpp::Duration::from_seconds(1.0); 118 | point2.positions.resize(joint_names.size()); 119 | point2.positions[0] = -1.0; 120 | 121 | trajectory_msgs::msg::JointTrajectoryPoint point3; 122 | point3.time_from_start = rclcpp::Duration::from_seconds(2.0); 123 | point3.positions.resize(joint_names.size()); 124 | point3.positions[0] = 1.0; 125 | 126 | trajectory_msgs::msg::JointTrajectoryPoint point4; 127 | point4.time_from_start = rclcpp::Duration::from_seconds(3.0); 128 | point4.positions.resize(joint_names.size()); 129 | point4.positions[0] = 0.0; 130 | 131 | points.push_back(point); 132 | points.push_back(point2); 133 | points.push_back(point3); 134 | points.push_back(point4); 135 | 136 | rclcpp_action::Client::SendGoalOptions opt; 137 | opt.goal_response_callback = std::bind(common_goal_response, std::placeholders::_1); 138 | opt.result_callback = std::bind(common_result_response, std::placeholders::_1); 139 | opt.feedback_callback = std::bind(common_feedback, std::placeholders::_1, std::placeholders::_2); 140 | 141 | control_msgs::action::FollowJointTrajectory_Goal goal_msg; 142 | goal_msg.goal_time_tolerance = rclcpp::Duration::from_seconds(1.0); 143 | goal_msg.trajectory.joint_names = joint_names; 144 | goal_msg.trajectory.points = points; 145 | 146 | auto goal_handle_future = action_client->async_send_goal(goal_msg, opt); 147 | 148 | if (rclcpp::spin_until_future_complete(node, goal_handle_future) != 149 | rclcpp::FutureReturnCode::SUCCESS) 150 | { 151 | RCLCPP_ERROR(node->get_logger(), "send goal call failed :("); 152 | action_client.reset(); 153 | node.reset(); 154 | return 1; 155 | } 156 | RCLCPP_INFO(node->get_logger(), "send goal call ok :)"); 157 | 158 | rclcpp_action::ClientGoalHandle::SharedPtr 159 | goal_handle = goal_handle_future.get(); 160 | if (!goal_handle) { 161 | RCLCPP_ERROR(node->get_logger(), "Goal was rejected by server"); 162 | action_client.reset(); 163 | node.reset(); 164 | return 1; 165 | } 166 | RCLCPP_INFO(node->get_logger(), "Goal was accepted by server"); 167 | 168 | // Wait for the server to be done with the goal 169 | auto result_future = action_client->async_get_result(goal_handle); 170 | RCLCPP_INFO(node->get_logger(), "Waiting for result"); 171 | if (rclcpp::spin_until_future_complete(node, result_future) != 172 | rclcpp::FutureReturnCode::SUCCESS) 173 | { 174 | RCLCPP_ERROR(node->get_logger(), "get result call failed :("); 175 | return 1; 176 | } 177 | 178 | action_client.reset(); 179 | node.reset(); 180 | rclcpp::shutdown(); 181 | 182 | return 0; 183 | } 184 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/examples/example_position_pid.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "rclcpp/rclcpp.hpp" 20 | 21 | #include "std_msgs/msg/float64_multi_array.hpp" 22 | 23 | std::shared_ptr node; 24 | 25 | int main(int argc, char * argv[]) 26 | { 27 | rclcpp::init(argc, argv); 28 | 29 | node = std::make_shared("velocity_test_node"); 30 | 31 | auto publisher = node->create_publisher( 32 | "/position_controller/commands", 10); 33 | 34 | RCLCPP_INFO(node->get_logger(), "node created"); 35 | 36 | std_msgs::msg::Float64MultiArray commands; 37 | 38 | using namespace std::chrono_literals; 39 | 40 | commands.data.push_back(0); 41 | publisher->publish(commands); 42 | std::this_thread::sleep_for(1s); 43 | 44 | commands.data[0] = 1; 45 | publisher->publish(commands); 46 | std::this_thread::sleep_for(1s); 47 | 48 | commands.data[0] = -1; 49 | publisher->publish(commands); 50 | std::this_thread::sleep_for(1s); 51 | 52 | commands.data[0] = 0; 53 | publisher->publish(commands); 54 | std::this_thread::sleep_for(1s); 55 | rclcpp::shutdown(); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/examples/example_tricycle_drive.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include 18 | 19 | #include 20 | 21 | using namespace std::chrono_literals; 22 | 23 | int main(int argc, char * argv[]) 24 | { 25 | rclcpp::init(argc, argv); 26 | 27 | std::shared_ptr node = 28 | std::make_shared("tricycle_drive_test_node"); 29 | 30 | auto publisher = node->create_publisher( 31 | "/tricycle_controller/cmd_vel", 10); 32 | 33 | RCLCPP_INFO(node->get_logger(), "node created"); 34 | 35 | geometry_msgs::msg::TwistStamped command; 36 | 37 | command.header.stamp = node->now(); 38 | 39 | command.twist.linear.x = 0.2; 40 | command.twist.linear.y = 0.0; 41 | command.twist.linear.z = 0.0; 42 | 43 | command.twist.angular.x = 0.0; 44 | command.twist.angular.y = 0.0; 45 | command.twist.angular.z = 0.1; 46 | 47 | while (1) { 48 | publisher->publish(command); 49 | std::this_thread::sleep_for(50ms); 50 | rclcpp::spin_some(node); 51 | } 52 | rclcpp::shutdown(); 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/examples/example_velocity.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "rclcpp/rclcpp.hpp" 20 | 21 | #include "std_msgs/msg/float64_multi_array.hpp" 22 | 23 | std::shared_ptr node; 24 | 25 | int main(int argc, char * argv[]) 26 | { 27 | rclcpp::init(argc, argv); 28 | 29 | node = std::make_shared("velocity_test_node"); 30 | 31 | auto publisher = node->create_publisher( 32 | "/velocity_controller/commands", 10); 33 | 34 | RCLCPP_INFO(node->get_logger(), "node created"); 35 | 36 | std_msgs::msg::Float64MultiArray commands; 37 | 38 | using namespace std::chrono_literals; 39 | 40 | commands.data.push_back(0); 41 | publisher->publish(commands); 42 | std::this_thread::sleep_for(1s); 43 | 44 | commands.data[0] = 1; 45 | publisher->publish(commands); 46 | std::this_thread::sleep_for(1s); 47 | 48 | commands.data[0] = -1; 49 | publisher->publish(commands); 50 | std::this_thread::sleep_for(1s); 51 | 52 | commands.data[0] = 0; 53 | publisher->publish(commands); 54 | std::this_thread::sleep_for(1s); 55 | rclcpp::shutdown(); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/cart_example_effort.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_cart_effort.xacro.urdf') 42 | 43 | doc = xacro.parse(open(xacro_file)) 44 | xacro.process_doc(doc) 45 | params = {'robot_description': doc.toxml()} 46 | 47 | node_robot_state_publisher = Node( 48 | package='robot_state_publisher', 49 | executable='robot_state_publisher', 50 | output='screen', 51 | parameters=[params] 52 | ) 53 | 54 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 55 | arguments=['-topic', 'robot_description', 56 | '-entity', 'cart'], 57 | output='screen') 58 | 59 | load_joint_state_broadcaster = ExecuteProcess( 60 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 61 | 'joint_state_broadcaster'], 62 | output='screen' 63 | ) 64 | 65 | load_joint_trajectory_controller = ExecuteProcess( 66 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 'effort_controller'], 67 | output='screen' 68 | ) 69 | 70 | return LaunchDescription([ 71 | RegisterEventHandler( 72 | event_handler=OnProcessExit( 73 | target_action=spawn_entity, 74 | on_exit=[load_joint_state_broadcaster], 75 | ) 76 | ), 77 | RegisterEventHandler( 78 | event_handler=OnProcessExit( 79 | target_action=load_joint_state_broadcaster, 80 | on_exit=[load_joint_trajectory_controller], 81 | ) 82 | ), 83 | gazebo, 84 | node_robot_state_publisher, 85 | spawn_entity, 86 | ]) 87 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/cart_example_position.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_cart_position.xacro.urdf') 42 | 43 | doc = xacro.parse(open(xacro_file)) 44 | xacro.process_doc(doc) 45 | params = {'robot_description': doc.toxml()} 46 | 47 | node_robot_state_publisher = Node( 48 | package='robot_state_publisher', 49 | executable='robot_state_publisher', 50 | output='screen', 51 | parameters=[params] 52 | ) 53 | 54 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 55 | arguments=['-topic', 'robot_description', 56 | '-entity', 'cart'], 57 | output='screen') 58 | 59 | load_joint_state_broadcaster = ExecuteProcess( 60 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 61 | 'joint_state_broadcaster'], 62 | output='screen' 63 | ) 64 | 65 | load_joint_trajectory_controller = ExecuteProcess( 66 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 67 | 'joint_trajectory_controller'], 68 | output='screen' 69 | ) 70 | 71 | return LaunchDescription([ 72 | RegisterEventHandler( 73 | event_handler=OnProcessExit( 74 | target_action=spawn_entity, 75 | on_exit=[load_joint_state_broadcaster], 76 | ) 77 | ), 78 | RegisterEventHandler( 79 | event_handler=OnProcessExit( 80 | target_action=load_joint_state_broadcaster, 81 | on_exit=[load_joint_trajectory_controller], 82 | ) 83 | ), 84 | gazebo, 85 | node_robot_state_publisher, 86 | spawn_entity, 87 | ]) 88 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/cart_example_velocity.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_cart_velocity.xacro.urdf') 42 | doc = xacro.parse(open(xacro_file)) 43 | xacro.process_doc(doc) 44 | params = {'robot_description': doc.toxml()} 45 | 46 | node_robot_state_publisher = Node( 47 | package='robot_state_publisher', 48 | executable='robot_state_publisher', 49 | output='screen', 50 | parameters=[params] 51 | ) 52 | 53 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 54 | arguments=['-topic', 'robot_description', 55 | '-entity', 'cart'], 56 | output='screen') 57 | 58 | load_joint_state_broadcaster = ExecuteProcess( 59 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 60 | 'joint_state_broadcaster'], 61 | output='screen' 62 | ) 63 | 64 | load_joint_trajectory_controller = ExecuteProcess( 65 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 'velocity_controller'], 66 | output='screen' 67 | ) 68 | 69 | load_imu_sensor_broadcaster = ExecuteProcess( 70 | cmd=['ros2', 'control', 'load_controller', 'imu_sensor_broadcaster'], 71 | output='screen' 72 | ) 73 | 74 | return LaunchDescription([ 75 | RegisterEventHandler( 76 | event_handler=OnProcessExit( 77 | target_action=spawn_entity, 78 | on_exit=[load_joint_state_broadcaster], 79 | ) 80 | ), 81 | RegisterEventHandler( 82 | event_handler=OnProcessExit( 83 | target_action=load_joint_state_broadcaster, 84 | on_exit=[load_joint_trajectory_controller], 85 | ) 86 | ), 87 | RegisterEventHandler( 88 | event_handler=OnProcessExit( 89 | target_action=load_joint_trajectory_controller, 90 | on_exit=[load_imu_sensor_broadcaster], 91 | ) 92 | ), 93 | gazebo, 94 | node_robot_state_publisher, 95 | spawn_entity, 96 | ]) 97 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/diff_drive.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_diff_drive.xacro.urdf') 42 | 43 | doc = xacro.parse(open(xacro_file)) 44 | xacro.process_doc(doc) 45 | params = {'robot_description': doc.toxml()} 46 | 47 | node_robot_state_publisher = Node( 48 | package='robot_state_publisher', 49 | executable='robot_state_publisher', 50 | output='screen', 51 | parameters=[params] 52 | ) 53 | 54 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 55 | arguments=['-topic', 'robot_description', 56 | '-entity', 'diffbot'], 57 | output='screen') 58 | 59 | load_joint_state_broadcaster = ExecuteProcess( 60 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 61 | 'joint_state_broadcaster'], 62 | output='screen' 63 | ) 64 | 65 | load_diff_drive_base_controller = ExecuteProcess( 66 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 67 | 'diff_drive_base_controller'], 68 | output='screen' 69 | ) 70 | 71 | return LaunchDescription([ 72 | RegisterEventHandler( 73 | event_handler=OnProcessExit( 74 | target_action=spawn_entity, 75 | on_exit=[load_joint_state_broadcaster], 76 | ) 77 | ), 78 | RegisterEventHandler( 79 | event_handler=OnProcessExit( 80 | target_action=load_joint_state_broadcaster, 81 | on_exit=[load_diff_drive_base_controller], 82 | ) 83 | ), 84 | gazebo, 85 | node_robot_state_publisher, 86 | spawn_entity, 87 | ]) 88 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/diff_drive_namespaced.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_diff_drive_namespaced.xacro.urdf') 42 | 43 | doc = xacro.parse(open(xacro_file)) 44 | xacro.process_doc(doc) 45 | params = {'robot_description': doc.toxml()} 46 | 47 | node_robot_state_publisher = Node( 48 | package='robot_state_publisher', 49 | executable='robot_state_publisher', 50 | namespace='r1', 51 | output='screen', 52 | parameters=[params] 53 | ) 54 | 55 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 56 | namespace='r1', 57 | arguments=['-topic', 'robot_description', 58 | '-entity', 'diffbot'], 59 | output='screen') 60 | 61 | load_joint_state_broadcaster = ExecuteProcess( 62 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 63 | 'joint_state_broadcaster', 64 | '-c', '/r1/controller_manager'], 65 | output='screen' 66 | ) 67 | 68 | load_diff_drive_base_controller = ExecuteProcess( 69 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 70 | 'diff_drive_base_controller', 71 | '-c', '/r1/controller_manager'], 72 | output='screen' 73 | ) 74 | 75 | return LaunchDescription([ 76 | RegisterEventHandler( 77 | event_handler=OnProcessExit( 78 | target_action=spawn_entity, 79 | on_exit=[load_joint_state_broadcaster], 80 | ) 81 | ), 82 | RegisterEventHandler( 83 | event_handler=OnProcessExit( 84 | target_action=load_joint_state_broadcaster, 85 | on_exit=[load_diff_drive_base_controller], 86 | ) 87 | ), 88 | gazebo, 89 | node_robot_state_publisher, 90 | spawn_entity, 91 | ]) 92 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/diff_drive_pair_namespaced.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_diff_drive_namespaced.xacro.urdf') 42 | 43 | doc = xacro.parse(open(xacro_file)) 44 | xacro.process_doc(doc) 45 | params = {'robot_description': doc.toxml()} 46 | 47 | node_robot_state_publisher_r1 = Node( 48 | package='robot_state_publisher', 49 | executable='robot_state_publisher', 50 | namespace='r1', 51 | output='screen', 52 | parameters=[params] 53 | ) 54 | 55 | node_robot_state_publisher_r2 = Node( 56 | package='robot_state_publisher', 57 | executable='robot_state_publisher', 58 | namespace='r2', 59 | output='screen', 60 | parameters=[params] 61 | ) 62 | 63 | spawn_entity_r1 = Node( 64 | package='gazebo_ros', executable='spawn_entity.py', 65 | arguments=[ 66 | '-topic', '/r1/robot_description', 67 | '-robot_namespace', 'r1', 68 | '-entity', 'diffbot1' 69 | ], 70 | output='screen' 71 | ) 72 | 73 | spawn_entity_r2 = Node( 74 | package='gazebo_ros', executable='spawn_entity.py', 75 | arguments=[ 76 | '-topic', '/r2/robot_description', 77 | '-robot_namespace', 'r2', 78 | '-entity', 'diffbot1' 79 | ], 80 | output='screen' 81 | ) 82 | 83 | load_joint_state_broadcaster_r1 = ExecuteProcess( 84 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 85 | 'joint_state_broadcaster', 86 | '-c', '/r1/controller_manager'], 87 | output='screen' 88 | ) 89 | 90 | load_diff_drive_base_controller_r1 = ExecuteProcess( 91 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 92 | 'diff_drive_base_controller', 93 | '-c', '/r1/controller_manager'], 94 | output='screen' 95 | ) 96 | 97 | load_joint_state_broadcaster_r2 = ExecuteProcess( 98 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 99 | 'joint_state_broadcaster', 100 | '-c', '/r2/controller_manager'], 101 | output='screen' 102 | ) 103 | 104 | load_diff_drive_base_controller_r2 = ExecuteProcess( 105 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 106 | 'diff_drive_base_controller', 107 | '-c', '/r2/controller_manager'], 108 | output='screen' 109 | ) 110 | 111 | return LaunchDescription([ 112 | RegisterEventHandler( 113 | event_handler=OnProcessExit( 114 | target_action=spawn_entity_r1, 115 | on_exit=[ 116 | load_joint_state_broadcaster_r1, 117 | load_diff_drive_base_controller_r1 118 | ], 119 | ) 120 | ), 121 | RegisterEventHandler( 122 | event_handler=OnProcessExit( 123 | target_action=spawn_entity_r2, 124 | on_exit=[ 125 | load_joint_state_broadcaster_r2, 126 | load_diff_drive_base_controller_r2 127 | ], 128 | ) 129 | ), 130 | gazebo, 131 | node_robot_state_publisher_r1, 132 | node_robot_state_publisher_r2, 133 | spawn_entity_r1, 134 | spawn_entity_r2, 135 | ]) 136 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/gripper_mimic_joint_example_effort.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Stogl Robotics Consulting UG (haftungsbeschränkt) 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # Author: Denis Stogl 16 | 17 | from launch import LaunchDescription 18 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 19 | from launch.event_handlers import OnProcessExit 20 | from launch.launch_description_sources import PythonLaunchDescriptionSource 21 | from launch.substitutions import Command, FindExecutable, PathJoinSubstitution 22 | from launch_ros.actions import Node 23 | from launch_ros.substitutions import FindPackageShare 24 | 25 | 26 | def generate_launch_description(): 27 | 28 | robot_description_content = Command( 29 | [ 30 | PathJoinSubstitution([FindExecutable(name='xacro')]), 31 | ' ', 32 | PathJoinSubstitution( 33 | [FindPackageShare( 34 | 'gazebo_ros2_control_demos'), 35 | 'urdf', 36 | 'test_gripper_mimic_joint_effort.xacro.urdf'] 37 | ), 38 | ] 39 | ) 40 | robot_description = {'robot_description': robot_description_content} 41 | 42 | node_robot_state_publisher = Node( 43 | package='robot_state_publisher', 44 | executable='robot_state_publisher', 45 | output='screen', 46 | parameters=[robot_description] 47 | ) 48 | 49 | gazebo = IncludeLaunchDescription( 50 | PythonLaunchDescriptionSource( 51 | [FindPackageShare('gazebo_ros'), '/launch', '/gazebo.launch.py'] 52 | ), 53 | ) 54 | 55 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 56 | arguments=['-topic', 'robot_description', 57 | '-entity', 'gripper'], 58 | output='screen') 59 | 60 | load_joint_state_broadcaster = ExecuteProcess( 61 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 62 | 'joint_state_broadcaster'], 63 | output='screen' 64 | ) 65 | 66 | load_gripper_controller = ExecuteProcess( 67 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 68 | 'gripper_controller'], 69 | output='screen' 70 | ) 71 | 72 | return LaunchDescription([ 73 | RegisterEventHandler( 74 | event_handler=OnProcessExit( 75 | target_action=spawn_entity, 76 | on_exit=[load_joint_state_broadcaster], 77 | ) 78 | ), 79 | RegisterEventHandler( 80 | event_handler=OnProcessExit( 81 | target_action=load_joint_state_broadcaster, 82 | on_exit=[load_gripper_controller], 83 | ) 84 | ), 85 | gazebo, 86 | node_robot_state_publisher, 87 | spawn_entity, 88 | ]) 89 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/gripper_mimic_joint_example_position.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Stogl Robotics Consulting UG (haftungsbeschränkt) 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # Author: Denis Stogl 16 | 17 | from launch import LaunchDescription 18 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 19 | from launch.event_handlers import OnProcessExit 20 | from launch.launch_description_sources import PythonLaunchDescriptionSource 21 | from launch.substitutions import Command, FindExecutable, PathJoinSubstitution 22 | from launch_ros.actions import Node 23 | from launch_ros.substitutions import FindPackageShare 24 | 25 | 26 | def generate_launch_description(): 27 | 28 | robot_description_content = Command( 29 | [ 30 | PathJoinSubstitution([FindExecutable(name='xacro')]), 31 | " ", 32 | PathJoinSubstitution( 33 | [FindPackageShare( 34 | 'gazebo_ros2_control_demos'), 35 | 'urdf', 36 | 'test_gripper_mimic_joint_position.xacro.urdf'] 37 | ), 38 | ] 39 | ) 40 | robot_description = {"robot_description": robot_description_content} 41 | 42 | node_robot_state_publisher = Node( 43 | package='robot_state_publisher', 44 | executable='robot_state_publisher', 45 | output='screen', 46 | parameters=[robot_description] 47 | ) 48 | 49 | gazebo = IncludeLaunchDescription( 50 | PythonLaunchDescriptionSource( 51 | [FindPackageShare("gazebo_ros"), "/launch", "/gazebo.launch.py"] 52 | ), 53 | ) 54 | 55 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 56 | arguments=['-topic', 'robot_description', 57 | '-entity', 'gripper'], 58 | output='screen') 59 | 60 | load_joint_state_controller = ExecuteProcess( 61 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 62 | 'joint_state_broadcaster'], 63 | output='screen' 64 | ) 65 | 66 | load_gripper_controller = ExecuteProcess( 67 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 68 | 'gripper_controller'], 69 | output='screen' 70 | ) 71 | 72 | return LaunchDescription([ 73 | RegisterEventHandler( 74 | event_handler=OnProcessExit( 75 | target_action=spawn_entity, 76 | on_exit=[load_joint_state_controller], 77 | ) 78 | ), 79 | RegisterEventHandler( 80 | event_handler=OnProcessExit( 81 | target_action=load_joint_state_controller, 82 | on_exit=[load_gripper_controller], 83 | ) 84 | ), 85 | gazebo, 86 | node_robot_state_publisher, 87 | spawn_entity, 88 | ]) 89 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/pendulum_example_effort.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 ros2_control Development Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_pendulum_effort.xacro.urdf') 42 | 43 | doc = xacro.parse(open(xacro_file)) 44 | xacro.process_doc(doc) 45 | params = {'robot_description': doc.toxml()} 46 | 47 | node_robot_state_publisher = Node( 48 | package='robot_state_publisher', 49 | executable='robot_state_publisher', 50 | output='screen', 51 | parameters=[params] 52 | ) 53 | 54 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 55 | arguments=['-topic', 'robot_description', 56 | '-entity', 'cartpole'], 57 | output='screen') 58 | 59 | load_joint_state_controller = ExecuteProcess( 60 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 61 | 'joint_state_broadcaster'], 62 | output='screen' 63 | ) 64 | 65 | load_joint_trajectory_controller = ExecuteProcess( 66 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 'effort_controller'], 67 | output='screen' 68 | ) 69 | 70 | return LaunchDescription([ 71 | RegisterEventHandler( 72 | event_handler=OnProcessExit( 73 | target_action=spawn_entity, 74 | on_exit=[load_joint_state_controller], 75 | ) 76 | ), 77 | RegisterEventHandler( 78 | event_handler=OnProcessExit( 79 | target_action=load_joint_state_controller, 80 | on_exit=[load_joint_trajectory_controller], 81 | ) 82 | ), 83 | gazebo, 84 | node_robot_state_publisher, 85 | spawn_entity, 86 | ]) 87 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/pendulum_example_position.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 ros2_control Development Team 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_pendulum_position.xacro.urdf') 42 | 43 | doc = xacro.parse(open(xacro_file)) 44 | xacro.process_doc(doc) 45 | params = {'robot_description': doc.toxml()} 46 | 47 | node_robot_state_publisher = Node( 48 | package='robot_state_publisher', 49 | executable='robot_state_publisher', 50 | output='screen', 51 | parameters=[params] 52 | ) 53 | 54 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 55 | arguments=['-topic', 'robot_description', 56 | '-entity', 'cartpole'], 57 | output='screen') 58 | 59 | load_joint_state_controller = ExecuteProcess( 60 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 61 | 'joint_state_broadcaster'], 62 | output='screen' 63 | ) 64 | 65 | load_joint_trajectory_controller = ExecuteProcess( 66 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 67 | 'joint_trajectory_controller'], 68 | output='screen' 69 | ) 70 | 71 | return LaunchDescription([ 72 | RegisterEventHandler( 73 | event_handler=OnProcessExit( 74 | target_action=spawn_entity, 75 | on_exit=[load_joint_state_controller], 76 | ) 77 | ), 78 | RegisterEventHandler( 79 | event_handler=OnProcessExit( 80 | target_action=load_joint_state_controller, 81 | on_exit=[load_joint_trajectory_controller], 82 | ) 83 | ), 84 | gazebo, 85 | node_robot_state_publisher, 86 | spawn_entity, 87 | ]) 88 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/tricycle_drive.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_tricycle_drive.xacro.urdf') 42 | 43 | doc = xacro.parse(open(xacro_file)) 44 | xacro.process_doc(doc) 45 | params = {'robot_description': doc.toxml()} 46 | 47 | node_robot_state_publisher = Node( 48 | package='robot_state_publisher', 49 | executable='robot_state_publisher', 50 | output='screen', 51 | parameters=[params] 52 | ) 53 | 54 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 55 | arguments=['-topic', 'robot_description', 56 | '-entity', 'tricycle'], 57 | output='screen') 58 | 59 | load_joint_state_broadcaster = ExecuteProcess( 60 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 61 | 'joint_state_broadcaster'], 62 | output='screen' 63 | ) 64 | 65 | load_tricycle_controller = ExecuteProcess( 66 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 67 | 'tricycle_controller'], 68 | output='screen' 69 | ) 70 | 71 | rviz = Node( 72 | package='rviz2', 73 | executable='rviz2', 74 | arguments=[ 75 | '-d', 76 | os.path.join(gazebo_ros2_control_demos_path, 'config/config.rviz'), 77 | ], 78 | output='screen', 79 | ) 80 | 81 | return LaunchDescription([ 82 | RegisterEventHandler( 83 | event_handler=OnProcessExit( 84 | target_action=spawn_entity, 85 | on_exit=[load_joint_state_broadcaster], 86 | ) 87 | ), 88 | RegisterEventHandler( 89 | event_handler=OnProcessExit( 90 | target_action=load_joint_state_broadcaster, 91 | on_exit=[load_tricycle_controller], 92 | ) 93 | ), 94 | gazebo, 95 | rviz, 96 | node_robot_state_publisher, 97 | spawn_entity, 98 | ]) 99 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/vertical_cart_example_position_pid.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_vertical_cart_position_pid.xacro.urdf') 42 | doc = xacro.parse(open(xacro_file)) 43 | xacro.process_doc(doc) 44 | params = {'robot_description': doc.toxml()} 45 | 46 | node_robot_state_publisher = Node( 47 | package='robot_state_publisher', 48 | executable='robot_state_publisher', 49 | output='screen', 50 | parameters=[params] 51 | ) 52 | 53 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 54 | arguments=['-topic', 'robot_description', 55 | '-entity', 'cart'], 56 | output='screen') 57 | 58 | load_joint_state_broadcaster = ExecuteProcess( 59 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 60 | 'joint_state_broadcaster'], 61 | output='screen' 62 | ) 63 | 64 | load_joint_trajectory_controller = ExecuteProcess( 65 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 'position_controller'], 66 | output='screen' 67 | ) 68 | 69 | return LaunchDescription([ 70 | RegisterEventHandler( 71 | event_handler=OnProcessExit( 72 | target_action=spawn_entity, 73 | on_exit=[load_joint_state_broadcaster], 74 | ) 75 | ), 76 | RegisterEventHandler( 77 | event_handler=OnProcessExit( 78 | target_action=load_joint_state_broadcaster, 79 | on_exit=[load_joint_trajectory_controller], 80 | ) 81 | ), 82 | gazebo, 83 | node_robot_state_publisher, 84 | spawn_entity, 85 | ]) 86 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/vertical_cart_example_position_pids_in_yaml.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_vertical_cart_position_pids_in_yaml.xacro.urdf') 42 | doc = xacro.parse(open(xacro_file)) 43 | xacro.process_doc(doc) 44 | params = {'robot_description': doc.toxml()} 45 | 46 | node_robot_state_publisher = Node( 47 | package='robot_state_publisher', 48 | executable='robot_state_publisher', 49 | output='screen', 50 | parameters=[params] 51 | ) 52 | 53 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 54 | arguments=['-topic', 'robot_description', 55 | '-entity', 'cart'], 56 | output='screen') 57 | 58 | load_joint_state_broadcaster = ExecuteProcess( 59 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 60 | 'joint_state_broadcaster'], 61 | output='screen' 62 | ) 63 | 64 | load_joint_trajectory_controller = ExecuteProcess( 65 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 'position_controller'], 66 | output='screen' 67 | ) 68 | 69 | return LaunchDescription([ 70 | RegisterEventHandler( 71 | event_handler=OnProcessExit( 72 | target_action=spawn_entity, 73 | on_exit=[load_joint_state_broadcaster], 74 | ) 75 | ), 76 | RegisterEventHandler( 77 | event_handler=OnProcessExit( 78 | target_action=load_joint_state_broadcaster, 79 | on_exit=[load_joint_trajectory_controller], 80 | ) 81 | ), 82 | gazebo, 83 | node_robot_state_publisher, 84 | spawn_entity, 85 | ]) 86 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/launch/vertical_cart_example_velocity_pid.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler 22 | from launch.event_handlers import OnProcessExit 23 | from launch.launch_description_sources import PythonLaunchDescriptionSource 24 | 25 | from launch_ros.actions import Node 26 | 27 | import xacro 28 | 29 | 30 | def generate_launch_description(): 31 | gazebo = IncludeLaunchDescription( 32 | PythonLaunchDescriptionSource([os.path.join( 33 | get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), 34 | ) 35 | 36 | gazebo_ros2_control_demos_path = os.path.join( 37 | get_package_share_directory('gazebo_ros2_control_demos')) 38 | 39 | xacro_file = os.path.join(gazebo_ros2_control_demos_path, 40 | 'urdf', 41 | 'test_vertical_cart_velocity_pid.xacro.urdf') 42 | doc = xacro.parse(open(xacro_file)) 43 | xacro.process_doc(doc) 44 | params = {'robot_description': doc.toxml()} 45 | 46 | node_robot_state_publisher = Node( 47 | package='robot_state_publisher', 48 | executable='robot_state_publisher', 49 | output='screen', 50 | parameters=[params] 51 | ) 52 | 53 | spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', 54 | arguments=['-topic', 'robot_description', 55 | '-entity', 'cart'], 56 | output='screen') 57 | 58 | load_joint_state_broadcaster = ExecuteProcess( 59 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 60 | 'joint_state_broadcaster'], 61 | output='screen' 62 | ) 63 | 64 | load_velocity_controller = ExecuteProcess( 65 | cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 'velocity_controller'], 66 | output='screen' 67 | ) 68 | 69 | return LaunchDescription([ 70 | RegisterEventHandler( 71 | event_handler=OnProcessExit( 72 | target_action=spawn_entity, 73 | on_exit=[load_joint_state_broadcaster], 74 | ) 75 | ), 76 | RegisterEventHandler( 77 | event_handler=OnProcessExit( 78 | target_action=load_joint_state_broadcaster, 79 | on_exit=[load_velocity_controller], 80 | ) 81 | ), 82 | gazebo, 83 | node_robot_state_publisher, 84 | spawn_entity, 85 | ]) 86 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | gazebo_ros2_control_demos 4 | 0.7.4 5 | gazebo_ros2_control_demos 6 | 7 | Alejandro Hernandez 8 | Bence Magyar 9 | 10 | Apache License 2.0 11 | 12 | http://ros.org/wiki/gazebo_ros_control 13 | https://github.com/ros-controls/gazebo_ros2_control/issues 14 | https://github.com/ros-controls/gazebo_ros2_control 15 | 16 | Alejandro Hernández 17 | 18 | ament_cmake 19 | 20 | control_msgs 21 | geometry_msgs 22 | rclcpp 23 | rclcpp_action 24 | std_msgs 25 | 26 | ament_index_python 27 | control_msgs 28 | diff_drive_controller 29 | tricycle_controller 30 | effort_controllers 31 | geometry_msgs 32 | gazebo_ros2_control 33 | gazebo_ros 34 | hardware_interface 35 | imu_sensor_broadcaster 36 | joint_trajectory_controller 37 | joint_state_broadcaster 38 | launch 39 | launch_ros 40 | robot_state_publisher 41 | ros2_control 42 | rclcpp 43 | std_msgs 44 | velocity_controllers 45 | xacro 46 | 47 | ament_cmake_gtest 48 | ament_lint_auto 49 | ament_lint_common 50 | 51 | 52 | ament_cmake 53 | 54 | 55 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_cart_effort.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | gazebo_ros2_control/GazeboSystem 51 | 52 | 53 | 54 | -1000 55 | 1000 56 | 57 | 58 | 1.0 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | $(find gazebo_ros2_control_demos)/config/cart_controller_effort.yaml 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_cart_position.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | gazebo_ros2_control/GazeboSystem 50 | 51 | 52 | 53 | -15 54 | 15 55 | 56 | 57 | 1.0 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | $(find gazebo_ros2_control_demos)/config/cart_controller.yaml 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_cart_velocity.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 1 63 | 10.0 64 | 65 | 66 | 67 | 68 | 69 | gazebo_ros2_control/GazeboSystem 70 | 71 | 72 | 73 | -10 74 | 10 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | $(find gazebo_ros2_control_demos)/config/cart_controller_velocity.yaml 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_diff_drive.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 132 | 133 | 134 | 135 | 136 | 137 | gazebo_ros2_control/GazeboSystem 138 | 139 | 140 | 141 | -1 142 | 1 143 | 144 | 145 | 146 | 147 | 148 | 149 | -1 150 | 1 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | $(find gazebo_ros2_control_demos)/config/diff_drive_controller.yaml 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_diff_drive_namespaced.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 132 | 133 | 134 | 135 | 136 | 137 | gazebo_ros2_control/GazeboSystem 138 | 139 | 140 | 141 | -1 142 | 1 143 | 144 | 145 | 146 | 147 | 148 | 149 | -1 150 | 1 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | r1 162 | 163 | $(find gazebo_ros2_control_demos)/config/diff_drive_controller_namespaced.yaml 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_gripper_mimic_joint_effort.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | gazebo_ros2_control/GazeboSystem 72 | 73 | 74 | 75 | 76 | 0.15 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | $(find gazebo_ros2_control_demos)/config/gripper_controller_effort.yaml 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_gripper_mimic_joint_position.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | gazebo_ros2_control/GazeboSystem 72 | 73 | 74 | 75 | 76 | 0.15 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | $(find gazebo_ros2_control_demos)/config/gripper_controller_position.yaml 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_pendulum_effort.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | gazebo_ros2_control/GazeboSystem 81 | 82 | 83 | 84 | -1000 85 | 1000 86 | 87 | 88 | 1.0 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | $(find gazebo_ros2_control_demos)/config/cart_controller_effort.yaml 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_pendulum_position.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | gazebo_ros2_control/GazeboSystem 81 | 82 | 83 | 84 | -15 85 | 15 86 | 87 | 88 | 1.0 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | $(find gazebo_ros2_control_demos)/config/cart_controller.yaml 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_tricycle_drive.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | gazebo_ros2_control/GazeboSystem 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | $(find gazebo_ros2_control_demos)/config/tricycle_drive_controller.yaml 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_vertical_cart_position_pid.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | gazebo_ros2_control/GazeboSystem 55 | 56 | 57 | 58 | 100 59 | 1 60 | 10 61 | 10000 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | $(find gazebo_ros2_control_demos)/config/cart_controller_position.yaml 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_vertical_cart_position_pids_in_yaml.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | gazebo_ros2_control/GazeboSystem 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | --ros-args 70 | --params-file 71 | $(find gazebo_ros2_control_demos)/config/cart_controller_position_with_pids.yaml 72 | 73 | $(find gazebo_ros2_control_demos)/config/cart_controller_position_with_pids.yaml 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /gazebo_ros2_control_demos/urdf/test_vertical_cart_velocity_pid.xacro.urdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | gazebo_ros2_control/GazeboSystem 55 | 56 | 57 | 58 | 10 59 | 10 60 | 0.1 61 | 10000 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | $(find gazebo_ros2_control_demos)/config/cart_controller_velocity.yaml 75 | 76 | 77 | 78 | --------------------------------------------------------------------------------