Skip to content

Commit 86182bd

Browse files
AP_DDS: Readme updated with fractional lat lon
1 parent d964105 commit 86182bd

File tree

1 file changed

+80
-80
lines changed

1 file changed

+80
-80
lines changed

libraries/AP_DDS/README.md

Lines changed: 80 additions & 80 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,89 @@ 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
86-
param set SERIAL1_BAUD 115
86+
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-
```
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+
```
127127

128-
Next, follow the associated section for your chosen transport, and finally you can use the ROS 2 CLI.
128+
Next, follow the associated section for your chosen transport, and finally you can use the ROS 2 CLI.
129129

130130
### UDP (recommended for SITL)
131131

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-
```
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+
```
141141

142142
### Serial
143143

144-
- Start a virtual serial port with socat. Take note of the two `/dev/pts/*` ports. If yours are different, substitute as needed.
144+
- Start a virtual serial port with socat. Take note of the two `/dev/pts/*` ports. If yours are different, substitute as needed.
145145
```console
146146
socat -d -d pty,raw,echo=0 pty,raw,echo=0
147147
>>> 2023/02/21 05:26:06 socat[334] N PTY is /dev/pts/1
@@ -292,16 +292,16 @@ ardupilot_msgs.srv.RallySet_Response(success=True, size=0)
292292
Append a Rally Point:
293293

294294
Rally points units of measure are:
295-
* degrees for the latitude and longitude;
296-
* meters for the altitude.
295+
* degrees for the latitude and longitude (up to 7 decimal digits resolution);
296+
* meters for the altitude (with no decimals).
297297

298298
The `altitude_frame` specifies the datum for the altitude, among Home, Absolute, Terrain or EKF Origin
299299
(use the enumerator specified in the message definition).
300300

301301
```bash
302-
ros2 service call /ap/rally_set ardupilot_msgs/srv/RallySet "{rally: {altitude_frame: 1, point: {latitude: -35, longitude: 151, altitude: 400}}}"
302+
ros2 service call /ap/rally_set ardupilot_msgs/srv/RallySet "{rally: {altitude_frame: 1, point: {latitude: -35.12345, longitude: 151.12345, altitude: 400.5}}}"
303303

304-
requester: making request: ardupilot_msgs.srv.RallySet_Request(rally=ardupilot_msgs.msg.Rally(point=geographic_msgs.msg.GeoPoint(latitude=-35.0, longitude=151.0, altitude=400.0), altitude_frame=1), clear=False)
304+
requester: making request: ardupilot_msgs.srv.RallySet_Request(rally=ardupilot_msgs.msg.Rally(point=geographic_msgs.msg.GeoPoint(latitude=-35.12345, longitude=151.12345, altitude=400.5), altitude_frame=1), clear=False)
305305

306306
response:
307307
ardupilot_msgs.srv.RallySet_Response(success=True, size=1)
@@ -315,7 +315,7 @@ ros2 service call /ap/rally_get ardupilot_msgs/srv/RallyGet "index: 0"
315315
requester: making request: ardupilot_msgs.srv.RallyGet_Request(index=0)
316316

317317
response:
318-
ardupilot_msgs.srv.RallyGet_Response(success=True, size=1, rally=ardupilot_msgs.msg.Rally(point=geographic_msgs.msg.GeoPoint(latitude=-35.0, longitude=151.0, altitude=400.0), altitude_frame=1))
318+
ardupilot_msgs.srv.RallyGet_Response(success=True, size=1, rally=ardupilot_msgs.msg.Rally(point=geographic_msgs.msg.GeoPoint(latitude=35.12345504760742, longitude=151.12345176604336, altitude=400.0), altitude_frame=1))
319319
```
320320

321321
## Commanding using ROS 2 Topics

0 commit comments

Comments
 (0)