Skip to content

Uninitialize variable causes NaN in PathAlignCritic #3939

@LeifHookedWireless

Description

@LeifHookedWireless

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04 -->
  • ROS2 Version:
  • Version or commit hash:
  • DDS implementation:
    • Cyclone DDS -->

Steps to reproduce issue

cost is created as an uninitialized tensor.

  auto && cost = xt::xtensor<float, 1>::from_shape({data.costs.shape(0)});

Some values are filled in, but some are not.

    if (num_samples > 0) {
      cost[t] = summed_path_dist / num_samples;
    }

Some of the garbage values will be NaN.

Expected behavior

Critic scoring should not generate NaN.

Actual behavior

Additional information

I believe the old version filled in 0.0 in this case, but I suspect a large non-zero value makes more sense.
Tell me what the uninitialized value should be and I'll make a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions