Please tell me the meaning of the description in the launch file
I couldn't understand the meaning of the following description(value) in the launch file. I couldn't understand a description that combines eval, if and else.
<arg name="uf_traj_controller" value="$(eval 'lite6_traj_controller_velocity' if arg('velocity_control') else 'lite6_traj_controller')" />
Please tell me the meaning of description of value.
A part of launch file
<launch>
<arg name="run_demo_traj" default="false"/>
<arg name="effort_control" default="false"/>
<arg name="velocity_control" default="false"/>
<arg name="namespace" default="ufactory"/>
<arg name="add_gripper" default="false" />
<!-- Load joint controller configurations from YAML file to parameter server -->
<!-- Load trajectory controller for xArm by default -->
<rosparam unless="$(arg run_demo_traj)" file="$(find xarm_controller)/config/lite6_traj_controller.yaml" command="load" ns="$(arg namespace)"/>
<arg name="uf_traj_controller" value="$(eval 'lite6_traj_controller_velocity' if arg('velocity_control') else 'lite6_traj_controller')" />
<node unless="$(arg run_demo_traj)"
name="traj_controller_spawner"
pkg="controller_manager"
type="controller_manager"
respawn="false"
output="screen"
ns="/$(arg namespace)"
args="spawn $(arg uf_traj_controller) joint_state_controller"/>
<!-- run_demo: load the position controllers -->
<rosparam if="$(arg run_demo_traj)"
file="$(find xarm_controller)/config/lite6_position_controllers.yaml" command="load" ns="$(arg namespace)"/>
<node if="$(arg run_demo_traj)" name="position_controller_spawner"
pkg="controller_manager"
type="spawner"
respawn="false"
output="screen"
ns="/$(arg namespace)"
args="joint1_position_controller joint2_position_controller
joint3_position_controller joint4_position_controller
joint5_position_controller joint6_position_controller
joint_state_controller"/>
</launch>
I didn't test it, but I do not think this reads the variable. I'd have written it:
$(arg velocity_control)
Update: nope, looks like I'm wrong. According to https://wiki.ros.org/roslaunch/XML inside an eval the syntax is different, so this will work.