Skip to content

Commit

Permalink
Sync fork (#17)
Browse files Browse the repository at this point in the history
* Update launch files to declare WebotsController node (#11) (ros2#3763)

* change launch files

* Update Setting-Up-Simulation-Webots-Basic.rst

* update minimal version tutorial 2

* add upcoming versions

* New Reset Handler tutorial (#12) (ros2#3764)

* new tutorial

Co-authored-by: Olivier Michel <[email protected]>

* Update macOS-Development-Setup.rst (ros2#3758)

- add Xcode App Store link
    - BASH -> ZSH (default)
    - make homebrew paths generic

Co-authored-by: Philipp Dittmann <[email protected]>

* Change confusing title between Debian package and Debian platform (ros2#3771)

Currently Debian does not offer ROS2 packages. Change the title that can
be confusing.

* Make the calendar more mobile-friendly. (ros2#3774)

* Make the calendar more mobile-friendly.

When looking at some of the analytics, it looks like this
page is particularly not mobile friendly.  That's because
the Google calendar embedded on the bottom of the page
is of fixed with 800x600, which doesn't work well on
many mobile devices.

What we do here is to see if a device has 767 or less pixels.
If it does, then we just show the agenda, which fits in just
280 pixels.  If we have more than that, we have room for
the full monthly agenda, so we show the full thing.

Signed-off-by: Chris Lalancette <[email protected]>
Co-authored-by: Tomoya Fujita <[email protected]>

---------

Signed-off-by: Chris Lalancette <[email protected]>
Co-authored-by: Olivier Michel <[email protected]>
Co-authored-by: PhDittmann <[email protected]>
Co-authored-by: Philipp Dittmann <[email protected]>
Co-authored-by: Quentin Quadrat <[email protected]>
Co-authored-by: Chris Lalancette <[email protected]>
Co-authored-by: Tomoya Fujita <[email protected]>
  • Loading branch information
7 people authored Jul 11, 2023
1 parent 687cd01 commit c2c6f19
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 49 deletions.
14 changes: 7 additions & 7 deletions source/Installation/Alternatives/macOS-Development-Setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You need the following things installed to build ROS 2:
#.
**Xcode**

* If you don't already have it installed, install Xcode.
* If you don't already have it installed, install [Xcode](https://apps.apple.com/app/xcode/id497799835).
* Note: Versions of Xcode later than 11.3.1 can no longer be installed on macOS Mojave, so you will need to install an older version manually, see: https://stackoverflow.com/a/61046761
* Also, if you don't already have it installed, install the Command Line Tools:

Expand Down Expand Up @@ -71,12 +71,12 @@ You need the following things installed to build ROS 2:
.. code-block:: bash
# Add the openssl dir for DDS-Security
# if you are using ZSH, then replace '.bashrc' with '.zshrc'
echo "export OPENSSL_ROOT_DIR=$(brew --prefix openssl)" >> ~/.bashrc
# if you are using BASH, then replace '.zshrc' with '.bashrc'
echo "export OPENSSL_ROOT_DIR=$(brew --prefix openssl)" >> ~/.zshrc
# Add the Qt directory to the PATH and CMAKE_PREFIX_PATH
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:/usr/local/opt/qt@5
export PATH=$PATH:/usr/local/opt/qt@5/bin
export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$(brew --prefix qt@5)
export PATH=$PATH:$(brew --prefix qt@5)/bin
#.
Use ``python3 -m pip`` (just ``pip`` may install Python3 or Python2) to install more stuff:
Expand All @@ -92,7 +92,7 @@ You need the following things installed to build ROS 2:
nose pep8 psutil pydocstyle pydot pygraphviz pyparsing==2.4.7 \
pytest-mock rosdep rosdistro setuptools==59.6.0 vcstool
Please ensure that the ``$PATH`` environment variable contains the install location of the binaries (default: ``$HOME/Library/Python/<version>/bin``)
Please ensure that the ``$PATH`` environment variable contains the install location of the binaries (``$(brew --prefix)/bin``)

#.
*Optional*: if you want to build the ROS 1<->2 bridge, then you must also install ROS 1:
Expand Down Expand Up @@ -156,7 +156,7 @@ Source the ROS 2 setup file:

.. code-block:: bash
. ~/ros2_{DISTRO}/install/setup.bash
. ~/ros2_{DISTRO}/install/setup.zsh
This will automatically set up the environment for any DDS vendors that support was built for.

Expand Down
4 changes: 2 additions & 2 deletions source/Installation/RHEL-Install-RPMs.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RHEL (RPM)
==========
RHEL (RPM packages)
===================

.. contents:: Table of Contents
:depth: 2
Expand Down
4 changes: 2 additions & 2 deletions source/Installation/Ubuntu-Install-Debians.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Installation/Linux-Install-Debians

Ubuntu (Debian)
===============
Ubuntu (Debian packages)
========================

.. contents:: Table of Contents
:depth: 2
Expand Down
35 changes: 32 additions & 3 deletions source/The-ROS2-Project/Governance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,37 @@ It can be accessed via `iCal <https://calendar.google.com/calendar/ical/agf3kaji

.. raw:: html

<iframe src="https://calendar.google.com/calendar/embed?src=agf3kajirket8khktupm9go748%40group.calendar.google.com" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>


<!--
The below code comes from https://www.mpking.com/2021/04/making-google-calendar-embeddable.html.
The basic idea is that if we are on a desktop device (defined as anything that has more than 767 pixels),
then we show the monthly version of the calendar. If we are on a device with 767 or less, show the agenda
version, which is much narrower.
-->
<style>
.responsiveCal {
position: relative; padding-bottom: 75%; height: 0; overflow: hidden;
}
.responsiveCal iframe {
position: absolute; top:0; left: 0; width: 100%; height: 100%;
}
@media all and (min-width: 768px) {
.deskContent {display:block;}
.phoneContent {display:none;}
}
@media all and (max-width: 767px) {
.deskContent {display:none;}
.phoneContent {display:block;}
}
</style>
<div class="responsiveCal">
<div class="deskContent">
<iframe src="https://calendar.google.com/calendar/embed?src=agf3kajirket8khktupm9go748%40group.calendar.google.com" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>
</div>
<div class="phoneContent"><iframe src="https://calendar.google.com/calendar/embed?mode=AGENDA&amp;height=400&amp;wkst=1&amp;src=agf3kajirket8khktupm9go748%40group.calendar.google.com" style="border: 0" width="280" height="500" frameborder="0" scrolling="no"></iframe>
</div>
</div>

If you have an individual event or series of events that you'd like to post please contact [email protected]
15 changes: 5 additions & 10 deletions source/Tutorials/Advanced/Simulators/Webots/Code/robot_launch.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
import os
import pathlib
import launch
from launch_ros.actions import Node
from launch import LaunchDescription
from ament_index_python.packages import get_package_share_directory
from webots_ros2_driver.webots_launcher import WebotsLauncher
from webots_ros2_driver.utils import controller_url_prefix
from webots_ros2_driver.webots_controller import WebotsController


def generate_launch_description():
package_dir = get_package_share_directory('my_package')
robot_description = pathlib.Path(os.path.join(package_dir, 'resource', 'my_robot.urdf')).read_text()
robot_description_path = os.path.join(package_dir, 'resource', 'my_robot.urdf')

webots = WebotsLauncher(
world=os.path.join(package_dir, 'worlds', 'my_world.wbt')
)

my_robot_driver = Node(
package='webots_ros2_driver',
executable='driver',
output='screen',
additional_env={'WEBOTS_CONTROLLER_URL': controller_url_prefix() + 'my_robot'},
my_robot_driver = WebotsController(
robot_name='my_robot',
parameters=[
{'robot_description': robot_description},
{'robot_description': robot_description_path},
]
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
import os
import pathlib
import launch
from launch_ros.actions import Node
from launch import LaunchDescription
from ament_index_python.packages import get_package_share_directory
from webots_ros2_driver.webots_launcher import WebotsLauncher, Ros2SupervisorLauncher
from webots_ros2_driver.utils import controller_url_prefix
from webots_ros2_driver.webots_launcher import WebotsLauncher
from webots_ros2_driver.webots_controller import WebotsController


def generate_launch_description():
package_dir = get_package_share_directory('my_package')
robot_description = pathlib.Path(os.path.join(package_dir, 'resource', 'my_robot.urdf')).read_text()
robot_description_path = os.path.join(package_dir, 'resource', 'my_robot.urdf')

webots = WebotsLauncher(
world=os.path.join(package_dir, 'worlds', 'my_world.wbt')
)

my_robot_driver = Node(
package='webots_ros2_driver',
executable='driver',
output='screen',
additional_env={'WEBOTS_CONTROLLER_URL': controller_url_prefix() + 'my_robot'},
my_robot_driver = WebotsController(
robot_name='my_robot',
parameters=[
{'robot_description': robot_description},
{'robot_description': robot_description_path},
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Prerequisites
This is a continuation of the first part of the tutorial: :doc:`./Setting-Up-Simulation-Webots-Basic`.
It is mandatory to start with the first part to set up the custom packages and necessary files.

This tutorial is compatible with version 2023.1.0 of ``webots_ros2`` and Webots R2023b, as well as upcoming versions.

Tasks
-----

Expand Down Expand Up @@ -153,7 +155,7 @@ Go to the file ``robot_launch.py`` and replace ``def generate_launch_description

.. literalinclude:: Code/robot_launch_sensor.py
:language: python
:lines: 11-44
:lines: 10-40

This will create an ``obstacle_avoider`` node that will be included in the ``LaunchDescription``.

Expand Down Expand Up @@ -221,8 +223,6 @@ Next steps
----------

You might want to improve the plugin or create new nodes to change the behavior of the robot.
Taking inspiration from these previous tutorials could be a starting point:

* :doc:`../../Recording-A-Bag-From-Your-Own-Node-Py`.
You can also implement a reset handler to automatically restart your ROS nodes when the simulation is reset from the Webots interface:

* :doc:`../../../Intermediate/Tf2/Tf2-Main`.
* :doc:`./Simulation-Reset-Handler`.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ In particular, :doc:`../../../Beginner-CLI-Tools/Introducing-Turtlesim/Introduci
The Linux and ROS commands of this tutorial must be run in a pre-configured Linux Virtual Machine (VM).
The following page :doc:`./Installation-MacOS` explains how to install the ``webots_ros2`` package on macOS.

This tutorial is compatible with version 2023.1.0 of ``webots_ros2`` and Webots R2023b, as well as upcoming versions.

Tasks
-----

Expand Down Expand Up @@ -344,10 +346,10 @@ You have to specify in the constructor which world file the simulator will open.
.. literalinclude:: Code/robot_launch.py
:language: python
:dedent: 4
:lines: 15-17
:lines: 13-15

Then, the ROS node interacting with the simulated robot is created.
This node, named ``driver``, is located in the ``webots_ros2_driver`` package.
This node, named ``WebotsController``, is located in the ``webots_ros2_driver`` package.

.. tabs::

Expand All @@ -366,33 +368,32 @@ This node, named ``driver``, is located in the ``webots_ros2_driver`` package.

In your case, you need to run a single instance of this node, because you have a single robot in the simulation.
But if you had more robots in the simulation, you would have to run one instance of this node per robot.
``WEBOTS_CONTROLLER_URL`` is used to define the name of the robot the driver should connect to.
The ``controller_url_prefix()`` method is mandatory, as it allows ``webots_ros2_driver`` to add the correct protocol prefix depending on your platform.
The ``robot_description`` parameter holds the contents of the URDF file which refers to the ``MyRobotDriver`` plugin.
You can see the ``driver`` node as the interface that connects your controller plugin to the target robot.
The ``robot_name`` parameter is used to define the name of the robot the driver should connect to.
The ``robot_description`` parameter holds the path to the URDF file which refers to the ``MyRobotDriver`` plugin.
You can see the ``WebotsController`` node as the interface that connects your controller plugin to the target robot.

.. literalinclude:: Code/robot_launch.py
:language: python
:dedent: 4
:lines: 19-27
:lines: 17-22

After that, the two nodes are set to be launched in the ``LaunchDescription`` constructor:

.. literalinclude:: Code/robot_launch.py
:language: python
:dedent: 4
:lines: 29-31
:lines: 24-26

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: 32-37
:lines: 27-32

.. note::

More details on ``webots_ros2_driver`` and ``WebotsLauncher`` arguments can be found `on the nodes reference page <https://github.com/cyberbotics/webots_ros2/wiki/References-Nodes>`_.
More details on ``WebotsController`` and ``WebotsLauncher`` arguments can be found `on the nodes reference page <https://github.com/cyberbotics/webots_ros2/wiki/References-Nodes>`_.

6 Edit additional files
^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Loading

0 comments on commit c2c6f19

Please sign in to comment.