Foundations of Spatial Perception for Robotics: Hierarchical Representations and Real-time Systems