3
3
from ament_index_python .packages import get_package_share_directory
4
4
from launch import LaunchDescription
5
5
from launch .actions import IncludeLaunchDescription
6
-
7
6
from launch .launch_description_sources import PythonLaunchDescriptionSource
8
7
from launch .substitutions import Command
9
8
from launch_ros .actions import Node
10
9
from launch_ros .parameter_descriptions import ParameterValue
11
- from math import pi
12
10
13
11
14
12
def generate_launch_description ():
15
13
# Get the launch directory
16
- pkg_rove_bringup = get_package_share_directory ('rove_bringup' )
17
- pkg_rove_description = get_package_share_directory ('rove_description' )
18
- pkg_ros_gz_sim = get_package_share_directory ('ros_gz_sim' )
14
+ pkg_rove_bringup = get_package_share_directory ("rove_bringup" )
15
+ pkg_rove_description = get_package_share_directory ("rove_description" )
16
+ pkg_ros_gz_sim = get_package_share_directory ("ros_gz_sim" )
17
+ pkg_ovis = get_package_share_directory ("ovis_bringup" )
19
18
20
19
# Get the URDF file
21
- urdf_path = os .path .join (pkg_rove_description , ' urdf' , ' rove.urdf.xacro' )
22
- robot_desc = ParameterValue (Command ([' xacro ' , urdf_path ]), value_type = str )
20
+ urdf_path = os .path .join (pkg_rove_description , " urdf" , " rove.urdf.xacro" )
21
+ robot_desc = ParameterValue (Command ([" xacro " , urdf_path ]), value_type = str )
23
22
24
23
# Get simulation file
25
- world_file_name = ' worlds/base_world.world'
24
+ world_file_name = " worlds/base_world.world"
26
25
world = os .path .join (pkg_rove_description , world_file_name )
27
26
28
27
# Setup to launch the simulator and Gazebo world
29
28
gz_sim = IncludeLaunchDescription (
30
29
PythonLaunchDescriptionSource (
31
- os .path .join (pkg_ros_gz_sim , 'launch' , 'gz_sim.launch.py' )),
32
- launch_arguments = {'gz_args' : "-v 4 -r " + world }.items (),
30
+ os .path .join (pkg_ros_gz_sim , "launch" , "gz_sim.launch.py" )
31
+ ),
32
+ launch_arguments = {"gz_args" : "-v 4 -r " + world }.items (),
33
33
)
34
34
35
- walls_file_path = os .path .join (pkg_rove_description , ' worlds' , ' walls.sdf' )
35
+ walls_file_path = os .path .join (pkg_rove_description , " worlds" , " walls.sdf" )
36
36
spawn_walls = Node (
37
- package = 'ros_gz_sim' ,
38
- executable = 'create' ,
39
- arguments = ['-file' , walls_file_path ,
40
- '-name' , 'walls' ,
41
- '-x' , '0' ,
42
- '-y' , '0' ,
43
- '-z' , '0' ],
44
- output = 'screen' ,
37
+ package = "ros_gz_sim" ,
38
+ executable = "create" ,
39
+ arguments = [
40
+ "-file" ,
41
+ walls_file_path ,
42
+ "-name" ,
43
+ "walls" ,
44
+ "-x" ,
45
+ "0" ,
46
+ "-y" ,
47
+ "0" ,
48
+ "-z" ,
49
+ "0" ,
50
+ ],
51
+ output = "screen" ,
45
52
)
46
53
47
- actor_file_path = os .path .join (pkg_rove_description , ' worlds' , ' actor.sdf' )
54
+ actor_file_path = os .path .join (pkg_rove_description , " worlds" , " actor.sdf" )
48
55
spawn_actor = Node (
49
- package = 'ros_gz_sim' ,
50
- executable = 'create' ,
51
- arguments = ['-file' , actor_file_path ,
52
- '-name' , 'actor' ,
53
- '-topic' , 'actor_pose' ,
54
- '-x' , '0' ,
55
- '-y' , '0' ,
56
- '-z' , '0.1' ],
57
- output = 'screen' ,
56
+ package = "ros_gz_sim" ,
57
+ executable = "create" ,
58
+ arguments = [
59
+ "-file" ,
60
+ actor_file_path ,
61
+ "-name" ,
62
+ "actor" ,
63
+ "-x" ,
64
+ "0" ,
65
+ "-y" ,
66
+ "0" ,
67
+ "-z" ,
68
+ "0.1" ,
69
+ ],
70
+ output = "screen" ,
58
71
)
59
72
60
- yaw = - pi / 2
61
-
62
73
# Spawn robot
63
74
spawn_rove = Node (
64
- package = ' ros_gz_sim' ,
65
- executable = ' create' ,
75
+ package = " ros_gz_sim" ,
76
+ executable = " create" ,
66
77
arguments = [
67
- '-name' , 'rove' ,
68
- '-topic' , 'robot_description' ,
69
- '-x' , '0' ,
70
- '-y' , '0' ,
71
- '-z' , '0.1' ,
72
- '-Y' , str (yaw ),
78
+ "-name" ,
79
+ "rove" ,
80
+ "-topic" ,
81
+ "robot_description" ,
82
+ "-x" ,
83
+ "0" ,
84
+ "-y" ,
85
+ "0" ,
86
+ "-z" ,
87
+ "0.1" ,
73
88
],
74
- output = ' screen' ,
89
+ output = " screen" ,
75
90
)
76
91
77
92
# Takes the description and joint angles as inputs and publishes
78
93
# the 3D poses of the robot links
79
94
robot_state_publisher = Node (
80
- package = ' robot_state_publisher' ,
81
- executable = ' robot_state_publisher' ,
82
- name = ' robot_state_publisher' ,
83
- output = ' both' ,
95
+ package = " robot_state_publisher" ,
96
+ executable = " robot_state_publisher" ,
97
+ name = " robot_state_publisher" ,
98
+ output = " both" ,
84
99
parameters = [
85
- {'robot_description' : robot_desc },
86
- {"use_sim_time" : True , }
87
- ]
100
+ {"robot_description" : robot_desc },
101
+ {
102
+ "use_sim_time" : True ,
103
+ },
104
+ ],
88
105
)
89
106
90
107
# fake human tracker
91
108
human_tracker = Node (
92
- package = ' rove_navigation' ,
93
- executable = ' green_person_tracker' ,
94
- name = ' green_person_tracker' ,
95
- output = ' screen' ,
109
+ package = " rove_navigation" ,
110
+ executable = " green_person_tracker" ,
111
+ name = " green_person_tracker" ,
112
+ output = " screen" ,
96
113
)
97
114
98
115
# Bridge ROS topics and Gazebo messages for establishing communication
99
116
bridge = Node (
100
- package = 'ros_gz_bridge' ,
101
- executable = 'parameter_bridge' ,
102
- parameters = [{
103
- 'config_file' : os .path .join (pkg_rove_description , 'config' ,
104
- 'default_bridge.yaml' ),
105
- 'qos_overrides./tf_static.publisher.durability' : 'transient_local' ,
106
- "use_sim_time" : True ,
107
- }],
108
- output = 'screen'
117
+ package = "ros_gz_bridge" ,
118
+ executable = "parameter_bridge" ,
119
+ parameters = [
120
+ {
121
+ "config_file" : os .path .join (
122
+ pkg_rove_description , "config" , "default_bridge.yaml"
123
+ ),
124
+ "qos_overrides./tf_static.publisher.durability" : "transient_local" ,
125
+ "use_sim_time" : True ,
126
+ }
127
+ ],
128
+ output = "screen" ,
109
129
)
110
130
111
131
common = IncludeLaunchDescription (
@@ -117,13 +137,43 @@ def generate_launch_description():
117
137
}.items (),
118
138
)
119
139
120
- return LaunchDescription ([
140
+ static_tf_ovis = Node (
141
+ package = "tf2_ros" ,
142
+ executable = "static_transform_publisher" ,
143
+ arguments = [
144
+ "0.25" ,
145
+ "0" ,
146
+ "0.25" ,
147
+ "0" ,
148
+ "0" ,
149
+ "3.14" ,
150
+ "base_link" ,
151
+ "ovis_base_link" ,
152
+ ],
153
+ )
154
+
155
+ ovis = IncludeLaunchDescription (
156
+ PythonLaunchDescriptionSource (
157
+ os .path .join (pkg_ovis , "launch" , "sim.launch.py" ),
158
+ ),
159
+ launch_arguments = {
160
+ "with_rove" : "true" ,
161
+ "with_joy" : "false" ,
162
+ "ovis_base_origin" : "0.25 0 0.25 0 0 3.14" ,
163
+ }.items (),
164
+ )
165
+
166
+ return LaunchDescription (
167
+ [
121
168
gz_sim ,
122
169
bridge ,
123
170
robot_state_publisher ,
124
171
spawn_walls ,
125
172
spawn_actor ,
126
173
spawn_rove ,
127
174
common ,
128
- human_tracker ,
129
- ])
175
+ # human_tracker,
176
+ ovis ,
177
+ static_tf_ovis ,
178
+ ]
179
+ )
0 commit comments