ros2单播组网

/etc/ros/fastdds.xml文件内增加如下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0" encoding="UTF-8"?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
<participant profile_name="unicast_connection" is_default_profile="true">
<rtps>
<builtin>
<initialPeersList>
<locator>
<udpv4>
<address>127.0.0.1</address>
</udpv4>
</locator>
<locator>
<udpv4>
<address>172.19.0.2</address>
</udpv4>
</locator>
</initialPeersList>
</builtin>
<userTransports>
<transport_id>lotsOfPeers</transport_id>
</userTransports>
</rtps>
</participant>
</profiles>

增加环境变量

1
echo 'FASTRTPS_DEFAULT_PROFILES_FILE=/etc/ros/fastdds.xml' > ~/.bashrc