Skip to content

Commit 7b1dac0

Browse files
committed
Merge branch 'main' into add_unit_tests
# Conflicts: # src/test/CMakeLists.txt # src/test/test_EnvironmentXYZTheta.cpp # src/test/test_ugv_nav4d.cpp
2 parents 333b5d5 + efcc9b0 commit 7b1dac0

9 files changed

+112
-13
lines changed

README.md

Lines changed: 110 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,21 @@ This provides instructions for setting up a test environment using **Gazebo Fort
117117
## Prerequisites
118118

119119
### 1. Install ROS2 Humble
120-
Ensure you have **ROS2 Humble** installed on your system.
121-
122-
```
123-
sudo apt install ros-humble-desktop-full
124-
```
120+
Ensure you have **ROS2 Humble** installed on your system. Follow the official page at [ROS2 Humble Debian Installation](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debs.html)
125121

126122
### 2. Install Gazebo Fortress
127123
If you need to install **Gazebo Fortress**, follow the instructions provided on the official page at [Gazebo Installation](https://gazebosim.org/docs/latest/ros_installation/).
128124

129-
### 3. Get the repos
125+
### 3. Install SLAM
126+
If you have a SLAM package which provides a pointcloud map on a topic then you can skip this step. If not then you can use [lidarslam_ros2](https://github.com/rsasaki0109/lidarslam_ros2). Please follow the build and install instructions from the original repository. Set the parameter `robot_frame_id: "husky/base_link"` for the `scanmatcher` node in [lidarslam.yaml](https://github.com/rsasaki0109/lidarslam_ros2/blob/a63b8fa2485e05251505b2bb209598285106bff2/lidarslam/param/lidarslam.yaml#L4)
127+
128+
Install libg2o:
129+
130+
```
131+
sudo apt-get install -y ros-humble-libg2o
132+
```
133+
134+
### 3. Get ugv_nav4d_ros2 and a test environment for robot husky in gazebo
130135

131136
```
132137
mkdir -p your_ros2_workspace/src
@@ -137,6 +142,8 @@ You can clone the repo `ros2_humble_gazebo_sim` anywhere in your system. Here we
137142
```
138143
cd ~/your_ros2_workspace
139144
git clone https://github.com/dfki-ric/ros2_humble_gazebo_sim.git
145+
cd ros2_humble_gazebo_sim
146+
bash install_dependencies.bash
140147
```
141148
### 4. Husky Configuration
142149
To ensure that Gazebo can find the robot model, you need to export the following environment variable. Replace /path/to/ with the actual **complete** path where you clone the repository `ros2_humble_gazebo_sim`. Add this command to your terminal:
@@ -145,10 +152,11 @@ export IGN_GAZEBO_RESOURCE_PATH=/path/to/your_ros2_workspace/ros2_humble_gazebo_
145152
```
146153

147154
### 5. Building the ROS 2 Workspace
148-
Before launching the simulation, build your ROS 2 workspace with the release flag:
155+
Before launching the simulation, source your env.sh from ugv_nav4d and build your ROS 2 workspace:
149156

150157
```
151158
cd ~/your_ros2_workspace
159+
source path/to/ugv_nav4d/build/install/env.sh
152160
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
153161
```
154162

@@ -159,16 +167,107 @@ source ~/your_ros2_workspace/install/setup.bash
159167
cd ~/your_ros2_workspace/ros2_humble_gazebo_sim/simulation
160168
ros2 launch start.launch.py
161169
```
170+
You can use the `Teleop` plugin of Gazebo for sending velocity commands to the robot. Click on the three dots in top-right corner of Gazebo window and search for `Teleop`. Select the plugin and adjust the values as shown in figure.
171+
172+
![GazeboTeleop](doc/figures/gazebo_teleop.png)
173+
174+
Alternative to the `Teleop` plugin, you can use a joystick for moving the robot. For this, set the argument `use_joystick:=True`. Adjust the config files in the folder `/config` of the `ros2_humble_gazebo_sim` package from Step 3. Provide the full paths to the arguments `joy_config_file` and `teleop_twist_config_file` as shown below:
175+
176+
```
177+
ros2 launch start.launch.py use_joystick:=True joy_config_file:=/your_ros2_workspace/ros2_humble_gazebo_sim/simulation/config/joy_config.yaml teleop_twist_config_file:=/your_ros2_workspace/ros2_humble_gazebo_sim/simulation/config/teleop_twist_config.yaml
178+
```
179+
180+
Available arguments:
181+
```
182+
'robot_name':
183+
Options: husky
184+
(default: 'husky')
185+
186+
'world_file_name':
187+
Options: cave_circuit, urban_circuit_practice_03
188+
(default: 'cave_circuit')
189+
190+
'use_joystick':
191+
Use a real joystick.
192+
(default: 'False')
193+
194+
'joy_config_file':
195+
Full path to the joy config
196+
(default: 'joy_config_file')
197+
198+
'teleop_twist_config_file':
199+
Full path to the teleop twist joy config
200+
(default: 'teleop_twist_config_file')
201+
```
202+
203+
In a new terminal, source your workspace and start SLAM. Remap the node scanmatcher's topic `/input_cloud` to `/husky/scan/points` in the `lidarslam.launch.py`
204+
205+
```
206+
ros2 launch lidarslam lidarslam.launch.py main_param_dir:=/path/to/your/lidarslam.yaml
207+
```
208+
162209

163-
In a new terminal, source your workspace, ugv_nav4d library, and launch the ugv_nav4d_ros2. Replace the /path/to/ugv_nav4d with the location of the ugv_nav4d library. Add this command to your terminal:
210+
In a new terminal, source your workspace, ugv_nav4d library, and launch the ugv_nav4d_ros2. Replace the /path/to/your/ugv_nav4d with the location of the ugv_nav4d library. Add this command to your terminal:
164211

165212
```
166213
source ~/your_ros2_workspace/install/setup.bash
167-
source /path/to/ugv_nav4d/build/install/env.sh
214+
source /path/to/your/ugv_nav4d/build/install/env.sh
215+
216+
ros2 launch ugv_nav4d_ros2 ugv_nav4d.launch.py pointcloud_topic:=/map goal_topic:=/goal_pose
217+
```
218+
219+
### 7. Plan
168220

169-
ros2 launch ugv_nav4d_ros2 ugv_nav4d_ros2.launch.py
221+
In a new terminal, start Rviz2.
170222
```
171-
223+
cd ~/your_ros2_workspace
224+
source ~/your_ros2_workspace/install/setup.bash
225+
source /path/to/your/ugv_nav4d/build/install/env.sh
226+
rviz2 -d src/ugv_nav4d_ros2/config/ugv_nav4d.rviz
227+
```
228+
229+
After you start to move the robot, the planner will show the following status:
230+
231+
```
232+
[ugv_nav4d_ros2]: Planner state: Got Map
233+
[ugv_nav4d_ros2]: Initial patch added.
234+
[ugv_nav4d_ros2]: Planner state: Ready
235+
```
236+
237+
Visualize the MLS in Rviz2 using
238+
239+
```
240+
ros2 service call /ugv_nav4d_ros2/map_publish std_srvs/srv/Trigger
241+
```
242+
![MLSVizRviz2](doc/figures/mls_visualization_rviz2.png)
243+
244+
The gaps in the MLS map are due to the gaps in the scanned points. Move the robot around in the environment. After some time, you will see the MLS start to fill out the gaps.
245+
246+
![MLSVizRviz2](doc/figures/mls_visualization_rviz2_2.png)
247+
248+
Set a goal using the `2D Goal Pose` option in Rviz2 or by publishing to the topic `/ugv_nav4d_ros2/goal_pose`.
249+
250+
![GoalPose2D](doc/figures/set_goal_pose_rviz2.png)
251+
252+
```
253+
ros2 topic pub /goal_pose geometry_msgs/PoseStamped "{header: {stamp: {sec: 0, nanosec: 0}, frame_id: 'map'}, pose: {position: {x: 4.0, y: 4.0, z: 0.0}, orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}}}"
254+
```
255+
256+
#### cave_circuit
257+
258+
![MLSVizRviz2](doc/figures/mls_visualization_rviz2_3.png)
259+
260+
If planning is successful you should see the following status in the terminal:
261+
262+
```
263+
[ugv_nav4d_ros2]: FOUND_SOLUTION
264+
```
265+
266+
#### urban_circuit_practice_03
267+
You could repeat the same steps and in Step 6 set `world_file_name:=urban_circuit_practice_03`.
268+
269+
![MLSVizRviz2](doc/figures/mls_visualization_rviz2_4.png)
270+
172271
---
173272
## Implementation Details
174273
### Planning

doc/figures/gazebo_teleop.png

630 KB
Loading
165 KB
Loading
349 KB
Loading
374 KB
Loading
348 KB
Loading
301 KB
Loading

src/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ install(TARGETS test_PreComputedMotions EXPORT test_PreComputedMotions-targets
5252
ARCHIVE DESTINATION lib
5353
LIBRARY DESTINATION lib
5454
RUNTIME DESTINATION bin
55-
)
55+
)

src/test/test_EnvironmentXYZTheta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,4 @@ BOOST_FIXTURE_TEST_CASE(set_start_and_goal, EnvironmentXYZThetaTest) {
253253

254254
environment->setStart(startPos,0);
255255
environment->setGoal(goalPos,0);
256-
}
256+
}

0 commit comments

Comments
 (0)