it’s just a matter of understanding of ROS2 launch files work and you can build your own
First of all thanks for answering me, and yes and this is the part where I struggle. I tried to convert and adapt the posix_sitl.launch
file.
To begin I used https://github.com/aws-robotics/ros2-launch-file-migrator which allows me to convert a ROS .xml launch file into a ROS2 .py launch file.
But this errors occurs :
launch.invalid_launch_file_error.InvalidLaunchFileError: Caught exception when trying to load file of format [py]: "package 'mavlink_sitl_gazebo' not found, searching: ['/opt/ros/foxy']
It just can’t find the mavlink_sitl_gazebo
package in /opt/ros/foxy
when it try to find the empty.world
file. It’s not a big error and I can “bypass” it by just not providing a world file.
But I have the same issue when I want to launch the px4 package as a ROS2 Node (I don’t know if “launch a package as a ROS2 Node” is a correct term), I think this is where the problem stands (in my comprehension of ROS2 launch file). Here is the code where I launch it (I only put what I think is necessary) :
launch_ros.actions.Node(
package='px4',
executable='px4',
name='sitl',
output='screen',
on_exit=launch.actions.Shutdown()
),
But the same errors occurs :
ament_index_python.packages.PackageNotFoundError: "package 'px4' not found, searching: ['/opt/ros/foxy']"
So I thought about some ways to solve this issues :
- locate where the package is and the path to the correct environment variable. But I didn’t understand where this package is stored and which variable should I modify ( is it
$AMENT_PREFIX_PATH
or $AMENT_CURRENT_PREFIX
?)
- maybe px4 isn’t compile as a ROS2 package and it didn’t find it (yeah still the same understanding problem that I have on ROS2 package)
Ultimately what I would like to do with my ROS2 launch file is :
- Launch a gazebo
- Spawn a drone (typhoon_h480)
- Launch PX4 so i can communicate with it and command it with QGroundControl
- Launch my own ROS2 image processing node
So here it is a bit more in depth of my problem thanks you for reading me, hope it wasn’t too boring, and thanks you in advance for your answer!