@@ -10,21 +10,21 @@ title: UDP Loopback
10
10
---
11
11
graph LR
12
12
13
- subgraph Linux Computer
13
+ subgraph Linux Computer
14
14
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
19
19
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
24
24
25
- loopback
25
+ loopback
26
26
27
- end
27
+ end
28
28
```
29
29
30
30
``` mermaid
@@ -33,21 +33,21 @@ title: Hardware Serial Port Loopback
33
33
---
34
34
graph LR
35
35
36
- subgraph Linux Computer
36
+ subgraph Linux Computer
37
37
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
42
42
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
47
47
48
- port1 <--> port2
48
+ port1 <--> port2
49
49
50
- end
50
+ end
51
51
```
52
52
53
53
@@ -59,89 +59,88 @@ Follow the wiki [here](https://ardupilot.org/dev/docs/ros2.html#installation-ubu
59
59
60
60
### Serial Only: Set up serial for SITL with DDS
61
61
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.
63
63
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
+ ```
68
68
69
69
## Setup ardupilot for SITL with DDS
70
70
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 ` .
73
73
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 |
79
79
80
- ```console
80
+ ``` console
81
81
# Wipe params till you see " AP: ArduPilot Ready"
82
82
# 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
84
84
85
85
# Only set this for Serial, which means 115200 baud
86
86
param set SERIAL1_BAUD 115
87
87
# 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
+ ```
90
90
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
+ ```
96
96
97
97
## Setup ROS 2 and micro-ROS
98
98
99
- Follow the steps to use the microROS Agent
99
+ Follow the steps to use the microROS Agent
100
100
101
- - Install ROS Humble (as described here)
101
+ - Install ROS Humble (as described here)
102
102
103
- - https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
103
+ - https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
104
104
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
+ ```
109
109
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:
112
112
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
119
119
120
120
## Using the ROS 2 CLI to Read Ardupilot Data
121
121
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.
129
128
130
129
### UDP (recommended for SITL)
131
130
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
+ ```
141
140
142
141
### Serial
143
142
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.
145
144
``` console
146
145
socat -d -d pty,raw,echo=0 pty,raw,echo=0
147
146
>>> 2023/02/21 05:26:06 socat[334] N PTY is /dev/pts/1
0 commit comments