Code Monkey home page Code Monkey logo

Comments (7)

zkytony avatar zkytony commented on July 19, 2024

Thanks for the question! I am glad you are trying this with RoboThor. I didn't consider running RoboThor scenes with this system - the walls were definitely one concern. But I think with some adjustment with the sensor model, the system (especially the object search planning algorithm) can still be applied.

Specifically, you need to develop a sensor model that can take into account occlusion by the walls. To help with this, thortils has a function in grid_map.py called blocked that returns whether two locations on the map are blocked by an obstacle. You can look at sensors.py for implementation of the fan-shape sensor. You may want to modify the in_range function to consider obstacles.

In an early phase of this project, I implemented a grid map with walls and a sensor model that take that into account, where the agent doesn't begin with the environment map and needs to explore the environment while searching for the target object. In this example, the agent tries to search for a SaltShaker by first searching for the Kitchen and use spatial correlation to reduce uncertainty about the SaltShaker's location.

img

The grid map representation here is a little different (the walls are edges, instead of obstacles). I am pasting the within_range function used in the sensor model there (same purpose as "in_range"). This may help. (This is definitely not the only, or the most efficient way to consider occlusion by fan-shaped sensor models, so you may totally come up with your own way!)

    def within_range(self, robot_pose, point,
                     grid_map=None, cache=None,
                     walls_to_consider=None,
                     return_intersecting_wall=False):
        """Returns true if the point is within range of the sensor (i.e. visible).
        To do this need to check if any wall is closer to the robot along the
        direction of the beam from robot to the `point`.x
        Args:
            robot_pose (tuple): (x,y,theta) pose of the robot
            point (tuple): (x,y) point to determine if in range
            grid_map (GridMap): The grid map whose walls can cause occlusions
            cache (SensorCache): The cache that helps computing this faster
            return_intersecting_wall (bool): True if want to return the wall that
                is intersecting the sensor beam. NOTE: This parameter affects what
                the cache stores. If True, then the cache will also store the intersecting
                wall for this (robot_pose, point) pair."""
        if cache is not None and grid_map is not None:
            if not cache.serving(grid_map):
                raise ValueError("Cache is already used to serve for map %s" % cache.map_serving)

        if cache is not None:
            assert cache.sensor_name == self.name
            result = cache.get(robot_pose, point)
            if result is not None:
                detectable, intersecting_wall = result
                if return_intersecting_wall:
                    return detectable, intersecting_wall
                else:
                    return detectable

        detectable = True
        intersecting_wall = None

        if robot_pose[:2] != point:
            point_dist, point_bearing = self.shoot_beam(robot_pose, point)
            point_in_range = (in_range(point_dist, (self.min_range, self.max_range)))\
                and (in_range(point_bearing, self._fov_left)\
                     or in_range(point_bearing, self._fov_right))
            if not point_in_range:
                detectable = False
            else:
                if walls_to_consider is None:
                    if grid_map is not None:
                        walls_to_consider = grid_map.walls
                    else:
                        print("Warning: within_range is not using wall intersection")
                        walls_to_consider = set()

                # Check walls
                for objid in walls_to_consider:
                    wall = walls_to_consider[objid]
                    if wall.intersect(robot_pose[:2], point):
                        detectable = False
                        intersecting_wall = (objid, wall)
                        break

        if cache is not None:
            assert cache.sensor_name == self.name
            cache.put(robot_pose, point, detectable, intersecting_wall)

        if return_intersecting_wall:
            return detectable, intersecting_wall
        else:
            return detectable

In this case, the intersection is handled by "wall.intersect", which just checks if the line segment intersects with the edge that represents the wall. I think you can achieve something of similar effect with the blocked function in the current grid_map (IMO better because it's an occupancy grid map that is more versatile).

I am happy to share the code for this early phase with you if necessary. Please reach out to me by email. Thanks!

from cos-pomdp.

jeongeun980906 avatar jeongeun980906 commented on July 19, 2024

from cos-pomdp.

zkytony avatar zkytony commented on July 19, 2024

I see. If you can distinguish the grids for the wall from the grids that are potential object locations (taken as input by the cos-pomdp planner), then you can only consider blocking to happen on the wall grids. I think walls in Ai2THOR are objects with bounding boxes. You may be able to project those boxes onto the grid map, and assign those grids to have a label "wall".

from cos-pomdp.

zkytony avatar zkytony commented on July 19, 2024

I wonder if it is possible to remove all objects from a scene, and then run the mapping algorithm in thortils, which gives you obstacles that are just walls. This could be one way to label the walls as well. Essentially you'd like to have a layout map with just walls.

from cos-pomdp.

jeongeun980906 avatar jeongeun980906 commented on July 19, 2024

from cos-pomdp.

jeongeun980906 avatar jeongeun980906 commented on July 19, 2024

from cos-pomdp.

zkytony avatar zkytony commented on July 19, 2024

Glad it helped!

-Kaiyu

from cos-pomdp.

Related Issues (5)

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.