Skip to content

map_saver saves hard-coded values for free and occupied thresholds #466

Closed

Description

@mkhansenbot

Bug report

The code in the ROS navigation map_saver currently saves hard-coded values for free threshold and occupied threshold. This essentially ignores what was passed in on the command line.

Activity

  1. added this to the D Turtle Release milestone on Dec 10, 2018
  2. added
    bug
    on Dec 13, 2018
  3. mkhansenbot commented on Dec 13, 2018

    @mkhansenbot
    CollaboratorAuthor

    As part of this bug fix, we should determine whether the threshold values should be parameters or arguments as they are today.

  4. ghost added
    3 - Low
    on Jan 22, 2019
  5. ghost removed this from the D Turtle Release milestone on Jan 29, 2019
  6. rotu commented on Jul 23, 2019

    @rotu
    Contributor

    Additionally, I would like to get rid of thresholds altogether and store the actual OccupancyGrid values. That way I can do my own tracing and/or cleanup on the images from SLAM.

  7. mkhansenbot commented on Jul 23, 2019

    @mkhansenbot
    CollaboratorAuthor

    @rotu - would support for SCALE and RAW modes meet your needs (as defined in map_loader.hpp)

    /** Map mode
     *  Default: TRINARY -
     *      value >= occ_th - Occupied (100)
     *      value <= free_th - Free (0)
     *      otherwise - Unknown
     *  SCALE -
     *      alpha < 1.0 - Unknown
     *      value >= occ_th - Occupied (100)
     *      value <= free_th - Free (0)
     *      otherwise - f( (free_th, occ_th) ) = (0, 100)
     *          (linearly map in between values to (0,100)
     *  RAW -
     *      value = value
     */
    

    This means you could run map_saver --mode RAW to do what you're asking

  8. rotu commented on Jul 24, 2019

    @rotu
    Contributor

    @mkhansen-intel I think so. I'm working on the PR right now, actually.

  9. rotu commented on Jul 24, 2019

    @rotu
    Contributor

    @mkhansen-intel Here's where I am:
    https://github.com/ros-planning/navigation2/blob/a2074b639a10e60c6a48116d7565e01782e01b40/nav2_map_server/src/map_saver.cpp

    It doesn't totally work yet. One of the problems is I can't figure out how to get SDL (image library used in map loader) to write any image format other than bmp (including pgm).

    Here's what I'm thinking as far as options:

    1. Keep using pgm. Admit that we can't use SCALE mode because pgm has no alpha channel.
    2. Accept BMP as our new writing format and use SDL image library for writing.
    3. use a different library: CImg: lightweight image library but weird license, ImageMagick: fully functional weird license, OpenCV2: heavy library but already used in ROS2 stack
    4. port this node over to Python and use Pillow

    Advice?

  10. ghost removed
    3 - Low
    on Jul 24, 2019
  11. ghost added
    1 - High
    on Jul 24, 2019
  12. ghost added this to the Aug 2019 milestone on Jul 24, 2019
  13. SteveMacenski commented on Jul 24, 2019

    @SteveMacenski
    Member

    I would say change libraries over change file types, that way people like a long history of maps don't have a heart attack and we don't have to provide any conversion tools. I don't know that anyone has any love for a particular image IO library.

    Also wanted to say that I love the save/stop by occupancy value, I think there's only 1 or 2 SLAM options that could make total use of it but that's a great direction to start pushing.

    ... can't use SCALE

    I can tell you in map server ROS1, that scale definitely works. I have used it for... things in the past. With that said, if changing libraries makes your life easier, power to you.

    Python would not be great - I think this is a particular node that is a good candidate for python but by in large python in production is something to be avoided.

  14. rotu commented on Jul 25, 2019

    @rotu
    Contributor

    Thanks, @SteveMacenski, for the feedback.

    I would say change libraries over change file types ... I don't know that anyone has any love for a particular image IO library.

    Sounds good to me. I'm going with ImageMagick GraphicsMagick.

    Also wanted to say that I love the save/stop by occupancy value

    I don't understand what you mean. Rephrase?

    I can tell you in map server ROS1, that scale definitely works.

    Scale works for map_server but not map_saver. It relies on having a separate alpha channel, and PGM has just one value for pixel (correct me if I've missed something). You can use PNG with an alpha channel, but the problem is that while the SDL library can read such files, it cannot write them.

  15. SteveMacenski commented on Jul 25, 2019

    @SteveMacenski
    Member

    Sorry, rephrase is:

    thanks for doing this, I agree

    Ah, you are right. I modify maps with my own toolset not through map saver.

  16. rotu commented on Jul 25, 2019

    @rotu
    Contributor

    Development is coming along at a healthy clip:
    RoverRobotics-forks@3d73823

  17. SteveMacenski commented on Sep 4, 2019

    @SteveMacenski
    Member

    @rotu's PR resolves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

1 - Highbug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions