diff --git a/docs/installation/additional-settings-for-developers/.pages b/docs/installation/additional-settings-for-developers/.pages index 35fd5a113be..d3e29d50dd0 100644 --- a/docs/installation/additional-settings-for-developers/.pages +++ b/docs/installation/additional-settings-for-developers/.pages @@ -1,2 +1,4 @@ nav: - index.md + - console-settings.md + - network-configuration diff --git a/docs/installation/additional-settings-for-developers/console-settings.md b/docs/installation/additional-settings-for-developers/console-settings.md new file mode 100644 index 00000000000..2dbd2661d85 --- /dev/null +++ b/docs/installation/additional-settings-for-developers/console-settings.md @@ -0,0 +1,29 @@ +# Console settings for ROS 2 + +## Colorizing logger output + +By default, ROS 2 logger doesn't colorize the output. +To colorize it, add the following to your `~/.bashrc`: + +```bash +export RCUTILS_COLORIZED_OUTPUT=1 +``` + +## Customizing the format of logger output + +By default, ROS 2 logger doesn't output detailed information such as file name, function name, or line number. +To customize it, add the following to your `~/.bashrc`: + +```bash +export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})" +``` + +For more options, see [here](https://docs.ros.org/en/rolling/Tutorials/Demos/Logging-and-logger-configuration.html#console-output-formatting). + +## Colorized GoogleTest output + +Add `export GTEST_COLOR=1` to your `~/.bashrc`. + +For more details, refer to [Advanced GoogleTest Topics: Colored Terminal Output](https://google.github.io/googletest/advanced.html#colored-terminal-output). + +This is useful when running tests with `colcon test`. diff --git a/docs/installation/additional-settings-for-developers/index.md b/docs/installation/additional-settings-for-developers/index.md index 1379d9c2992..7e84634230e 100644 --- a/docs/installation/additional-settings-for-developers/index.md +++ b/docs/installation/additional-settings-for-developers/index.md @@ -1,136 +1,4 @@ # Additional settings for developers -## Console settings for ROS 2 - -### Colorizing logger output - -By default, ROS 2 logger doesn't colorize the output. -To colorize it, write the following in your `.bashrc`: - -```bash -export RCUTILS_COLORIZED_OUTPUT=1 -``` - -### Customizing the format of logger output - -By default, ROS 2 logger doesn't output detailed information such as file name, function name, or line number. -To customize it, write the following in your `.bashrc`: - -```bash -export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})" -``` - -For more options, see [here](https://docs.ros.org/en/rolling/Tutorials/Logging-and-logger-configuration.html#console-output-formatting). - -## Network settings for ROS 2 - -ROS 2 employs DDS, and the configuration of ROS 2 and DDS is described separately. -For ROS 2 networking concepts, refer to the [official documentation](http://design.ros2.org/articles/ros_on_dds.html). - -### ROS 2 network setting - -ROS 2 multicasts data on the local network by default. -Therefore, when you develop in an office, the data flows over the local network of your office. -It may cause collisions of packets or increases in network traffic. - -To avoid these, there are two options. - -- Localhost-only communication -- Same domain only communication on the local network - -Unless you plan to use multiple host computers on the local network, localhost-only communication is recommended. -For details, refer to the sections below. - -#### Enabling localhost-only communication - -Write the following in your `.bashrc`: -For more information, see the [ROS 2 documentation](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#the-ros-localhost-only-variable). - -```bash -export ROS_LOCALHOST_ONLY=1 -``` - -If you export `ROS_LOCALHOST_ONLY=1`, `MULTICAST` must be enabled at the loopback address. -To verify that `MULTICAST` is enabled, use the following command. - -```console -$ ip link show lo -1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 -``` - -If the word `MULTICAST` is not printed, use the following command to enable it. - -```bash -sudo ip link set lo multicast on -``` - -#### Same domain only communication on the local network - -ROS 2 uses `ROS_DOMAIN_ID` to create groups and communicate between machines in the groups. -Since all ROS 2 nodes use domain ID `0` by default, it may cause unintended interference. - -To avoid it, set a different domain ID for each group in your `.bashrc`: - -```bash -# Replace X with the Domain ID you want to use -# Domain ID should be a number in range [0, 101] (inclusive) -export ROS_DOMAIN_ID=X -``` - -Also confirm that `ROS_LOCALHOST_ONLY` is `0` by using the following command. - -```bash -echo $ROS_LOCALHOST_ONLY # If the output is 1, localhost has priority. -``` - -For more information, see the [ROS 2 Documentation](https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#the-ros-domain-id-variable). - -### DDS settings - -Autoware uses DDS for inter-node communication. [ROS 2 documentation](https://docs.ros.org/en/humble/How-To-Guides/DDS-tuning.html) recommends users to tune DDS to utilize its capability. Especially, receive buffer size is the critical parameter for Autoware. If the parameter is not large enough, Autoware will failed in receiving large data like point cloud or image. - -#### Tuning DDS - -Unless customized, CycloneDDS is adopted by default. For example, to execute Autoware with CycloneDDS, prepare a config file. A sample config file is given below. Save it as `cyclonedds_config.xml`. - -```xml - - - - - - - - default - 65500B - - - - - 500kB - - - - -``` - -This configuration is mostly taken from [Eclipse Cyclone DDS:Run-time configuration documentation](https://github.com/eclipse-cyclonedds/cyclonedds/tree/a10ced3c81cc009e7176912190f710331a4d6caf#run-time-configuration). -You can see why each value is set as such under the documentation link. - -Set the config file path and enlarge the Linux kernel maximum buffer size before launching Autoware. - -```bash -export CYCLONEDDS_URI=file:///absolute/path/to/cyclonedds_config.xml -sudo sysctl -w net.core.rmem_max=2147483647 -``` - -For more information, Refer to [ROS 2 documentation](https://docs.ros.org/en/humble/How-To-Guides/DDS-tuning.html). Reading user guide for chosen DDS is helpful for more understanding. - -#### Tuning DDS for multiple host computers (for advanced users) - -When Autoware runs on multiple host computers, IP Fragmentation should be taken into account. As [ROS 2 documentation](https://docs.ros.org/en/humble/How-To-Guides/DDS-tuning.html#cross-vendor-tuning) recommends, parameters for IP Fragmentation should be set as shown in the following example. - -```bash -sudo sysctl -w net.ipv4.ipfrag_time=3 -sudo sysctl -w net.ipv4.ipfrag_high_thresh=134217728 # (128 MB) -``` +- [Console settings for ROS 2](./console-settings.md) +- [Network configuration for ROS 2](./network-configuration/index.md) diff --git a/docs/installation/additional-settings-for-developers/network-configuration/.pages b/docs/installation/additional-settings-for-developers/network-configuration/.pages new file mode 100644 index 00000000000..5cb8e7e4768 --- /dev/null +++ b/docs/installation/additional-settings-for-developers/network-configuration/.pages @@ -0,0 +1,5 @@ +nav: + - index.md + - dds-settings.md + - enable-multicast-for-lo.md + - multiple-computers.md diff --git a/docs/installation/additional-settings-for-developers/network-configuration/dds-settings.md b/docs/installation/additional-settings-for-developers/network-configuration/dds-settings.md new file mode 100644 index 00000000000..c4f4a5a8f99 --- /dev/null +++ b/docs/installation/additional-settings-for-developers/network-configuration/dds-settings.md @@ -0,0 +1,128 @@ +# DDS settings for ROS 2 and Autoware + +## Enable localhost-only communication + +1. [Enable `multicast` for `lo`](./enable-multicast-for-lo.md) +2. Make sure `export ROS_LOCALHOST_ONLY=1` **is NOT** present in `.bashrc`. + - See [About `ROS_LOCALHOST_ONLY` environment variable](#about-ros_localhost_only-environment-variable) for more information. + +## Tune DDS settings + +Autoware uses DDS for internode communication. [ROS 2 documentation](https://docs.ros.org/en/humble/How-To-Guides/DDS-tuning.html) recommends users to tune DDS to utilize its capability. + +!!! note + + CycloneDDS is the recommended and most tested DDS implementation for Autoware. + +!!! warning + + If you don't tune these settings, Autoware will fail to receive large data like point clouds or images. + +### Tune system-wide network settings + +Set the config file path and enlarge the Linux kernel maximum buffer size before launching Autoware. + +```bash +# Increase the maximum receive buffer size for network packets +sudo sysctl -w net.core.rmem_max=2147483647 # 2 GiB, default is 208 KiB + +# IP fragmentation settings +sudo sysctl -w net.ipv4.ipfrag_time=3 # in seconds, default is 30 s +sudo sysctl -w net.ipv4.ipfrag_high_thresh=134217728 # 128 MiB, default is 256 KiB +``` + +To make it permanent, + +```bash +sudo nano /etc/sysctl.d/10-cyclone-max.conf +``` + +Paste the following into the file: + +```bash +# Increase the maximum receive buffer size for network packets +net.core.rmem_max=2147483647 # 2 GiB, default is 208 KiB + +# IP fragmentation settings +net.ipv4.ipfrag_time=3 # in seconds, default is 30 s +net.ipv4.ipfrag_high_thresh=134217728 # 128 MiB, default is 256 KiB +``` + +Details of each parameter here is explained in the [ROS 2 documentation](https://docs.ros.org/en/humble/How-To-Guides/DDS-tuning.html#cross-vendor-tuning). + +#### Validate the sysctl settings + +```console +user@pc$ sysctl net.core.rmem_max net.ipv4.ipfrag_time net.ipv4.ipfrag_high_thresh +net.core.rmem_max = 2147483647 +net.ipv4.ipfrag_time = 3 +net.ipv4.ipfrag_high_thresh = 134217728 +``` + +### CycloneDDS Configuration + +Save the following file as `~/cyclonedds.xml`. + +```xml + + + + + + + + default + 65500B + + + + + 500kB + + + + +``` + +Then add the following lines to your `~/.bashrc` file. + +```bash +export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp + +export CYCLONEDDS_URI=file:///absolute/path/to/cyclonedds.xml +# Replace `/absolute/path/to/cyclonedds.xml` with the actual path to the file. +# Example: export CYCLONEDDS_URI=file:///home/user/cyclonedds.xml +``` + +You can refer to [Eclipse Cyclone DDS: Run-time configuration documentation](https://github.com/eclipse-cyclonedds/cyclonedds/tree/a10ced3c81cc009e7176912190f710331a4d6caf#run-time-configuration) for more details. + +!!! warning + + `RMW_IMPLEMENTATION` variable might be already set with [Ansible/RMW Implementation](https://github.com/autowarefoundation/autoware/tree/main/ansible/roles/rmw_implementation#manual-installation). + + Check and remove the duplicate line if necessary. + +## Additional information + +### About `ROS_LOCALHOST_ONLY` environment variable + +Previously, we used to set `export ROS_LOCALHOST_ONLY=1` to enable localhost-only communication. +But because of [an ongoing issue](https://github.com/ros2/rmw_cyclonedds/issues/370), this method doesn't work. + +!!! warning + + Do not set `export ROS_LOCALHOST_ONLY=1` in `~/.bashrc`. + + If you do so, it will cause an error with RMW. + + Remove it from `~/.bashrc` if you have set it. + +### About `ROS_DOMAIN_ID` environment variable + +We can also set `export ROS_DOMAIN_ID=3(or any number 1 to 255)` (`0` by default) to avoid interference with other ROS 2 nodes on the same network. + +But since `255` is a very small number, it might interfere with other computers on the same network unless you make sure everyone has a unique domain ID. + +Another problem is that if someone runs a test that uses ROS 2 [launch_testing](https://github.com/ros2/launch/blob/a317c54bbbf2dfeec35fbb6d2b5913939d02750d/launch_testing/README.md) framework, +by default it will use a random domain ID to isolate between tests even on the same machine. +See [this PR](https://github.com/ros2/launch/pull/251) for more details. diff --git a/docs/installation/additional-settings-for-developers/network-configuration/enable-multicast-for-lo.md b/docs/installation/additional-settings-for-developers/network-configuration/enable-multicast-for-lo.md new file mode 100644 index 00000000000..ca192bcf3fc --- /dev/null +++ b/docs/installation/additional-settings-for-developers/network-configuration/enable-multicast-for-lo.md @@ -0,0 +1,98 @@ +# Enable `multicast` on `lo` + +## Manually (temporary solution) + +You may just call the following command to enable multicast on the loopback interface. + +```bash +sudo ip link set lo multicast on +``` + +!!! warning + + This will be reverted once the computer restarts. To make it permanent, follow the steps below. + +!!! note + + Here, `lo` is the loopback interface. + + You can check the interfaces with `ip link show`. + + You may change `lo` with the interface you want to enable multicast on. + +## On startup with a service (permanent solution) + +```bash +sudo nano /etc/systemd/system/multicast-lo.service +``` + +Paste the following into the file: + +```service +[Unit] +Description=Enable Multicast on Loopback + +[Service] +Type=oneshot +ExecStart=/usr/sbin/ip link set lo multicast on + +[Install] +WantedBy=multi-user.target +``` + +Press following in order to save with nano: + +1. `Ctrl+X` +2. `Y` +3. `Enter` + +```bash +# Make it recognized +sudo systemctl daemon-reload + +# Make it run on startup +sudo systemctl enable multicast-lo.service + +# Start it now +sudo systemctl start multicast-lo.service +``` + +### Validate + +```console +you@pc:~$ sudo systemctl status multicast-lo.service +○ multicast-lo.service - Enable Multicast on Loopback + Loaded: loaded (/etc/systemd/system/multicast-lo.service; enabled; vendor preset: enabled) + Active: inactive (dead) since Mon 2024-07-08 12:54:17 +03; 4s ago + Process: 22588 ExecStart=/usr/bin/ip link set lo multicast on (code=exited, status=0/SUCCESS) + Main PID: 22588 (code=exited, status=0/SUCCESS) + CPU: 1ms + +Tem 08 12:54:17 mfc-leo systemd[1]: Starting Enable Multicast on Loopback... +Tem 08 12:54:17 mfc-leo systemd[1]: multicast-lo.service: Deactivated successfully. +Tem 08 12:54:17 mfc-leo systemd[1]: Finished Enable Multicast on Loopback. +``` + +```console +you@pc:~$ ip link show lo +1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +``` + +### Uninstalling the service + +If for some reason you want to uninstall the service, you can do so by following these steps: + +```bash +# Stop the service +sudo systemctl stop multicast-lo.service + +# Disable the service from running on startup +sudo systemctl disable multicast-lo.service + +# Remove the service file +sudo rm /etc/systemd/system/multicast-lo.service + +# Reload systemd to apply the changes +sudo systemctl daemon-reload +``` diff --git a/docs/installation/additional-settings-for-developers/network-configuration/index.md b/docs/installation/additional-settings-for-developers/network-configuration/index.md new file mode 100644 index 00000000000..384c4c95bdc --- /dev/null +++ b/docs/installation/additional-settings-for-developers/network-configuration/index.md @@ -0,0 +1,9 @@ +# Network settings for ROS 2 and Autoware + +## Single computer setup + +- [DDS settings for ROS 2 and Autoware](./dds-settings.md) + +## Multi computer setup + +- [Communicating across multiple computers with CycloneDDS](./multiple-computers.md) diff --git a/docs/installation/additional-settings-for-developers/network-configuration/multiple-computers.md b/docs/installation/additional-settings-for-developers/network-configuration/multiple-computers.md new file mode 100644 index 00000000000..13dbddb3f23 --- /dev/null +++ b/docs/installation/additional-settings-for-developers/network-configuration/multiple-computers.md @@ -0,0 +1,45 @@ +# Communicating across multiple computers with CycloneDDS + +## Configuring CycloneDDS + +Within the `~/cyclonedds.xml` file, Interfaces section can be set in various ways to communicate across multiple computers within a network. + +### Automatically determine the network interface (convenient) + +With this setting, CycloneDDS will automatically determine the most suitable network interface to use. + +```xml + + + +``` + +### Manually set the network interface (recommended) + +With this setting, you can manually set the network interface to use. + +```xml + + + +``` + +!!! warning + + You should replace `enp38s0` with the actual network interface name. + +!!! note + + `ifconfig` command can be used to find the network interface name. + +## Time synchronization + +To ensure that the nodes on different computers are synchronized, you should synchronize the time between the computers. + +You can use the `chrony` to synchronize the time between computers. + +Please refer to this post for more information: [Multi PC AWSIM + Autoware Tests #3813](https://github.com/orgs/autowarefoundation/discussions/3813) + +!!! warning + + Under Construction diff --git a/docs/installation/autoware/source-installation.md b/docs/installation/autoware/source-installation.md index 601cba8cd8b..2e61fb8c986 100644 --- a/docs/installation/autoware/source-installation.md +++ b/docs/installation/autoware/source-installation.md @@ -91,7 +91,9 @@ sudo apt-get -y install git rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO ``` -3. Build the workspace. +3. [Install and set up ccache to speed up consecutive builds](../../how-to-guides/others/advanced-usage-of-colcon.md#using-ccache-to-speed-up-recompilation). _(optional but highly recommended)_ + +4. Build the workspace. Autoware uses [colcon](https://github.com/colcon) to build workspaces. For more advanced options, refer to the [documentation](https://colcon.readthedocs.io/). @@ -102,6 +104,10 @@ sudo apt-get -y install git If there is any build issue, refer to [Troubleshooting](../../support/troubleshooting/index.md#build-issues). +5. Follow the steps in [Network Configuration](../../installation/additional-settings-for-developers/network-configuration/index.md) before running Autoware. + +6. Apply the settings recommended in [Console settings for ROS 2](../../installation/additional-settings-for-developers/console-settings.md) for a better development experience. _(optional)_ + ## How to update a workspace 1. Update the `.repos` file. diff --git a/docs/support/troubleshooting/performance-troubleshooting.md b/docs/support/troubleshooting/performance-troubleshooting.md index 6fee15d21ce..5f4ca4b3864 100644 --- a/docs/support/troubleshooting/performance-troubleshooting.md +++ b/docs/support/troubleshooting/performance-troubleshooting.md @@ -32,29 +32,9 @@ If you get the error message `selected interface "{your-interface-name}" is not #### Solution -Run the following command to allow multicast: +Follow [DDS settings for ROS 2 and Autoware](../../installation/additional-settings-for-developers/network-configuration/dds-settings.md) -```bash -sudo ip link set multicast on {your-interface-name} -``` - -This way DDS will function as intended and multiple subscribers can receive data from a single publisher without any significant degradation in performance. - -This is a temporary solution. And will be reverted once the computer restarts. - -To make it permanent either, - -- Create a service to run this on startup (recommended) -- **OR** put following lines to the `~/.bashrc` file: - - ```bash - if [ ! -e /tmp/multicast_is_set ]; then - sudo ip link set lo multicast on - touch /tmp/multicast_is_set - fi - ``` - - - This will probably ask for password on the terminal every time you restart the computer. +Especially the [Enable `multicast` on `lo`](../../installation/additional-settings-for-developers/network-configuration/enable-multicast-for-lo.md) section. ### Check the compilation flags @@ -113,6 +93,8 @@ If you are using a different DDS middleware, we might not have official support Add `export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp` as a separate line in you `~/.bashrc` file. +More details in: [CycloneDDS Configuration](../../installation/additional-settings-for-developers/network-configuration/dds-settings.md#cyclonedds-configuration) + #### Check if the CycloneDDS is configured correctly ##### Diagnosis @@ -128,72 +110,32 @@ The return line should be a valid path pointing to an `.xml` file with `CycloneD Also check if the file is configured correctly: ```bash -cat !{echo $CYCLONEDDS_URI} +cat ${CYCLONEDDS_URI#file://} ``` This should print the `.xml` file on the terminal. ##### Solution -Follow [DDS settings:Tuning DDS documentation](../../installation/additional-settings-for-developers/index.md#tuning-dds) and make sure: +Follow [CycloneDDS Configuration](../../installation/additional-settings-for-developers/network-configuration/dds-settings.md#cyclonedds-configuration) and make sure: -- you have `export CYCLONEDDS_URI=/absolute_path_to_your/cyclonedds_config.xml` as a line on your `~/.bashrc` file. -- you have the `cyclonedds_config.xml` with the configuration provided in the documentation. +- you have `export CYCLONEDDS_URI=file:///absolute_path_to_your/cyclonedds.xml` as a line on your `~/.bashrc` file. +- you have the `cyclonedds.xml` with the configuration provided in the documentation. #### Check the Linux kernel maximum buffer size ##### Diagnosis -- Run: `sysctl net.core.rmem_max`, it should return at least `net.core.rmem_max = 2147483647`. - - This parameter specifies the maximum size of the "receive buffer" for each network connection, which determines the maximum amount of data that can be held in memory at any given time. By increasing the maximum buffer size, the operating system can accommodate larger bursts of data, which can help prevent network congestion and reduce packet loss, resulting in faster and more reliable data transfers. -- Run: `sysctl net.ipv4.ipfrag_time`, it should return around: `net.ipv4.ipfrag_time = 3` - - The "net.ipv4.ipfrag_time" parameter specifies the maximum time in seconds that the kernel should retain partially fragmented IP packets before discarding them. The default value for this parameter is usually set to 30 seconds, but it may vary depending on the specific operating system and configuration. - - By setting this parameter to a lower value, such as 3 seconds, the kernel can free up memory resources more quickly by discarding partially fragmented packets that are no longer needed, which can help improve the overall performance and stability of the system. -- Run: `sysctl net.ipv4.ipfrag_high_thresh`, it should return at around: `net.ipv4.ipfrag_high_thresh = 134217728` - - The "net.ipv4.ipfrag_high_thresh" parameter specifies the high watermark threshold for the number of partially fragmented packets allowed in the kernel IP packet reassembly queue. When the number of partially fragmented packets in the queue exceeds this threshold, the kernel will start to drop newly arrived packets until the number of partially fragmented packets drops below the threshold. - - By setting this parameter to a higher value, such as 134217728 (128 MB), the kernel can accommodate a larger number of partially fragmented packets in the queue, which can help improve the performance of network applications that transfer large amounts of data, such as file transfer protocols and multimedia streaming applications. - -More info on these values: [Cross-vendor tuning](https://docs.ros.org/en/humble/How-To-Guides/DDS-tuning.html#cross-vendor-tuning) +[Validate the sysctl settings](../../installation/additional-settings-for-developers/network-configuration/dds-settings.md#validate-the-sysctl-settings) ##### Solution -Either: - -- Create the following file: `sudo touch /etc/sysctl.d/10-cyclone-max.conf` (recommended) - - - Edit the file to contain (`sudo gedit /etc/sysctl.d/10-cyclone-max.conf`): +[Tune system-wide network settings](../../installation/additional-settings-for-developers/network-configuration/dds-settings.md#tune-system-wide-network-settings) - ```bash - net.core.rmem_max=2147483647 - net.ipv4.ipfrag_time=3 - net.ipv4.ipfrag_high_thresh=134217728 # (128 MB) - ``` - - - Either restart the computer or run following to enable the changes: - - ```bash - sudo sysctl -w net.core.rmem_max=2147483647 - sudo sysctl -w net.ipv4.ipfrag_time=3 - sudo sysctl -w net.ipv4.ipfrag_high_thresh=134217728 - ``` - -- **OR** put following lines to the `~/.bashrc` file: - - ```bash - if [ ! -e /tmp/kernel_network_conf_is_set ]; then - sudo sysctl -w net.core.rmem_max=2147483647 - sudo sysctl -w net.ipv4.ipfrag_time=3 - sudo sysctl -w net.ipv4.ipfrag_high_thresh=134217728 # (128 MB) - fi - ``` - - - This will probably ask for password on the terminal every time you restart the computer. - -### Check if ROS localhost only communication is enabled +### Check if localhost only communication for DDS is enabled - If you are using multi computer setup, please skip this check. -- Enabling ROS localhost only communication can help improve the performance of ROS by reducing network traffic and avoiding potential conflicts with other devices on the network. -- Also check [Enable localhost-only communication](../../installation/additional-settings-for-developers/index.md#enabling-localhost-only-communication) +- Enabling localhost only communication for DDS can help improve the performance of ROS by reducing network traffic and avoiding potential conflicts with other devices on the network. #### Target symptoms @@ -206,15 +148,20 @@ Either: #### Diagnosis -Run following to check it: +Run: ```bash -echo $ROS_LOCALHOST_ONLY +cat ${CYCLONEDDS_URI#file://} ``` -The return line should be `1`. If not, apply the solution. +And it should return [DDS settings for ROS 2 and Autoware: CycloneDDS Configuration](../../installation/additional-settings-for-developers/network-configuration/dds-settings.md#cyclonedds-configuration) this file. #### Solution -- Add `export $ROS_LOCALHOST_ONLY=1` as a separate line in you `~/.bashrc` file. - - This environment variable tells ROS to only use the `loopback` network interface (i.e., localhost) for communication, rather than using the network interface card (NIC) for Ethernet or Wi-Fi. This can reduce network traffic and potential conflicts with other devices on the network, resulting in better performance and stability. +Follow [DDS settings for ROS 2 and Autoware: Enable localhost-only communication](../../installation/additional-settings-for-developers/network-configuration/dds-settings.md#enable-localhost-only-communication). + +Also make sure the following returns an empty line: + +```bash +echo $ROS_LOCALHOST_ONLY +```