Skip to content

Commit 35a91bd

Browse files
Added README.md for dummy_robot_bringup. (#574)
Signed-off-by: Bey Hao Yun <[email protected]> Signed-off-by: Alejandro Hernández Cordero <[email protected]> Signed-off-by: Alejandro Hernandez Cordero <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]>
1 parent 8c49a99 commit 35a91bd

File tree

7 files changed

+306
-184
lines changed

7 files changed

+306
-184
lines changed

dummy_robot/dummy_robot_bringup/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project(dummy_robot_bringup)
44

55
find_package(ament_cmake REQUIRED)
66

7-
install(DIRECTORY launch
7+
install(DIRECTORY launch rviz
88
DESTINATION share/${PROJECT_NAME})
99

1010
if(BUILD_TESTING)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
## **What Is This?**
2+
3+
This is a simple demo robot with all components from publishing **joint states** to publishing **fake laser data** to visualizing the robot model on a map in `RViz2`.
4+
5+
## **Build**
6+
7+
```bash
8+
colcon build --package-select dummy_map_server dummy_sensors dummy_robot_bringup
9+
```
10+
11+
## **Run**
12+
13+
```bash
14+
ros2 launch dummy_robot_bringup dummy_robot_bringup_launch.py
15+
```
16+
17+
## **Verify**
18+
19+
A similar terminal output should be seen:
20+
21+
```bash
22+
[INFO] [launch]: All log files can be found below /home/$USER/.ros/log/2022-07-22-17-02-33-629155-comname-39641
23+
[INFO] [launch]: Default logging verbosity is set to INFO
24+
[INFO] [dummy_map_server-1]: process started with pid [39643]
25+
[INFO] [robot_state_publisher-2]: process started with pid [39645]
26+
[INFO] [dummy_joint_states-3]: process started with pid [39647]
27+
[INFO] [dummy_laser-4]: process started with pid [39649]
28+
[dummy_laser-4] [INFO] [1658480554.018685559] [dummy_laser]: angle inc: 0.004363
29+
[dummy_laser-4] [INFO] [1658480554.018738346] [dummy_laser]: scan size: 1081
30+
[dummy_laser-4] [INFO] [1658480554.018747091] [dummy_laser]: scan time increment: 0.000028
31+
[robot_state_publisher-2] Link single_rrbot_link1 had 1 children
32+
[robot_state_publisher-2] Link single_rrbot_link2 had 1 children
33+
[robot_state_publisher-2] Link single_rrbot_link3 had 2 children
34+
[robot_state_publisher-2] Link single_rrbot_camera_link had 0 children
35+
[robot_state_publisher-2] Link single_rrbot_hokuyo_link had 0 children
36+
[robot_state_publisher-2] [INFO] [1658480554.019739425] [robot_state_publisher]: got segment single_rrbot_camera_link
37+
[robot_state_publisher-2] [INFO] [1658480554.019783457] [robot_state_publisher]: got segment single_rrbot_hokuyo_link
38+
[robot_state_publisher-2] [INFO] [1658480554.019791344] [robot_state_publisher]: got segment single_rrbot_link1
39+
[robot_state_publisher-2] [INFO] [1658480554.019796905] [robot_state_publisher]: got segment single_rrbot_link2
40+
[robot_state_publisher-2] [INFO] [1658480554.019801861] [robot_state_publisher]: got segment single_rrbot_link3
41+
[robot_state_publisher-2] [INFO] [1658480554.019806522] [robot_state_publisher]: got segment world
42+
```
43+
44+
The robot should be displayed similarly in `RViz2`:
45+
46+
![](img/robot_in_rviz.gif)
47+
48+
## **FAQ**
49+
50+
`Q`: I ran `ros2 launch dummy_robot_bringup dummy_robot_bringup_launch.py` and `rviz2`. However, nothing is displayed in `RViz2` window.
51+
52+
`A`: This issue could be related to the **ROS 2 Daemon**. It serves the same role as a **ROS1 Master** but within **ROS 2**. Restarting the daemon, as follows, should resolve this issue.
53+
54+
`Reference`: https://github.com/ros2/ros2cli/issues/582#issuecomment-775997721
55+
56+
```bash
57+
ros2 daemon stop; ros2 daemon start
58+
# Verify
59+
# Open new terminal
60+
ros2 launch dummy_robot_bringup dummy_robot_bringup_launch.py
61+
# Open new terminal
62+
ros2 node list
63+
```
64+
65+
```bash
66+
# You should see the following terminal output:
67+
/dummy_joint_states
68+
/dummy_laser
69+
/dummy_map_server
70+
/robot_state_publisher
71+
```
72+
73+
## **References**
74+
75+
- Original Rolling Demo Tutorial: https://docs.ros.org/en/rolling/Tutorials/Demos/dummy-robot-demo.html
76+
- What is ROS 2 Daemon: https://answers.ros.org/question/327348/what-is-ros2-daemon/

dummy_robot/dummy_robot_bringup/config/dummy_robot.rviz

Lines changed: 0 additions & 180 deletions
This file was deleted.
716 KB
Loading

dummy_robot/dummy_robot_bringup/launch/dummy_robot_bringup_launch.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
import os
1616

1717
from launch import LaunchDescription
18-
from launch.substitutions import FileContent
1918
from launch_ros.actions import Node
20-
from launch_ros.substitutions import FindPackageShare
19+
from launch_ros.substitutions import FileContent, FindPackageShare
2120

2221

2322
def generate_launch_description():
23+
2424
pkg_share = FindPackageShare('dummy_robot_bringup').find('dummy_robot_bringup')
25+
26+
default_rviz_config_path = os.path.join(pkg_share, 'rviz/dummy_robot.rviz')
27+
2528
urdf_file = os.path.join(pkg_share, 'launch', 'single_rrbot.urdf')
2629
robot_desc = FileContent(urdf_file)
2730
rsp_params = {'robot_description': robot_desc}
@@ -31,5 +34,8 @@ def generate_launch_description():
3134
Node(package='robot_state_publisher', executable='robot_state_publisher',
3235
output='screen', parameters=[rsp_params]),
3336
Node(package='dummy_sensors', executable='dummy_joint_states', output='screen'),
34-
Node(package='dummy_sensors', executable='dummy_laser', output='screen')
37+
Node(package='dummy_sensors', executable='dummy_laser', output='screen'),
38+
Node(package='rviz2', executable='rviz2', name='rviz2', output='screen',
39+
arguments=['-d', default_rviz_config_path])
40+
3541
])

dummy_robot/dummy_robot_bringup/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<exec_depend>launch</exec_depend>
2424
<exec_depend>launch_ros</exec_depend>
2525
<exec_depend>robot_state_publisher</exec_depend>
26+
<exec_depend>rviz2</exec_depend>
2627

2728
<test_depend>ament_cmake_gtest</test_depend>
2829
<test_depend>ament_lint_auto</test_depend>

0 commit comments

Comments
 (0)