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

Nested eval in ROS2 XML launch file

asked 2020-11-25 12:36:01 -0500

nnmm gravatar image

updated 2020-11-25 14:53:23 -0500

gvdhoorn gravatar image

I am trying to find out if it's possible to load a parameter file in an XML launch file, where the path is computed from an arg. This requires nested (or chained) evals:

  • The arg has the name of a robot
  • Adding a suffix to that gives the name of the package that has the parameter file
  • Then we need to call find-pkg-share
  • And add another string to get the full file path

Is this possible? What would go into <param from="...">?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-12-16 05:25:21 -0500

nnmm gravatar image

I still don't know how to do nested evals, but this particular problem can be solved without eval, e.g.:

<arg name="robot_name" />
<let name="param_file" value="$(find-pkg-share $(var robot_name)_description)/config/robot_params.yaml "/>
<param from="$(var param_file)" />
edit flag offensive delete link more
0

answered 2023-07-26 03:48:12 -0500

A possible way to define nested parameters in launch.xml is the following one:

<launch>

  <arg name="robot_id" default="$(env ROBOT_ID 'unnamed_robot')"/>



  <node pkg="vineslam_ros" exec="slam_node"
      name="slam_node"
      namespace="$(var robot_id)">

    <remap from="/odom_topic" to ="odom"/>
    <remap from="/scan_topic" to ="scan"/>



    <param name="world_frame_id" value="$(var robot_id)/map"/>
    <param name="odom_frame_id" value="$(var robot_id)/odom"/>
    <param name="base_frame_id" value="$(var robot_id)/base_footprint"/>
    <param name="lidar_sensor_frame" value="$(var robot_id)/rslidar"/>

    <param name="use_semantic_features" value="False"/>
    <param name="use_lidar_features" value="True"/>
    <param name="use_vertical_planes" value="False"/>
    <param name="use_ground_plane" value="False"/>
    <param name="use_imu" value="False"/>
    <param name="use_gyroscope" value="False"/>
    <param name="use_gps" value="False"/>
    <param name="use_gps_altitude" value="False"/>
    <param name="use_gps_heading" value="False"/>

    <param name="publish_level" value="2"/>

    <param name="robot_dimensions">
      <param name="x" value="0.42"/>
      <param name="y" value="0.32"/>
      <param name="z" value="0.37"/>
    </param>

    <param name="multilayer_mapping">

      <param name="datum">
        <param name="latitude" value="45.706199"/>
        <param name="longitude" value="7.2495435"/>
        <param name="altitude" value="668.63"/>
      </param>

      <param name="topological_map">
        <param name="autogen_topological_map" value="True"/>
        <param name="folder" value="/home/sousarbarb/.ros/vineslam/"/>

        <param name="dimensions">
          <param name="x" value="100.0"/>
          <param name="y" value="100.0"/>
          <param name="square_size" value="20.0"/>
        </param>
      </param>

      <param name="grid_map">
        <param name="origin">
          <param name="z" value="0.0"/>
        </param>

        <param name="height" value="30.0"/>
        <param name="resolution" value="0.25"/>
      </param>

    </param>

    <param name="pf">
      <param name="n_particles" value="300"/>
      <param name="sigma_xx" value="0.3"/>
      <param name="sigma_yy" value="0.3"/>
      <param name="sigma_zz" value="0.2"/>
      <param name="sigma_RR" value="0.1"/>
      <param name="sigma_PP" value="0.1"/>
      <param name="sigma_YY" value="0.2"/>
    </param>

  </node>

</launch>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-11-25 12:36:01 -0500

Seen: 328 times

Last updated: Jul 26 '23