xacro prase the value from YAML by giving variable
Environment: ROS Noetic, Gazebo11
I try to use xacro with YAML, but there is a problem about argument of variable:
My yaml:
---
color_0: "1 1 1 1.0"
color_1: "0 0 0 1.0"
color_2: "0.84 0 0 1.0"
color_3: "0.55 0.24 1 1.0"
color_4: "0.01 0.53 0 1.0"
Because I want to use different value at different time.
So I tried to load the value as below:
<xacro:property name="YAML_FILE" value="$(find gazebo_ros_model_color)/configs/colors.yaml" />
<xacro:property name="COLORS" value="${load_yaml(YAML_FILE)}"/>
<xacro:arg name="color" default="color_0" /> <!-- need to use variable -->
<color>${COLORS[${color}]}</color>
But it cause the ERROR :((
...
invalid expression: ${color
when evaluating expression 'COLORS['${color'
...
Is it possible to get the value from YAML by key variable given?
Any suggestion is welcome
Thank you