Class FloorMap

java.lang.Object
edu.tufts.hrilab.map.FloorMap

public class FloorMap extends Object
  • Constructor Details

    • FloorMap

      public FloorMap(Path jsonPath)
  • Method Details

    • getMapYamlFile

      public String getMapYamlFile()
      Get YAML filename used to load map data. Exposed here so that it can be sent to ROS to load a new map when switching floors.
      Returns:
    • setReferenceId

      public void setReferenceId(MapObject mo, Symbol refId)
      Assign the MapObject a unique referenceId that is unique across all maps.
      Parameters:
      mo -
      refId -
    • getFloorNumber

      public int getFloorNumber()
      Get floor number of this map.
      Returns:
    • getPixelMap

      public PixelMap getPixelMap()
      Get underlying pixel map.
      Returns:
    • getAllObjects

      public Set<MapObject> getAllObjects()
      gets a set of all known MapObjects
      Returns:
      set with every MapObject
    • getAllRooms

      public Set<MapObject> getAllRooms()
      gets a set of all known room MapObjects
      Returns:
      set with all room MapObject
    • getKnownPath

      public List<MapObject> getKnownPath(String pathName)
    • addKnownPath

      public void addKnownPath(String pathName, List<MapObject> path)
    • getMapObjectFromReferenceId

      public MapObject getMapObjectFromReferenceId(Symbol refID)
      converts a symbol refID to a mapobject
      Parameters:
      refID - symbol to get MapObject from
      Returns:
      MapObject represented by refID
    • getPortalFromRoomPose

      public javax.vecmath.Matrix4d getPortalFromRoomPose(MapObject portal, MapObject room, boolean facingPortal, double padding)
      gets the position and orientation facing towards/away portal p from room r padding meters away
      Parameters:
      portal - MapObject portal to face towards/away
      room - MapObject room to be in
      facingPortal - if true, face portal, else face away from portal
      padding - how far away from portal to be in meters
      Returns:
      pose representing looking at portal from room
    • getConnectingRooms

      public List<MapObject> getConnectingRooms(MapObject room)
      gets rooms accessible from a given room
      Parameters:
      room - MapObject of room to get neighbors of
      Returns:
      List of room MapObjects adjacent to the given room
    • getElevatorDoors

      public List<MapObject> getElevatorDoors(MapObject button)
      gets the elevator doors controlled by an elevator button
      Parameters:
      button - MapObject of the button to get doors of
      Returns:
      List of door MapObjects associated with the elevator button
    • getNearestElevatorButton

      public MapObject getNearestElevatorButton(javax.vecmath.Point3d p)
      gets the MapObject of the nearest elevator button to the location
      Parameters:
      p - Point in meter-space to query
      Returns:
      MapObject of nearest elevator button
    • markDoor

      public void markDoor(Symbol portal, boolean closed)
      Marks a portal between two rooms as either closed or open.
      Parameters:
      portal - referenceID of portal
      closed - boolean specifying if door is open or closed; true is closed, false is open
    • isDoorClosed

      public boolean isDoorClosed(MapObject roomA, MapObject roomB)
    • getAdjacentNodes

      public Set<MapObject> getAdjacentNodes(MapObject node)
    • getNearestPortal

      public MapObject getNearestPortal(javax.vecmath.Point3d p)
      getNearestPortal(): gets the MapObject of the portal nearest to the point
      Parameters:
      p - Point in meter-space to query
      Returns:
      Object color of nearest portal (can be door or elevator)
    • isPortal

      public boolean isPortal(javax.vecmath.Point3d p)
      queries if a point is a portal
      Parameters:
      p - Point in meter-space being query
      Returns:
      true if there is a portal at p, false otherwise
    • isPortal

      public boolean isPortal(MapObject mo)
      queries if a MapObject is a portal
      Parameters:
      mo - MapObject to check
      Returns:
      true if color is of a portal type, false otherwise
    • getPortalBetween

      public MapObject getPortalBetween(MapObject roomA, MapObject roomB)
      gets the color of the portal between two rooms
      Parameters:
      roomA - MapObject of the source room
      roomB - MapObject of the target room
      Returns:
      Color value of portal, returns -1 if no such portal exists
    • getRoomsFromPortal

      public com.google.common.graph.EndpointPair<MapObject> getRoomsFromPortal(MapObject portal)
      gets the colors of the rooms the portal connects
      Parameters:
      portal - MapObject of the portal to query
      Returns:
      Pair of room MapObjects
    • getMapObjectAt

      public MapObject getMapObjectAt(javax.vecmath.Point3d p)
      Gets the map object at a location in meters. Assumes query point is on current floor.
      Parameters:
      p - - Point in meters to get object of
      Returns:
      MapObject at p
    • getButtonFromDoor

      public MapObject getButtonFromDoor(MapObject door)
      gets the elevator button associated with the elevator-door TODO: can this be generalized?
      Parameters:
      door - the MapObject of the elevator door
      Returns:
      the MapObject of the elevator connected to provided door
    • getPanelInElevator

      public MapObject getPanelInElevator(MapObject elevator)
      gets the elevator panel in an elevator TODO: can this be generalized?
      Parameters:
      elevator - the MapObject for the elevator to look in
      Returns:
      a MapObject of the elevator panel