ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to use if else in python launch file?

asked 2022-11-17 01:44:05 -0500

Edvard gravatar image

updated 2022-11-17 02:18:43 -0500

Hi. Sorry for all mistakes, English is not my native language. I'm migrating my project to ROS2 Foxy. In my old launch file I have following lines of code:

  <arg name="config" default="$(eval 'cartographer_jetson.lua' if (target == 'jetson') else 'cartographer_host.lua')"/>
  <arg name="odom" default="$(eval '/rs_t265/odom/sample' if (target == 'jetson') else '/minicar/controller/odom')"/>

How those lines should look like in python launch file? I actually couldn't find documentation with examples that cover that situation, so if there are some documentation with detailed explanation of python launch file creation process I'll be would be very grateful for a link. Appreciate any help

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-11-17 03:01:53 -0500

ljaniec gravatar image

You are interested in these tutorials:

Especially usage of from launch.conditions import IfConditionfrom https://docs.ros.org/en/foxy/Tutorial...

edit flag offensive delete link more

Comments

1

Thank you for your help.

Edvard gravatar image Edvard  ( 2022-11-17 03:30:05 -0500 )edit

Please accept it as an answer, so it will have a chance to be moved to the StackExchange later :)

ljaniec gravatar image ljaniec  ( 2022-11-17 05:22:24 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-11-17 01:44:05 -0500

Seen: 230 times

Last updated: Nov 17 '22