Skip to content

Commit 102b9f1

Browse files
authored
support ROS_LOCALHOST_ONLY variable (#69)
1 parent e0514b9 commit 102b9f1

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

micro-ROS-Agent/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ RUN . /opt/ros/$ROS_DISTRO/setup.sh \
99
&& rm -rf log/ build/ src/
1010

1111
# Disable shared memory
12-
COPY disable_fastdds_shm.xml /tmp/
13-
ENV FASTRTPS_DEFAULT_PROFILES_FILE=/tmp/disable_fastdds_shm.xml
12+
COPY disable_fastdds_shm.xml disable_fastdds_shm_localhost_only.xml /tmp/
1413

1514
# setup entrypoint
1615
COPY ./micro-ros_entrypoint.sh /
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!--The only purpose of this file is to disable Fast-DDS SHM transport used by default to use UDPv4-->
3+
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles" >
4+
<transport_descriptors>
5+
<transport_descriptor>
6+
<transport_id>CustomUdpTransport</transport_id>
7+
<type>UDPv4</type>
8+
<interfaceWhiteList>
9+
<address>127.0.0.1</address>
10+
</interfaceWhiteList>
11+
</transport_descriptor>
12+
</transport_descriptors>
13+
14+
<participant profile_name="participant_profile" is_default_profile="true">
15+
<rtps>
16+
<userTransports>
17+
<transport_id>CustomUdpTransport</transport_id>
18+
</userTransports>
19+
20+
<useBuiltinTransports>false</useBuiltinTransports>
21+
</rtps>
22+
</participant>
23+
</profiles>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
. "/opt/ros/$ROS_DISTRO/setup.sh"
22
. "/uros_ws/install/local_setup.sh"
3+
4+
if [ "$ROS_LOCALHOST_ONLY" = "1" ] ; then
5+
export FASTRTPS_DEFAULT_PROFILES_FILE=/tmp/disable_fastdds_shm_localhost_only.xml
6+
else
7+
export FASTRTPS_DEFAULT_PROFILES_FILE=/tmp/disable_fastdds_shm.xml
8+
fi
9+
310
exec ros2 run micro_ros_agent micro_ros_agent "$@"

0 commit comments

Comments
 (0)