Skip to content

Commit aed0dfa

Browse files
authored
Copter: add gimbal and camera to iris (#2)
- Merge gimbal and camera peripheral into model. - Update iris launch file to set SDF_PATH before running the sdformat_urdf converter. - Update bring up launch file to use the iris with gimbal params. - Add bridge entry for the camera and camera info. - Add image display and TF to rviz config. - Add ros2_gz.repos containing dependencies - Update README Signed-off-by: Rhys Mainwaring <[email protected]>
1 parent 2e40090 commit aed0dfa

File tree

7 files changed

+337
-94
lines changed

7 files changed

+337
-94
lines changed

README.md

+109-79
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,158 @@
11
# ardupilot_gz
22

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.
47

58
## Included packages
69

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.
912

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.
1214

1315
* `ardupilot_gz_application` - Contains ROS 2 specific code and configuration.
1416

1517
* `ardupilot_gz_bringup` - Contains launch files and high level utilities.
1618

1719

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+
1825
## Install
1926

20-
### Dependencies
27+
#### 1. Create a workspace folder
2128

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

24-
1. Install [Gazebo Garden](https://gazebosim.org/docs/garden)
33+
#### 2. Get the project source
2534

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

28-
`sudo apt install python3-vcstool python3-colcon-common-extensions git wget`
41+
#### 3. Set the Gazebo version to Garden:
2942

30-
### Usage
43+
```bash
44+
export GZ_VERSION=garden
45+
```
3146

32-
1. Create a workspace, for example:
47+
#### 4. Update ROS dependencies
3348

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

39-
1. Clone the project:
57+
#### 5. Build
4058

41-
```
42-
TBC
43-
```
59+
```bash
60+
cd ~/ros2_ws
61+
colcon build --cmake-args -DBUILD_TESTING=ON
62+
```
4463

45-
1. Set the Gazebo version to Garden:
64+
#### 6. Test
4665

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

51-
1. Install ROS dependencies
72+
## Usage
5273

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
5875

59-
1. Build and install
76+
```bash
77+
source ~/ros2_ws/install/setup.sh
78+
```
6079

61-
```
62-
cd ~/ros2_ws
63-
colcon build --cmake-args -DBUILD_TESTING=ON
64-
```
80+
#### 2. Launch the simulation
6581

66-
### Run
82+
```bash
83+
ros2 launch ardupilot_gz_bringup bringup_iris.launch.py
84+
```
6785

68-
1. Source the workspace
86+
#### 3. Launch a GCS (MAVPorxy)
6987

70-
`. ~/ros2_ws/install/setup.sh`
88+
```bash
89+
mavproxy.py --console --map
90+
```
7191

72-
1. Launch the simulation
92+
#### 4. Inspect topics
7393

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

76-
1. Launch the a GCS
112+
## Notes
77113

78-
`mavproxy.py --console --map`
114+
#### 1. Additional dependencies
79115

80-
1. Inspect topics
116+
`ros_gz` has a dependency on `gps_msgs` included in
81117

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

122+
Add `COLCON_IGNORE` to `gpsd_client` as this package is not required and
123+
will not build on macOS.
100124

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:
102130

103-
1. Additional dependency
131+
```bash
132+
cd ./install/sdformat_urdf/lib
133+
ln -s libsdformat_urdf_plugin.so libsdformat_urdf_plugin.dylib
134+
```
104135

105-
`ros_gz` has a dependency on `gps_msgs` included in
136+
#### 3. Model URIs
106137

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.
110140

111-
Add `COLCON_IGNORE` to `gpsd_client` as this package is not required and
112-
will not build on macOS.
113141

114-
1. sdformat_urdf
142+
#### 4. SDFormat environment variables
115143

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.
119150

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

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.
126158

127-
The `<uri>` element must use the `package` prefix for resource to be located
128-
by RViz.

0 commit comments

Comments
 (0)