Description
branch: jazzy
When attempting to spawn multiple WAM-V models simultaneously in the VRX Gazebo simulation, the robot_state_publisher node fails to work correctly for the second robot. I've identified that the issue stems from hardcoded paths and naming conventions at line ~372 in vrx_gz/src/vrx_gz/launch.py.
Current Implementation (Line ~372)
# robot_state_publisher (tf for wamv)
model_dir = os.path.join(get_package_share_directory('vrx_gazebo'), 'models/wamv/tmp')
urdf_file = os.path.join(model_dir, 'model.urdf')
with open(urdf_file, 'r') as infp:
robot_desc = infp.read()
params = {'use_sim_time': use_sim_time, 'frame_prefix': 'wamv/', 'robot_description': robot_desc}
nodes.append(Node(package='robot_state_publisher',
executable='robot_state_publisher',
output='both',
parameters=[params],
remappings=[('/joint_states', '/wamv/joint_states')]))
Problems Identified
- Hardcoded model path: The path
models/wamv/tmp is hardcoded, preventing the use of other robot models or custom model names
- Inconsistent naming:
frame_prefix and remapping topics are hardcoded to wamv/ instead of using the model.model_name variable
Proposed Fix
# robot_state_publisher (tf for wamv)
model_dir = os.path.join(get_package_share_directory('vrx_gazebo'), 'models/' + model.model_name + '/tmp')
urdf_file = os.path.join(model_dir, 'model.urdf')
with open(urdf_file, 'r') as infp:
robot_desc = infp.read()
params = {'use_sim_time': use_sim_time, 'frame_prefix': model.model_name + '/', 'robot_description': robot_desc}
nodes.append(Node(package='robot_state_publisher',
executable='robot_state_publisher',
output='both',
parameters=[params],
remappings=[('/joint_states', '/' + model.model_name + '/joint_states')]))
Description
branch: jazzy
When attempting to spawn multiple WAM-V models simultaneously in the VRX Gazebo simulation, the
robot_state_publishernode fails to work correctly for the second robot. I've identified that the issue stems from hardcoded paths and naming conventions at line ~372 in vrx_gz/src/vrx_gz/launch.py.Current Implementation (Line ~372)
Problems Identified
models/wamv/tmpis hardcoded, preventing the use of other robot models or custom model namesframe_prefixand remapping topics are hardcoded towamv/instead of using themodel.model_namevariableProposed Fix