Skip to content

Commit c04afb4

Browse files
AP_DDS: Readme resored
1 parent ebb7945 commit c04afb4

File tree

1 file changed

+74
-75
lines changed

1 file changed

+74
-75
lines changed

libraries/AP_DDS/README.md

Lines changed: 74 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ title: UDP Loopback
1010
---
1111
graph LR
1212
13-
subgraph Linux Computer
13+
subgraph Linux Computer
1414
15-
subgraph Ardupilot SITL
16-
veh[sim_vehicle.py] <--> xrceClient[EProsima Micro XRCE DDS Client]
17-
xrceClient <--> port1[udp:2019]
18-
end
15+
subgraph Ardupilot SITL
16+
veh[sim_vehicle.py] <--> xrceClient[EProsima Micro XRCE DDS Client]
17+
xrceClient <--> port1[udp:2019]
18+
end
1919
20-
subgraph DDS Application
21-
ros[ROS 2 Node] <--> agent[Micro ROS Agent]
22-
agent <-->port1[udp:2019]
23-
end
20+
subgraph DDS Application
21+
ros[ROS 2 Node] <--> agent[Micro ROS Agent]
22+
agent <-->port1[udp:2019]
23+
end
2424
25-
loopback
25+
loopback
2626
27-
end
27+
end
2828
```
2929

3030
```mermaid
@@ -33,21 +33,21 @@ title: Hardware Serial Port Loopback
3333
---
3434
graph LR
3535
36-
subgraph Linux Computer
36+
subgraph Linux Computer
3737
38-
subgraph Ardupilot SITL
39-
veh[sim_vehicle.py] <--> xrceClient[EProsima Micro XRCE DDS Client]
40-
xrceClient <--> port1[devUSB1]
41-
end
38+
subgraph Ardupilot SITL
39+
veh[sim_vehicle.py] <--> xrceClient[EProsima Micro XRCE DDS Client]
40+
xrceClient <--> port1[devUSB1]
41+
end
4242
43-
subgraph DDS Application
44-
ros[ROS 2 Node] <--> agent[Micro ROS Agent]
45-
agent <--> port2[devUSB2]
46-
end
43+
subgraph DDS Application
44+
ros[ROS 2 Node] <--> agent[Micro ROS Agent]
45+
agent <--> port2[devUSB2]
46+
end
4747
48-
port1 <--> port2
48+
port1 <--> port2
4949
50-
end
50+
end
5151
```
5252

5353

@@ -59,89 +59,88 @@ Follow the wiki [here](https://ardupilot.org/dev/docs/ros2.html#installation-ubu
5959

6060
### Serial Only: Set up serial for SITL with DDS
6161

62-
On Linux, creating a virtual serial port will be necessary to use serial in SITL, because of that install socat.
62+
On Linux, creating a virtual serial port will be necessary to use serial in SITL, because of that install socat.
6363

64-
```
65-
sudo apt-get update
66-
sudo apt-get install socat
67-
```
64+
```
65+
sudo apt-get update
66+
sudo apt-get install socat
67+
```
6868

6969
## Setup ardupilot for SITL with DDS
7070

71-
Set up your [SITL](https://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html).
72-
Run the simulator with the following command. If using UDP, the only parameter you need to set it `DDS_ENABLE`.
71+
Set up your [SITL](https://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html).
72+
Run the simulator with the following command. If using UDP, the only parameter you need to set it `DDS_ENABLE`.
7373

74-
| Name | Description | Default |
75-
| - | - | - |
76-
| DDS_ENABLE | Set to 1 to enable DDS, or 0 to disable | 1 |
77-
| SERIAL1_BAUD | The serial baud rate for DDS | 57 |
78-
| SERIAL1_PROTOCOL | Set this to 45 to use DDS on the serial port | 0 |
74+
| Name | Description | Default |
75+
| - | - | - |
76+
| DDS_ENABLE | Set to 1 to enable DDS, or 0 to disable | 1 |
77+
| SERIAL1_BAUD | The serial baud rate for DDS | 57 |
78+
| SERIAL1_PROTOCOL | Set this to 45 to use DDS on the serial port | 0 |
7979

80-
```console
80+
```console
8181
# Wipe params till you see "AP: ArduPilot Ready"
8282
# Select your favorite vehicle type
83-
sim_vehicle.py -w -v ArduPlane --console -DG --enable-dds
83+
sim_vehicle.py -w -v ArduPlane --console -DG --enable-dds
8484

8585
# Only set this for Serial, which means 115200 baud
8686
param set SERIAL1_BAUD 115
8787
# See libraries/AP_SerialManager/AP_SerialManager.h AP_SerialManager SerialProtocol_DDS_XRCE
88-
param set SERIAL1_PROTOCOL 45
89-
```
88+
param set SERIAL1_PROTOCOL 45
89+
```
9090

91-
DDS is currently enabled by default, if it's part of the build. To disable it, run the following and reboot the simulator.
92-
```
93-
param set DDS_ENABLE 0
94-
REBOOT
95-
```
91+
DDS is currently enabled by default, if it's part of the build. To disable it, run the following and reboot the simulator.
92+
```
93+
param set DDS_ENABLE 0
94+
REBOOT
95+
```
9696

9797
## Setup ROS 2 and micro-ROS
9898

99-
Follow the steps to use the microROS Agent
99+
Follow the steps to use the microROS Agent
100100

101-
- Install ROS Humble (as described here)
101+
- Install ROS Humble (as described here)
102102

103-
- https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
103+
- https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
104104

105-
- Install geographic_msgs
106-
```console
107-
sudo apt install ros-humble-geographic-msgs
108-
```
105+
- Install geographic_msgs
106+
```console
107+
sudo apt install ros-humble-geographic-msgs
108+
```
109109

110-
- Install and run the microROS agent (as described here). Make sure to use the `humble` branch.
111-
- Follow [the instructions](https://micro.ros.org/docs/tutorials/core/first_application_linux/) for the following:
110+
- Install and run the microROS agent (as described here). Make sure to use the `humble` branch.
111+
- Follow [the instructions](https://micro.ros.org/docs/tutorials/core/first_application_linux/) for the following:
112112

113-
- Do "Installing ROS 2 and the micro-ROS build system"
114-
- Skip the docker run command, build it locally instead
115-
- Skip "Creating a new firmware workspace"
116-
- Skip "Building the firmware"
117-
- Do "Creating the micro-ROS agent"
118-
- Source your ROS workspace
113+
- Do "Installing ROS 2 and the micro-ROS build system"
114+
- Skip the docker run command, build it locally instead
115+
- Skip "Creating a new firmware workspace"
116+
- Skip "Building the firmware"
117+
- Do "Creating the micro-ROS agent"
118+
- Source your ROS workspace
119119

120120
## Using the ROS 2 CLI to Read Ardupilot Data
121121

122-
After your setups are complete, do the following:
123-
- Source the ROS 2 installation
124-
```console
125-
source /opt/ros/humble/setup.bash
126-
```
127-
128-
Next, follow the associated section for your chosen transport, and finally you can use the ROS 2 CLI.
122+
After your setups are complete, do the following:
123+
- Source the ROS 2 installation
124+
```console
125+
source /opt/ros/humble/setup.bash
126+
```
127+
Next, follow the associated section for your chosen transport, and finally you can use the ROS 2 CLI.
129128

130129
### UDP (recommended for SITL)
131130

132-
- Run the microROS agent
133-
```console
134-
cd ardupilot/libraries/AP_DDS
135-
ros2 run micro_ros_agent micro_ros_agent udp4 -p 2019
136-
```
137-
- Run SITL (remember to kill any terminals running ardupilot SITL beforehand)
138-
```console
139-
sim_vehicle.py -v ArduPlane -DG --console --enable-dds
140-
```
131+
- Run the microROS agent
132+
```console
133+
cd ardupilot/libraries/AP_DDS
134+
ros2 run micro_ros_agent micro_ros_agent udp4 -p 2019
135+
```
136+
- Run SITL (remember to kill any terminals running ardupilot SITL beforehand)
137+
```console
138+
sim_vehicle.py -v ArduPlane -DG --console --enable-dds
139+
```
141140

142141
### Serial
143142

144-
- Start a virtual serial port with socat. Take note of the two `/dev/pts/*` ports. If yours are different, substitute as needed.
143+
- Start a virtual serial port with socat. Take note of the two `/dev/pts/*` ports. If yours are different, substitute as needed.
145144
```console
146145
socat -d -d pty,raw,echo=0 pty,raw,echo=0
147146
>>> 2023/02/21 05:26:06 socat[334] N PTY is /dev/pts/1

0 commit comments

Comments
 (0)