open-rmf / rmf_traffic_editor

GUI, CLI, and ROS 2 messages for robot traffic flows in buildings
Apache License 2.0
139 stars 67 forks source link

Map image does not move #420

Open ClobotLucy opened 2 years ago

ClobotLucy commented 2 years ago

Bug report

Required information:

Description of the bug

Map image does not move. How do I move the image to the origin?

Screenshot from 2022-02-08 10-38-39

Changing the value of "flattened x offset(meters)" doesn't move the image.

Screenshot from 2022-02-08 10-38-59

Map image does not move to origin even in rviz. Screenshot from 2022-02-08 10-43-02

codebot commented 2 years ago

Thanks for filing the bug report. So that I can reproduce it easily, can you post the .building.yaml file and map image that shows this issue, or PM it to me? My email address is in my GitHub profile: https://github.com/codebot

Cheers! -Morgan

ClobotLucy commented 2 years ago

Thanks @codebot
Here is the link with the yaml(untech_office_door.building.yaml) and map(suntech_office.png) files.

https://github.com/CLOBOT-Co-Ltd/clober_ros2_sim/tree/foxy-devel/maps/suntech_office

codebot commented 2 years ago

Thanks for linking the repository. This looks like an interesting map!

There are a few reasons for the map behavior you're seeing, and a few ways to move forward.

The "Floorplan" image in this type of map is treated as the coordinate system. In other words, the upper-left pixel (0, 0) of the Floorplan image is treated as the origin of traffic-editor when it's running in reference_image mode, which was historically the default mode when creating new maps. The base image, which in this case is https://raw.githubusercontent.com/CLOBOT-Co-Ltd/clober_ros2_sim/foxy-devel/maps/suntech_office/suntech_office.png , cannot be moved, because it is assumed to be the reference frame for the entire map. Often, this floorplan image is a scan or rasterization of the architectural drawings of the building, and then the robot-generated LIDAR maps are placed on top of it. If you have a "known good" floorplan image of this building, I would suggest using that as the Floorplan image, and then positioning these robot-generated maps on top of it.

As an alternative, if you do not have an architectural-drawing floorplan image, and would like to be able to move around several robot-generated maps, you could simply use a blank image (or no image) for the (fixed) floorplan image, and only add robot-generated maps as Layers. Then you could translate/rotate the robot layers as you see fit.

As another alternative, if you build traffic-editor from source and create a new map, it now asks if you'd like to create a "geo-referenced" map when you create a new building. In that case, the fixed "floorplan images" are OpenStreetMap tiles, and all of the images you bring into the map, whether they are architectural drawings, robot maps, or anything else, are placed as layers, and all coordinates in that map are stored as latitude/longitude. There are a few caveats with this brand-new workflow, such as the need to specify a map projection, but it may be more flexible if you don't have a fixed architectural drawing to use as a reference image. Another caveat is that at time of writing, our tile server is only loaded with Singapore and Malaysia map data (I'm not sure which region you're in). We are currently bringing up a new tile server with the whole planet's data, but that will take a few more days.

Cheers!

ClobotLucy commented 2 years ago

@codebot Thank you for your kind explanation. As you explained, after adding the robot-generated(slam) map as a layer on top of the empty layout, I was able to move the coordinates. Screenshot from 2022-03-03 11-10-59

However, when running the rmf package, there is a problem that the map is not loaded. May I know what error it is? Screenshot from 2022-03-03 11-12-34

This is new.building.yaml file

coordinate_system: reference_image
crowd_sim:
  agent_groups:
    - {
        agents_name: [],
        agents_number: 0,
        group_id: 0,
        profile_selector: external_agent,
        state_selector: external_static,
        x: 0,
        y: 0,
      }
  agent_profiles:
    - {
        ORCA_tau: 1,
        ORCA_tauObst: 0.4,
        class: 1,
        max_accel: 0,
        max_angle_vel: 0,
        max_neighbors: 10,
        max_speed: 0,
        name: external_agent,
        neighbor_dist: 5,
        obstacle_set: 1,
        pref_speed: 0,
        r: 0.25,
      }
  enable: 0
  goal_sets: []
  model_types: []
  obstacle_set: { class: 1, file_name: floor_navmesh.nav, type: nav_mesh }
  states:
    - { final: 1, goal_set: -1, name: external_static, navmesh_file_name: "" }
  transitions: []
  update_time_step: 0.1
graphs: {}
levels:
  floor:
    elevation: 0
    flattened_x_offset: 0
    flattened_y_offset: 0
    floors:
      - parameters:
          {
            ceiling_scale: [3, 1],
            ceiling_texture: [1, blue_linoleum],
            indoor: [2, 0],
            texture_name: [1, blue_linoleum],
            texture_rotation: [3, 0],
            texture_scale: [3, 1],
          }
        vertices: [4, 1, 2, 3]
    lanes:
      - [
          15,
          16,
          {
            bidirectional: [4, true],
            demo_mock_floor_name: [1, ""],
            demo_mock_lift_name: [1, ""],
            graph_idx: [2, 0],
            orientation: [1, ""],
            speed_limit: [3, 0],
          },
        ]
      - [
          16,
          17,
          {
            bidirectional: [4, true],
            demo_mock_floor_name: [1, ""],
            demo_mock_lift_name: [1, ""],
            graph_idx: [2, 0],
            orientation: [1, ""],
            speed_limit: [3, 0],
          },
        ]
      - [
          17,
          18,
          {
            bidirectional: [4, true],
            demo_mock_floor_name: [1, ""],
            demo_mock_lift_name: [1, ""],
            graph_idx: [2, 0],
            orientation: [1, ""],
            speed_limit: [3, 0],
          },
        ]
      - [
          18,
          15,
          {
            bidirectional: [4, true],
            demo_mock_floor_name: [1, ""],
            demo_mock_lift_name: [1, ""],
            graph_idx: [2, 0],
            orientation: [1, ""],
            speed_limit: [3, 0],
          },
        ]
    layers:
      office:
        color: [1, 0, 0, 0.5]
        filename: suntech_office.png
        transform:
          scale: 0.05
          translation_x: -100
          translation_y: -100
          yaw: 0
        visible: true
    measurements:
      - [19, 20, { distance: [3, 22] }]
    vertices:
      - [-97.488, -336.088, 0, ""]
      - [-100.981, 92.711, 0, ""]
      - [335.677, 92.711, 0, ""]
      - [334.804, -329.101, 0, ""]
      - [-95.864, -334.42, 0, ""]
      - [101.749, -38.884, 0, ""]
      - [103.893, 94.063, 0, ""]
      - [336.909, -64.616, 0, ""]
      - [215.398, -61.757, 0, ""]
      - [193.24, -61.042, 0, ""]
      - [102.464, -64.616, 0, ""]
      - [101.749, -136.808, 0, ""]
      - [287.59, -133.949, 0, ""]
      - [305.459, -133.949, 0, ""]
      - [334.765, -133.234, 0, ""]
      - [57.124, 47.135, 0, ""]
      - [57.34, -47.101, 0, ""]
      - [-44.097, -45.775, 0, ""]
      - [-44.097, 44.391, 0, ""]
      - [-99.30200000000001, 110.69, 0, ""]
      - [337.672, 110.69, 0, ""]
    walls:
      - [
          0,
          1,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
      - [
          1,
          2,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
      - [
          2,
          3,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
      - [
          3,
          4,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
      - [
          5,
          6,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
      - [
          7,
          8,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
      - [
          9,
          10,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
      - [
          10,
          11,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
      - [
          11,
          12,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
      - [
          13,
          14,
          {
            alpha: [3, 1],
            texture_height: [3, 2.5],
            texture_name: [1, default],
            texture_scale: [3, 1],
            texture_width: [3, 1],
          },
        ]
    x_meters: 10.06924897133468
    y_meters: 10.06924897133468
lifts: {}
name: new

Thank you!