dstar.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Learning-to-navigate-without-a-map 作者: ToniRV 项目源码 文件源码
def add_obstacle(self, x, y):
        msg = str(x)+" "+str(y)

        # Request a cell update
        print("[INFO] Sending cell update request")
        self.socket.send(b"update")

        #  Get the reply.
        errors = False
        if (self.socket.recv() != "go"):
            print("[ERROR] Socket could not process update request.")
            errors = True
            self.socket.send(b"")
        else:
            self.socket.send(msg)

        if (self.socket.recv() != "ok"):
            print("[ERROR] Socket was not able to update given cell.")
            errors = True
        else:
            index = np.ravel_multi_index((x, y), self.imsize, order='C')
            print("[INFO] Updating new obstacle")
            self.grid[index] = 0

        return errors
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号