My first experience with ROS was implementing motor and sensor nodes in Kinetic for the Raspberry Pi/GoPiGo3 robot a couple years ago.
I finished all the ROS2 tutorials successfully, so this month I decided to strengthen my weak ROS2 skills by migrating the examples in the ROS (Kinetic/Melodic) book "Hands-On ROS for Robotics Programming" to ROS2 Foxy.
Chapter 3 ROS Basics (topic pub/sub) went quite smooth, only a few changes from the pub/sub ROS2 tutorial.
Chapter 4 Rviiz Basics (urdf, launch files, launch arguments, parameters, joint_state_publisher(_gui), and rviz2) has made me think ROS2 might just be over the "bleeding edge" at this point.
The roughly 10 line launch.xml became a 58 line mess that can't handle arguments or parameters easily
joint_state_publisher in the xml launch took a parameter /use_gui and apparently now needs two launch files - one for no gui, and a second for with gui (joint_state_publisher_gui)
I found a very applicable example that used a launch condition feature but apparently that got deprecated already.
ROS1 launch could pass in the urdf file name, but in ROS2 I have to read the file and I can't figure out how to read the file if the name comes in a launch argument - at least not with the patterns I learned in the ROS2 launch and ROS2 URDF tutorials.
I tried the ros2-launch-file-migrator but it just put None for the robot_description and the use_gui arg
Is ROS2 launch going to settle and be easier in a year or so?
Is it too soon to be migrating (as a way to really learn ROS2)?
For reference - this is the launch.xml file I have been working with:
<launch>
<!-- values passed by command line input -->
<arg name="model" default="gopigoMinimal" />
<arg name="gui" default="False" />
<!-- set these parameters on Parameter Server -->
<param name="robot_description" textfile="$(find rviz_basics)/urdf/$(arg model).urdf" />
<!-- Start 3 nodes: joint_state_publisher, robot_state_publisher and rviz -->
<!-- Send joint values -->
<node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher">
<param name="/use_gui" value="$(arg gui)"/>
</node>
<!-- Combine joint values to TF-->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/>
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find rviz_basics)/rviz/$(arg model).rviz" required="true" />
<!-- (required = "true") if rviz dies, entire roslaunch will be killed -->
</launch>
This is what I have come up with: https://github.com/slowrunner/handsonros2/tree/main/src/chap4_rviz_basics/launch
Originally posted by RobotDreams on ROS Answers with karma: 327 on 2021-07-07
Post score: 3
Original comments
Comment by djchopp on 2021-07-09:
Do you have a source for the comment about launch conditions being deprecated? I do not see any deprecation warnings when using conditions. Thanks
Comment by kscottz on 2021-07-09:
FWIW I've heard repeated requests for improved documentation for ROS 2 launch files. I'll see what we can do to improve the situation.
Comment by RobotDreams on 2021-07-10:
This is the comment that I was referring to:
https://answers.ros.org/question/322636/ros2-access-current-launchconfiguration/#:~:text=This%20is%20not,Mar%2023%20%2721%20)
I misunderstood this to be broader than intended.