From bcf3760c7f7294b3685746a9f1da83e48199be51 Mon Sep 17 00:00:00 2001 From: Yannick Goumaz <61198661+ygoumaz@users.noreply.github.com> Date: Mon, 13 Feb 2023 22:40:35 +0100 Subject: [PATCH] Update Setting-up a Robot Simulation (Webots) tutorial to 2023.0.2 (#3317) * Update intro to WSL * Revert "Update intro to WSL" This reverts commit 52a52d09928ce8f1e159a667bf6e8a0e125ccf05. * Update intro to wsl * Remove windows tabs * Add windows WSL tab for extern controller code * Clean tutorial * Update world with declarations * Add supervisor node and environment var * Add ros2supervisorlauncher node creation in launch files * add env variable for linux * Update tutorial with explanations * Update source/Tutorials/Advanced/Simulators/Webots.rst Co-authored-by: ad-daniel <44834743+ad-daniel@users.noreply.github.com> * include correct file for supervisor part * Add WEBOTS_CONTROLLER_URL wsl infos * cleanup * Update source/Tutorials/Advanced/Simulators/Webots.rst Co-authored-by: Olivier Michel * Remove confusing sentence * Update source/Tutorials/Advanced/Simulators/Webots.rst Co-authored-by: Olivier Michel * Squashed commit of the following: commit 72effa715be53dcf2954bb694a430b0d8e956c8a Author: Luke Schmitt <85308904+LSinterbotix@users.noreply.github.com> Date: Tue Nov 1 17:26:25 2022 -0500 Fix list formatting on Contact page (#3153) commit dcd066fc11b1d1248b25d0ab4003ac4dcbebcacc Author: Dan Zimmerman Date: Tue Nov 1 16:29:34 2022 -0400 Update throttle logging docs with units and data type hints (re: rclcpp/issues/1929) (#3143) * Note milliseconds on API Concepts page * Add units and types to About Logging page Co-authored-by: dan Co-authored-by: Chris Lalancette commit 375b6cf2610bc4c3b775df8bde3f94deaa515d29 Author: definitelyuncertain Date: Fri Oct 28 14:30:22 2022 -0500 Change to mention explicit requirement for folder names for .msg and .srv files (#3144) * Change to mention explicit requirement for folder names for msg and srv files From https://github.com/ros2/tutorials/issues/29 * fix typo Co-authored-by: Tomoya Fujita * fix rst formatting Co-authored-by: Chris Lalancette Co-authored-by: Tomoya Fujita Co-authored-by: Chris Lalancette commit da871ef458644134bdabaa6589b62767b1e97dda Author: Sergei Sergienko Date: Thu Oct 27 17:20:06 2022 +0300 fix link to Gazebo-ROS2 bridge + CLI examples (#3139) * fix link to Gazebo-ROS2 bridge + CLI examples Co-authored-by: Chris Lalancette commit e19c9b50fcd4851502f1e7aeca6d8c72b952b129 Author: Chris Lalancette Date: Wed Oct 26 16:31:21 2022 -0400 Update the language to match the source code. (#3135) Fallout from #2865 Signed-off-by: Chris Lalancette commit a5910a16cc466519ede87779a7a56796096149a3 Author: Chris Lalancette Date: Wed Oct 26 08:38:36 2022 -0400 Shorten the Windows build-from-source path. (#3130) * Shorten the Windows build-from-source path. This is to keep the total length down below the 260 character limit imposed by Windows by default. Signed-off-by: Chris Lalancette commit 82256860b9cc6ec968893f0fe3ab3a4dcb01fcf7 Author: Chris Lalancette Date: Mon Oct 24 08:30:37 2022 -0400 Fix up the variable name in the traveling in time (C++) tutorial. (#3115) This is just to match what is in the code in the upstream repository. Signed-off-by: Chris Lalancette commit 87ab121ee41a84cebec8929dfa4b541f9139ce11 Author: Ian Colwell <48106342+icolwell-as@users.noreply.github.com> Date: Fri Oct 21 11:07:30 2022 -0400 Update default WORKING_DIRECTORY for ament_add_gtest() (#3117) commit 87bf20a6097c6aa53877d36ec0e7c56ab92dfe1e Author: chianfern Date: Tue Oct 18 21:36:57 2022 +0800 Add ParameterDescriptor to 'Using parameters in a class (C++)' (#2865) * Rename node name in "Using parameters" C++ tutorial to be consistent with Python tutorial. Signed-off-by: Tan Chian Fern Signed-off-by: Chris Lalancette commit 77646cea81c3d014d5b8a33d2709a0bb9fc64529 Author: George Stavrinos Date: Tue Oct 18 15:29:37 2022 +0300 Fixed Intel's robot SDK repo with the new devkit name + reference to MoveIt2 instead of 1. (#3107) commit 1d24955992c420d6f85580bc0c7b7805769e138d Author: Chris Lalancette Date: Mon Oct 17 14:06:52 2022 -0400 Monitor parameter changes: Add note to save callback handle (#3102) Signed-off-by: Chris Lalancette commit 8910a80ffb785264071e813c3b049e9561bf2344 Author: David V. Lu!! Date: Fri Oct 14 09:56:14 2022 -0400 Some testing basics (#3084) * Some testing basics Signed-off-by: David V. Lu Signed-off-by: Chris Lalancette commit 877145260f7d0282f695442971971ecc39799be6 Author: Tomoya Fujita Date: Fri Oct 14 05:34:20 2022 -0700 Sony's task for Iron Release. (#3089) * Sony's task for Iron Release. Signed-off-by: Tomoya.Fujita * Rearrange and add in links. Signed-off-by: Chris Lalancette Signed-off-by: Tomoya.Fujita Signed-off-by: Chris Lalancette Co-authored-by: Chris Lalancette commit 2ea9e7d78456edf3bf07385b65fd6c248cdc15cf Author: Yannick Goumaz <61198661+ygoumaz@users.noreply.github.com> Date: Fri Oct 14 14:23:13 2022 +0200 Update Setting-up a Robot Simulation (Webots) tutorial (#3090) * Update intro to WSL * Update world with declarations * Add supervisor node and environment var * Update tutorial with explanations Co-authored-by: ad-daniel <44834743+ad-daniel@users.noreply.github.com> commit 0390a50713588f0a9477f523e30f05efe2e8cbac Author: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Date: Thu Oct 13 13:42:30 2022 -0400 fix unresolved package requirement to install Humble on Ubuntu 20.04 (#3086) (#3088) * fix command to install humble on Ubuntu 20.04 Co-authored-by: paolo.dimasi Co-authored-by: Chris Lalancette (cherry picked from commit 5626af9b050f89c9e6895f6e461cf3ec01492238) Co-authored-by: Paolo Dimasi <46300254+Pamasi@users.noreply.github.com> * Update Webots.rst * Update intro to wsl * Remove windows tabs * Add windows WSL tab for extern controller code * Clean tutorial * Add ros2supervisorlauncher node creation in launch files * Update intro to WSL * Update tutorial with explanations * include correct file for supervisor part * Add WEBOTS_CONTROLLER_URL wsl infos * cleanup * Remove confusing sentence * Update source/Tutorials/Advanced/Simulators/Webots.rst Co-authored-by: Olivier Michel * Update source/Tutorials/Advanced/Simulators/Webots.rst Co-authored-by: Olivier Michel * Squashed commit of the following: commit 72effa715be53dcf2954bb694a430b0d8e956c8a Author: Luke Schmitt <85308904+LSinterbotix@users.noreply.github.com> Date: Tue Nov 1 17:26:25 2022 -0500 Fix list formatting on Contact page (#3153) commit dcd066fc11b1d1248b25d0ab4003ac4dcbebcacc Author: Dan Zimmerman Date: Tue Nov 1 16:29:34 2022 -0400 Update throttle logging docs with units and data type hints (re: rclcpp/issues/1929) (#3143) * Note milliseconds on API Concepts page * Add units and types to About Logging page Co-authored-by: dan Co-authored-by: Chris Lalancette commit 375b6cf2610bc4c3b775df8bde3f94deaa515d29 Author: definitelyuncertain Date: Fri Oct 28 14:30:22 2022 -0500 Change to mention explicit requirement for folder names for .msg and .srv files (#3144) * Change to mention explicit requirement for folder names for msg and srv files From https://github.com/ros2/tutorials/issues/29 * fix typo Co-authored-by: Tomoya Fujita * fix rst formatting Co-authored-by: Chris Lalancette Co-authored-by: Tomoya Fujita Co-authored-by: Chris Lalancette commit da871ef458644134bdabaa6589b62767b1e97dda Author: Sergei Sergienko Date: Thu Oct 27 17:20:06 2022 +0300 fix link to Gazebo-ROS2 bridge + CLI examples (#3139) * fix link to Gazebo-ROS2 bridge + CLI examples Co-authored-by: Chris Lalancette commit e19c9b50fcd4851502f1e7aeca6d8c72b952b129 Author: Chris Lalancette Date: Wed Oct 26 16:31:21 2022 -0400 Update the language to match the source code. (#3135) Fallout from #2865 Signed-off-by: Chris Lalancette commit a5910a16cc466519ede87779a7a56796096149a3 Author: Chris Lalancette Date: Wed Oct 26 08:38:36 2022 -0400 Shorten the Windows build-from-source path. (#3130) * Shorten the Windows build-from-source path. This is to keep the total length down below the 260 character limit imposed by Windows by default. Signed-off-by: Chris Lalancette commit 82256860b9cc6ec968893f0fe3ab3a4dcb01fcf7 Author: Chris Lalancette Date: Mon Oct 24 08:30:37 2022 -0400 Fix up the variable name in the traveling in time (C++) tutorial. (#3115) This is just to match what is in the code in the upstream repository. Signed-off-by: Chris Lalancette commit 87ab121ee41a84cebec8929dfa4b541f9139ce11 Author: Ian Colwell <48106342+icolwell-as@users.noreply.github.com> Date: Fri Oct 21 11:07:30 2022 -0400 Update default WORKING_DIRECTORY for ament_add_gtest() (#3117) commit 87bf20a6097c6aa53877d36ec0e7c56ab92dfe1e Author: chianfern Date: Tue Oct 18 21:36:57 2022 +0800 Add ParameterDescriptor to 'Using parameters in a class (C++)' (#2865) * Rename node name in "Using parameters" C++ tutorial to be consistent with Python tutorial. Signed-off-by: Tan Chian Fern Signed-off-by: Chris Lalancette commit 77646cea81c3d014d5b8a33d2709a0bb9fc64529 Author: George Stavrinos Date: Tue Oct 18 15:29:37 2022 +0300 Fixed Intel's robot SDK repo with the new devkit name + reference to MoveIt2 instead of 1. (#3107) commit 1d24955992c420d6f85580bc0c7b7805769e138d Author: Chris Lalancette Date: Mon Oct 17 14:06:52 2022 -0400 Monitor parameter changes: Add note to save callback handle (#3102) Signed-off-by: Chris Lalancette commit 8910a80ffb785264071e813c3b049e9561bf2344 Author: David V. Lu!! Date: Fri Oct 14 09:56:14 2022 -0400 Some testing basics (#3084) * Some testing basics Signed-off-by: David V. Lu Signed-off-by: Chris Lalancette commit 877145260f7d0282f695442971971ecc39799be6 Author: Tomoya Fujita Date: Fri Oct 14 05:34:20 2022 -0700 Sony's task for Iron Release. (#3089) * Sony's task for Iron Release. Signed-off-by: Tomoya.Fujita * Rearrange and add in links. Signed-off-by: Chris Lalancette Signed-off-by: Tomoya.Fujita Signed-off-by: Chris Lalancette Co-authored-by: Chris Lalancette commit 2ea9e7d78456edf3bf07385b65fd6c248cdc15cf Author: Yannick Goumaz <61198661+ygoumaz@users.noreply.github.com> Date: Fri Oct 14 14:23:13 2022 +0200 Update Setting-up a Robot Simulation (Webots) tutorial (#3090) * Update intro to WSL * Update world with declarations * Add supervisor node and environment var * Update tutorial with explanations Co-authored-by: ad-daniel <44834743+ad-daniel@users.noreply.github.com> commit 0390a50713588f0a9477f523e30f05efe2e8cbac Author: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Date: Thu Oct 13 13:42:30 2022 -0400 fix unresolved package requirement to install Humble on Ubuntu 20.04 (#3086) (#3088) * fix command to install humble on Ubuntu 20.04 Co-authored-by: paolo.dimasi Co-authored-by: Chris Lalancette (cherry picked from commit 5626af9b050f89c9e6895f6e461cf3ec01492238) Co-authored-by: Paolo Dimasi <46300254+Pamasi@users.noreply.github.com> * Update Webots.rst * Update Webots.rst * Remove trailing white spaces * Update to VM and no supervisor * Remove wrong text * Update source/Tutorials/Advanced/Simulators/Webots.rst Co-authored-by: Olivier Michel --------- Co-authored-by: ad-daniel <44834743+ad-daniel@users.noreply.github.com> Co-authored-by: Olivier Michel (cherry picked from commit 588b10a158418ce2da31a6f4bd96047847b72b85) --- .../Advanced/Simulators/Code/robot_launch.py | 3 -- .../Simulators/Code/robot_launch_sensor.py | 3 -- .../Tutorials/Advanced/Simulators/Webots.rst | 33 +++++++------------ 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/source/Tutorials/Advanced/Simulators/Code/robot_launch.py b/source/Tutorials/Advanced/Simulators/Code/robot_launch.py index 28ec4d08335..ff7b520b177 100644 --- a/source/Tutorials/Advanced/Simulators/Code/robot_launch.py +++ b/source/Tutorials/Advanced/Simulators/Code/robot_launch.py @@ -16,8 +16,6 @@ def generate_launch_description(): world=os.path.join(package_dir, 'worlds', 'my_world.wbt') ) - ros2_supervisor = Ros2SupervisorLauncher() - my_robot_driver = Node( package='webots_ros2_driver', executable='driver', @@ -31,7 +29,6 @@ def generate_launch_description(): return LaunchDescription([ webots, my_robot_driver, - ros2_supervisor, launch.actions.RegisterEventHandler( event_handler=launch.event_handlers.OnProcessExit( target_action=webots, diff --git a/source/Tutorials/Advanced/Simulators/Code/robot_launch_sensor.py b/source/Tutorials/Advanced/Simulators/Code/robot_launch_sensor.py index 1f874b5461b..3644f32e180 100644 --- a/source/Tutorials/Advanced/Simulators/Code/robot_launch_sensor.py +++ b/source/Tutorials/Advanced/Simulators/Code/robot_launch_sensor.py @@ -16,8 +16,6 @@ def generate_launch_description(): world=os.path.join(package_dir, 'worlds', 'my_world.wbt') ) - ros2_supervisor = Ros2SupervisorLauncher() - my_robot_driver = Node( package='webots_ros2_driver', executable='driver', @@ -36,7 +34,6 @@ def generate_launch_description(): return LaunchDescription([ webots, my_robot_driver, - ros2_supervisor, obstacle_avoider, launch.actions.RegisterEventHandler( event_handler=launch.event_handlers.OnProcessExit( diff --git a/source/Tutorials/Advanced/Simulators/Webots.rst b/source/Tutorials/Advanced/Simulators/Webots.rst index 8e17c7deef1..92d50072275 100644 --- a/source/Tutorials/Advanced/Simulators/Webots.rst +++ b/source/Tutorials/Advanced/Simulators/Webots.rst @@ -50,7 +50,7 @@ In particular, :doc:`../../Beginner-CLI-Tools/Introducing-Turtlesim/Introducing- .. group-tab:: macOS - The Linux and ROS commands of this tutorial must be run in a custom Docker container configured with the ``webots_ros2_driver`` package. + The Linux and ROS commands of this tutorial must be run in a pre-configured Linux Virtual Machine (VM). See the `Webots ROS 2 macOS installation instructions `_. To install ``webots_ros2_driver`` from a terminal, proceed with the following commands. @@ -203,15 +203,6 @@ You have to specify in the constructor which world file the simulator will open. :dedent: 4 :lines: 15-17 -A supervisor Robot is always automatically added to the world file by ``WebotsLauncher``. -This robot is controlled by the custom node ``Ros2Supervisor``, which must also be started using the ``Ros2SupervisorLauncher``. -This node allows to spawn URDF robots directly into the world, and it also publishes useful topics like ``/clock``. - -.. literalinclude:: Code/robot_launch.py - :language: python - :dedent: 4 - :lines: 19 - Then, the ROS node interacting with the simulated robot is created. This node, named ``driver``, is located in the ``webots_ros2_driver`` package. @@ -223,11 +214,11 @@ This node, named ``driver``, is located in the ``webots_ros2_driver`` package. .. group-tab:: Windows - The node (in WSL) will be able to communicate with the simulated robot (in Webots on Windows) through a TCP connection. + The node (in WSL) will be able to communicate with the simulated robot (in Webots on native Windows) through a TCP connection. .. group-tab:: macOS - The node (in the docker container) will be able to communicate with the simulated robot (in Webots on macOS) through a TCP connection. + The node (in the docker container) will be able to communicate with the simulated robot (in Webots on native macOS) through a TCP connection. In your case, you need to run a single instance of this node, because you have a single robot in the simulation. @@ -239,21 +230,21 @@ The ``robot_description`` parameter holds the contents of the URDF file which re .. literalinclude:: Code/robot_launch.py :language: python :dedent: 4 - :lines: 21-29 + :lines: 19-27 After that, the three nodes are set to be launched in the ``LaunchDescription`` constructor: .. literalinclude:: Code/robot_launch.py :language: python :dedent: 4 - :lines: 31-34 + :lines: 29-31 Finally, an optional part is added in order to shutdown all the nodes once Webots terminates (e.g., when it gets closed from the graphical user interface). .. literalinclude:: Code/robot_launch.py :language: python :dedent: 8 - :lines: 35-40 + :lines: 32-37 6 Modify the setup.py file ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -269,7 +260,6 @@ This sets-up the package and adds in the ``data_files`` variable the newly added 7 Test the code ^^^^^^^^^^^^^^^ - .. tabs:: .. group-tab:: Linux @@ -306,18 +296,17 @@ This sets-up the package and adds in the ``data_files`` variable the newly added On macOS, a local server must be started on the host to start Webots from the Docker container. The local server can be downloaded `on the webots-server repository `_. - In a terminal of the host machine (not in the container), specify the Webots installation folder (e.g. ``/Applications/Webots.app``) and start the server using the following commands: + In a terminal of the host machine (not in the VM), specify the Webots installation folder (e.g. ``/Applications/Webots.app``) and start the server using the following commands: .. code-block:: console export WEBOTS_HOME=/Applications/Webots.app python3 local_simulation_server.py - From the terminal of the Docker container, build and launch your custom package with: + From a terminal in the Linux VM in your ROS 2 workspace, build and launch your custom package with: .. code-block:: console - cd ~/ros2_ws colcon build source install/local_setup.bash ros2 launch my_package robot_launch.py @@ -407,7 +396,7 @@ Go to the file ``robot_launch.py`` and replace ``def generate_launch_description .. literalinclude:: Code/robot_launch_sensor.py :language: python - :lines: 11-47 + :lines: 11-44 This will create an ``obstacle_avoider`` node that will be included in the ``LaunchDescription``. @@ -443,7 +432,7 @@ As in task ``7``, launch the simulation from a terminal in your ROS 2 workspace: .. group-tab:: macOS - In a terminal of the host machine (not in the container), if not done already, specify the Webots installation folder (e.g. ``/Applications/Webots.app``) and start the server using the following commands: + In a terminal of the host machine (not in the VM), if not done already, specify the Webots installation folder (e.g. ``/Applications/Webots.app``) and start the server using the following commands: .. code-block:: console @@ -452,7 +441,7 @@ As in task ``7``, launch the simulation from a terminal in your ROS 2 workspace: Note that the server keeps running once the ROS 2 nodes are ended. You don't need to restart it every time you want to launch a new simulation. - From the terminal of the Docker container, build and launch your custom package with: + From a terminal in the Linux VM in your ROS 2 workspace, build and launch your custom package with: .. code-block:: console