|
1 | 1 | # ardupilot_gz
|
2 | 2 |
|
3 |
| -Adapted from the [`ros_gz_project_template`](https://github.com/gazebosim/ros_gz_project_template) project integrating ROS 2 and Gazebo. |
| 3 | +This project contains ROS 2 packages for simulating models controlled |
| 4 | +by ArduPilot SITL with DDS support in Gazebo. |
| 5 | + |
| 6 | +The project is adapted from the [`ros_gz_project_template`](https://github.com/gazebosim/ros_gz_project_template) project. |
4 | 7 |
|
5 | 8 | ## Included packages
|
6 | 9 |
|
7 |
| -* `ardupilot_gz_description` - Contains the sdf description of the simulated |
8 |
| - system and any other assets. |
| 10 | +* `ardupilot_gz_description` - Contains the SDFormat description of the simulated |
| 11 | + system. |
9 | 12 |
|
10 |
| -* `ardupilot_gz_gazebo` - Contains Gazebo specific code and configurations such |
11 |
| - as system plugins. |
| 13 | +* `ardupilot_gz_gazebo` - Contains Gazebo specific code such as system plugins. |
12 | 14 |
|
13 | 15 | * `ardupilot_gz_application` - Contains ROS 2 specific code and configuration.
|
14 | 16 |
|
15 | 17 | * `ardupilot_gz_bringup` - Contains launch files and high level utilities.
|
16 | 18 |
|
17 | 19 |
|
| 20 | +## Prerequisites |
| 21 | + |
| 22 | +- Install [ROS 2 Humble](https://docs.ros.org/en/humble/index.html) |
| 23 | +- Install [Gazebo Garden](https://gazebosim.org/docs/garden) |
| 24 | + |
18 | 25 | ## Install
|
19 | 26 |
|
20 |
| -### Dependencies |
| 27 | +#### 1. Create a workspace folder |
21 | 28 |
|
22 |
| -1. Install [ROS 2 Humble](https://docs.ros.org/en/humble/index.html) |
| 29 | +```bash |
| 30 | +mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src |
| 31 | +``` |
23 | 32 |
|
24 |
| -1. Install [Gazebo Garden](https://gazebosim.org/docs/garden) |
| 33 | +#### 2. Get the project source |
25 | 34 |
|
26 |
| -1. Install necessary tools |
| 35 | +```bash |
| 36 | +cd ~/ros2_ws/src |
| 37 | +wget https://raw.githubusercontent.com/srmainwaring/ardupilot_gz/wips/wip-iris-camera/ros2_gz.repos |
| 38 | +vcs import --recursive < ros2_gz.repos |
| 39 | +``` |
27 | 40 |
|
28 |
| - `sudo apt install python3-vcstool python3-colcon-common-extensions git wget` |
| 41 | +#### 3. Set the Gazebo version to Garden: |
29 | 42 |
|
30 |
| -### Usage |
| 43 | +```bash |
| 44 | +export GZ_VERSION=garden |
| 45 | +``` |
31 | 46 |
|
32 |
| -1. Create a workspace, for example: |
| 47 | +#### 4. Update ROS dependencies |
33 | 48 |
|
34 |
| - ``` |
35 |
| - mkdir -p ~/ros2_ws/src |
36 |
| - cd ~/ros2_ws/src |
37 |
| - ``` |
| 49 | +```bash |
| 50 | +cd ~/ros_ws |
| 51 | +source /opt/ros/humble/setup.bash |
| 52 | +sudo apt update |
| 53 | +rosdep update |
| 54 | +rosdep install --rosdistro humble --from-paths src -i -r -y |
| 55 | +``` |
38 | 56 |
|
39 |
| -1. Clone the project: |
| 57 | +#### 5. Build |
40 | 58 |
|
41 |
| - ``` |
42 |
| - TBC |
43 |
| - ``` |
| 59 | +```bash |
| 60 | +cd ~/ros2_ws |
| 61 | +colcon build --cmake-args -DBUILD_TESTING=ON |
| 62 | +``` |
44 | 63 |
|
45 |
| -1. Set the Gazebo version to Garden: |
| 64 | +#### 6. Test |
46 | 65 |
|
47 |
| - ``` |
48 |
| - export GZ_VERSION=garden |
49 |
| - ``` |
| 66 | +```bash |
| 67 | +source ./install/setup.bash |
| 68 | +colcon test --packages-select ardupilot_dds_sitl ardupilot_dds_tests ardupilot_gazebo ardupilot_gz_applications ardupilot_gz_description ardupilot_gz_gazebo ardupilot_gz_bringup |
| 69 | +colcon test-result --all --verbose |
| 70 | +``` |
50 | 71 |
|
51 |
| -1. Install ROS dependencies |
| 72 | +## Usage |
52 | 73 |
|
53 |
| - ``` |
54 |
| - sudo rosdep init |
55 |
| - rosdep update |
56 |
| - rosdep install --from-paths src --ignore-src -r -y -i |
57 |
| - ``` |
| 74 | +#### 1. Source the workspace |
58 | 75 |
|
59 |
| -1. Build and install |
| 76 | +```bash |
| 77 | +source ~/ros2_ws/install/setup.sh |
| 78 | +``` |
60 | 79 |
|
61 |
| - ``` |
62 |
| - cd ~/ros2_ws |
63 |
| - colcon build --cmake-args -DBUILD_TESTING=ON |
64 |
| - ``` |
| 80 | +#### 2. Launch the simulation |
65 | 81 |
|
66 |
| -### Run |
| 82 | +```bash |
| 83 | +ros2 launch ardupilot_gz_bringup bringup_iris.launch.py |
| 84 | +``` |
67 | 85 |
|
68 |
| -1. Source the workspace |
| 86 | +#### 3. Launch a GCS (MAVPorxy) |
69 | 87 |
|
70 |
| - `. ~/ros2_ws/install/setup.sh` |
| 88 | +```bash |
| 89 | +mavproxy.py --console --map |
| 90 | +``` |
71 | 91 |
|
72 |
| -1. Launch the simulation |
| 92 | +#### 4. Inspect topics |
73 | 93 |
|
74 |
| - `ros2 launch ardupilot_gz_bringup bringup_iris.launch.py` |
| 94 | +```bash |
| 95 | +$ ros2 topic list |
| 96 | +/ROS2_BatteryState0 |
| 97 | +/ROS2_NavSatFix0 |
| 98 | +/ROS2_Time |
| 99 | +/clicked_point |
| 100 | +/clock |
| 101 | +/goal_pose |
| 102 | +/initialpose |
| 103 | +/iris/odometry |
| 104 | +/joint_states |
| 105 | +/parameter_events |
| 106 | +/robot_description |
| 107 | +/rosout |
| 108 | +/tf |
| 109 | +/tf_static |
| 110 | +``` |
75 | 111 |
|
76 |
| -1. Launch the a GCS |
| 112 | +## Notes |
77 | 113 |
|
78 |
| - `mavproxy.py --console --map` |
| 114 | +#### 1. Additional dependencies |
79 | 115 |
|
80 |
| -1. Inspect topics |
| 116 | +`ros_gz` has a dependency on `gps_msgs` included in |
81 | 117 |
|
82 |
| - ```bash |
83 |
| - $ ros2 topic list |
84 |
| - /ROS2_BatteryState0 |
85 |
| - /ROS2_NavSatFix0 |
86 |
| - /ROS2_Time |
87 |
| - /clicked_point |
88 |
| - /clock |
89 |
| - /goal_pose |
90 |
| - /initialpose |
91 |
| - /iris/odometry |
92 |
| - /joint_states |
93 |
| - /parameter_events |
94 |
| - /robot_description |
95 |
| - /rosout |
96 |
| - /tf |
97 |
| - /tf_static |
98 |
| - ``` |
| 118 | +```bash |
| 119 | +git clone https://github.com/swri-robotics/gps_umd.git -b ros2-devel |
| 120 | +``` |
99 | 121 |
|
| 122 | +Add `COLCON_IGNORE` to `gpsd_client` as this package is not required and |
| 123 | +will not build on macOS. |
100 | 124 |
|
101 |
| -## Notes |
| 125 | +#### 2. `sdformat_urdf` |
| 126 | + |
| 127 | +On macOS the `robot_state_publisher` node cannot load the |
| 128 | +`sdformat_urdf_plugin` plugin unless the |
| 129 | +suffix is changed: |
102 | 130 |
|
103 |
| -1. Additional dependency |
| 131 | +```bash |
| 132 | +cd ./install/sdformat_urdf/lib |
| 133 | +ln -s libsdformat_urdf_plugin.so libsdformat_urdf_plugin.dylib |
| 134 | +``` |
104 | 135 |
|
105 |
| - `ros_gz` has a dependency on `gps_msgs` included in |
| 136 | +#### 3. Model URIs |
106 | 137 |
|
107 |
| - ```bash |
108 |
| - git clone https://github.com/swri-robotics/gps_umd.git -b ros2-devel |
109 |
| - ``` |
| 138 | +The `sdformat_urdf` plugin requires that the `<uri>` element use |
| 139 | +the `package` prefix for a resource to be located by RViz. |
110 | 140 |
|
111 |
| - Add `COLCON_IGNORE` to `gpsd_client` as this package is not required and |
112 |
| - will not build on macOS. |
113 | 141 |
|
114 |
| -1. sdformat_urdf |
| 142 | +#### 4. SDFormat environment variables |
115 | 143 |
|
116 |
| - On macOS the `robot_state_publisher` node cannot load the |
117 |
| - `sdformat_urdf_plugin` plugin unless the |
118 |
| - suffix is changed: |
| 144 | +The `sdformat_urdf` plugin uses the `sdformat13` libraries to parse the |
| 145 | +model description. `sdformat13` relies on the environment variable |
| 146 | +`SDF_PATH` to resolve model resources. This is usually set in `gz-sim7`, |
| 147 | +however when using the plugins standalone, for instance in the bring-up |
| 148 | +launch files, `SDF_PATH` must be set otherwise the plugin will not resolve |
| 149 | +the models and their dependencies. |
119 | 150 |
|
120 |
| - ```bash |
121 |
| - cd ./install/sdformat_urdf/lib |
122 |
| - ln -s libsdformat_urdf_plugin.so libsdformat_urdf_plugin.dylib |
123 |
| - ``` |
| 151 | +```bash |
| 152 | +source ~/ros2_ws/install/setup.sh |
| 153 | +export SDF_PATH=$GZ_SIM_RESOURCE_PATH |
| 154 | +``` |
124 | 155 |
|
125 |
| -1. Model URIs |
| 156 | +This is checked in the launch file as `SDF_PATH` is not usually set |
| 157 | +by the `ament` environment hooks. |
126 | 158 |
|
127 |
| - The `<uri>` element must use the `package` prefix for resource to be located |
128 |
| - by RViz. |
|
0 commit comments