-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
uwrt_mars_rover_drivetrain/uwrt_mars_rover_drivetrain_description/launch/gazebo.launch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import os | ||
from ament_index_python.packages import get_package_share_directory | ||
from launch import LaunchDescription | ||
from launch.actions import IncludeLaunchDescription | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
|
||
|
||
from launch_ros.actions import Node | ||
import xacro | ||
|
||
|
||
def generate_launch_description(): | ||
|
||
# Specify the name of the package and path to xacro file within the package | ||
pkg_name = 'uwrt_mars_rover_drivetrain_description' | ||
file_subpath = 'urdf/drivetrain.urdf.xacro' | ||
|
||
|
||
# Use xacro to process the file | ||
xacro_file = os.path.join(get_package_share_directory(pkg_name),file_subpath) | ||
robot_description_raw = xacro.process_file(xacro_file).toxml() | ||
|
||
|
||
# Configure the node | ||
node_robot_state_publisher = Node( | ||
package='robot_state_publisher', | ||
executable='robot_state_publisher', | ||
output='screen', | ||
parameters=[{'robot_description': robot_description_raw, | ||
'use_sim_time': True}] # add other parameters here if required | ||
) | ||
|
||
|
||
|
||
gazebo = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource([os.path.join( | ||
get_package_share_directory('gazebo_ros'), 'launch'), '/gazebo.launch.py']), | ||
) | ||
|
||
|
||
spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py', | ||
arguments=['-topic', 'robot_description', | ||
'-entity', 'my_bot'], | ||
output='screen') | ||
|
||
|
||
|
||
|
||
|
||
|
||
# Run the node | ||
return LaunchDescription([ | ||
gazebo, | ||
node_robot_state_publisher, | ||
spawn_entity | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters