Skip to content

Commit

Permalink
updated launch files to not use rviz
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthbhurat4 committed Dec 1, 2023
1 parent 0da77cf commit 37511b2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
44 changes: 22 additions & 22 deletions src/basic_mobile_robot/launch/basic_mobile_bot_v1.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ def generate_launch_description():
default_launch_dir = os.path.join(pkg_share, 'launch')
default_model_path = os.path.join(pkg_share, 'models/basic_mobile_bot_v1.urdf')
robot_name_in_urdf = 'basic_mobile_bot'
default_rviz_config_path = os.path.join(pkg_share, 'rviz/urdf_config.rviz')
# default_rviz_config_path = os.path.join(pkg_share, 'rviz/urdf_config.rviz')

# Launch configuration variables specific to simulation
gui = LaunchConfiguration('gui')
model = LaunchConfiguration('model')
rviz_config_file = LaunchConfiguration('rviz_config_file')
# rviz_config_file = LaunchConfiguration('rviz_config_file')
use_robot_state_pub = LaunchConfiguration('use_robot_state_pub')
use_rviz = LaunchConfiguration('use_rviz')
# use_rviz = LaunchConfiguration('use_rviz')
use_sim_time = LaunchConfiguration('use_sim_time')

# Declare the launch arguments
Expand All @@ -29,10 +29,10 @@ def generate_launch_description():
default_value=default_model_path,
description='Absolute path to robot urdf file')

declare_rviz_config_file_cmd = DeclareLaunchArgument(
name='rviz_config_file',
default_value=default_rviz_config_path,
description='Full path to the RVIZ config file to use')
# declare_rviz_config_file_cmd = DeclareLaunchArgument(
# name='rviz_config_file',
# default_value=default_rviz_config_path,
# description='Full path to the RVIZ config file to use')

declare_use_joint_state_publisher_cmd = DeclareLaunchArgument(
name='gui',
Expand All @@ -44,10 +44,10 @@ def generate_launch_description():
default_value='True',
description='Whether to start the robot state publisher')

declare_use_rviz_cmd = DeclareLaunchArgument(
name='use_rviz',
default_value='True',
description='Whether to start RVIZ')
# declare_use_rviz_cmd = DeclareLaunchArgument(
# name='use_rviz',
# default_value='True',
# description='Whether to start RVIZ')

declare_use_sim_time_cmd = DeclareLaunchArgument(
name='use_sim_time',
Expand Down Expand Up @@ -79,30 +79,30 @@ def generate_launch_description():
'robot_description': Command(['xacro ', model])}],
arguments=[default_model_path])

# Launch RViz
start_rviz_cmd = Node(
condition=IfCondition(use_rviz),
package='rviz2',
executable='rviz2',
name='rviz2',
output='screen',
arguments=['-d', rviz_config_file])
# # Launch RViz
# start_rviz_cmd = Node(
# condition=IfCondition(use_rviz),
# package='rviz2',
# executable='rviz2',
# name='rviz2',
# output='screen',
# arguments=['-d', rviz_config_file])

# Create the launch description and populate
ld = LaunchDescription()

# Declare the launch options
ld.add_action(declare_model_path_cmd)
ld.add_action(declare_rviz_config_file_cmd)
# ld.add_action(declare_rviz_config_file_cmd)
ld.add_action(declare_use_joint_state_publisher_cmd)
ld.add_action(declare_use_robot_state_pub_cmd)
ld.add_action(declare_use_rviz_cmd)
# ld.add_action(declare_use_rviz_cmd)
ld.add_action(declare_use_sim_time_cmd)

# Add any actions
ld.add_action(start_joint_state_publisher_cmd)
ld.add_action(start_joint_state_publisher_gui_node)
ld.add_action(start_robot_state_publisher_cmd)
ld.add_action(start_rviz_cmd)
# ld.add_action(start_rviz_cmd)

return ld
42 changes: 21 additions & 21 deletions src/basic_mobile_robot/launch/basic_mobile_bot_v2.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ def generate_launch_description():
default_launch_dir = os.path.join(pkg_share, 'launch')
default_model_path = os.path.join(pkg_share, 'models/basic_mobile_bot_v1.urdf')
robot_name_in_urdf = 'basic_mobile_bot'
default_rviz_config_path = os.path.join(pkg_share, 'rviz/urdf_config.rviz')
# default_rviz_config_path = os.path.join(pkg_share, 'rviz/urdf_config.rviz')
world_file_name = 'basic_mobile_bot_world/town.world'
world_path = os.path.join(pkg_share, 'worlds', world_file_name)

# Launch configuration variables specific to simulation
headless = LaunchConfiguration('headless')
model = LaunchConfiguration('model')
rviz_config_file = LaunchConfiguration('rviz_config_file')
# rviz_config_file = LaunchConfiguration('rviz_config_file')
use_robot_state_pub = LaunchConfiguration('use_robot_state_pub')
use_rviz = LaunchConfiguration('use_rviz')
# use_rviz = LaunchConfiguration('use_rviz')
use_sim_time = LaunchConfiguration('use_sim_time')
use_simulator = LaunchConfiguration('use_simulator')
world = LaunchConfiguration('world')
Expand All @@ -35,10 +35,10 @@ def generate_launch_description():
default_value=default_model_path,
description='Absolute path to robot urdf file')

declare_rviz_config_file_cmd = DeclareLaunchArgument(
name='rviz_config_file',
default_value=default_rviz_config_path,
description='Full path to the RVIZ config file to use')
# declare_rviz_config_file_cmd = DeclareLaunchArgument(
# name='rviz_config_file',
# default_value=default_rviz_config_path,
# description='Full path to the RVIZ config file to use')

declare_simulator_cmd = DeclareLaunchArgument(
name='headless',
Expand All @@ -50,10 +50,10 @@ def generate_launch_description():
default_value='True',
description='Whether to start the robot state publisher')

declare_use_rviz_cmd = DeclareLaunchArgument(
name='use_rviz',
default_value='True',
description='Whether to start RVIZ')
# declare_use_rviz_cmd = DeclareLaunchArgument(
# name='use_rviz',
# default_value='True',
# description='Whether to start RVIZ')

declare_use_sim_time_cmd = DeclareLaunchArgument(
name='use_sim_time',
Expand Down Expand Up @@ -93,23 +93,23 @@ def generate_launch_description():
arguments=[default_model_path])

# Launch RViz
start_rviz_cmd = Node(
condition=IfCondition(use_rviz),
package='rviz2',
executable='rviz2',
name='rviz2',
output='screen',
arguments=['-d', rviz_config_file])
# start_rviz_cmd = Node(
# condition=IfCondition(use_rviz),
# package='rviz2',
# executable='rviz2',
# name='rviz2',
# output='screen',
# arguments=['-d', rviz_config_file])

# Create the launch description and populate
ld = LaunchDescription()

# Declare the launch options
ld.add_action(declare_model_path_cmd)
ld.add_action(declare_rviz_config_file_cmd)
# ld.add_action(declare_rviz_config_file_cmd)
ld.add_action(declare_simulator_cmd)
ld.add_action(declare_use_robot_state_pub_cmd)
ld.add_action(declare_use_rviz_cmd)
# ld.add_action(declare_use_rviz_cmd)
ld.add_action(declare_use_sim_time_cmd)
ld.add_action(declare_use_simulator_cmd)
ld.add_action(declare_world_cmd)
Expand All @@ -118,6 +118,6 @@ def generate_launch_description():
ld.add_action(start_gazebo_server_cmd)
ld.add_action(start_gazebo_client_cmd)
ld.add_action(start_robot_state_publisher_cmd)
ld.add_action(start_rviz_cmd)
# ld.add_action(start_rviz_cmd)

return ld

0 comments on commit 37511b2

Please sign in to comment.