Giter VIP home page Giter VIP logo

Comments (3)

skohlbr avatar skohlbr commented on May 15, 2024

Ok, so I managed to make it work using

  for (grid_map::GridMapIterator iterator(static_cut); !iterator.isPastEnd(); ++iterator) {
      const grid_map::Index index(*iterator);

      grid_map::Position position;
      static_cut.getPosition(index, position);

      grid_map::Index elev_index;
      local_elevation_map_.getIndex(position, elev_index);

        if ( std::abs( robot_elevation - elev_data(elev_index(0), elev_index(1)) ) > 0.38 ){
          static_cut_data(index(0), index(1)) = 100.0;
        }
  }

I'd still be interested in a more elegant/efficient way of doing this however.

from grid_map.

pfankhauser avatar pfankhauser commented on May 15, 2024

Assuming you have the static and the local maps with following layers

GridMap static_map_({"occupancy"});
GridMap local_elevation_map_({"elevation", "occupancy"});

with different positions, sizes, and resolutions (hence, the grids are not aligned). Instead of the for-loop, you can achieve the same directly with:

local_elevation_map_["occupancy"] = ((local_elevation_map_["elevation"].array() - robot_elevation).abs() > 0.38).cast<float>() * 100.0;
static_map_.addDataFrom(local_elevation_map_, true, true, false, {"occupancy"});

Good point about the documentation, I added a comment in e93d7aa. Thanks!

from grid_map.

skohlbr avatar skohlbr commented on May 15, 2024

Thanks for the quick answer, that indeed looks a good bit more elegant and efficient :)

from grid_map.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.