I am trying to launch my urdf file in Webots but somehow it launches the default robot from the ROS2 Simulators tutorial. I edited the robot_launch.py according to the changes in the tutorial but somehow it doesn't launch my own urdf file.
My package has been set up like below. The build succeeds but it launches the default robot.
.
├── install
│ ├── COLCON_IGNORE
│ ├── local_setup.bash
│ ├── local_setup.ps1
│ ├── local_setup.sh
│ ├── _local_setup_util_ps1.py
│ ├── _local_setup_util_sh.py
│ ├── local_setup.zsh
│ ├── my_package
│ ├── setup.bash
│ ├── setup.ps1
│ ├── setup.sh
│ └── setup.zsh
├── launch
│ └── robot_launch.py
├── LICENSE
├── log
│ ├── build_2024-06-18_13-00-47
│ ├── build_2024-06-18_13-14-16
│ ├── build_2024-06-18_13-16-46
│ ├── build_2024-06-18_13-18-39
│ ├── build_2024-06-19_08-48-34
│ ├── build_2024-06-19_08-59-00
│ ├── build_2024-06-19_09-04-20
│ ├── build_2024-06-19_09-09-09
│ ├── COLCON_IGNORE
│ ├── latest -> latest_build
│ └── latest_build -> build_2024-06-19_09-09-09
├── meshes
│ ├── l_finger_color.png
│ ├── l_finger.dae
│ ├── l_finger_tip_color.png
│ └── l_finger_tip.dae
├── my_package
│ ├── __init__.py
│ └── my_robot_driver.py
├── package.xml
├── resource
│ ├── mp_robot_new.urdf
│ └── my_package
├── setup.cfg
├── setup.py
├── test
│ ├── test_copyright.py
│ ├── test_flake8.py
│ └── test_pep257.py
└── worlds
└── my_world.wbt
robot_launch.py looks like this
import os
import launch
from launch import LaunchDescription
from ament_index_python.packages import get_package_share_directory
from webots_ros2_driver.webots_launcher import WebotsLauncher
from webots_ros2_driver.webots_controller import WebotsController
def generate_launch_description():
package_dir = get_package_share_directory('my_package')
robot_description_path = os.path.join(package_dir, 'resource', 'mp_robot_new.urdf')
webots = WebotsLauncher(
world=os.path.join(package_dir, 'worlds', 'my_world.wbt')
)
my_robot_driver = WebotsController(
robot_name="myfirst",
parameters=[
{'robot_description': robot_description_path},
]
)
return LaunchDescription([
webots,
my_robot_driver,
launch.actions.RegisterEventHandler(
event_handler=launch.event_handlers.OnProcessExit(
target_action=webots,
on_exit=[launch.actions.EmitEvent(event=launch.events.Shutdown())],
)
)
])
In Ros humble simulators tutorial, it is said that the world file already includes a default robot, then how can i launch my own urdf in this robot_launch.py ?