当前位置: 首页>>代码示例>>Python>>正文


Python OccupancyGrid.header方法代码示例

本文整理汇总了Python中nav_msgs.msg.OccupancyGrid.header方法的典型用法代码示例。如果您正苦于以下问题:Python OccupancyGrid.header方法的具体用法?Python OccupancyGrid.header怎么用?Python OccupancyGrid.header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nav_msgs.msg.OccupancyGrid的用法示例。


在下文中一共展示了OccupancyGrid.header方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_map

# 需要导入模块: from nav_msgs.msg import OccupancyGrid [as 别名]
# 或者: from nav_msgs.msg.OccupancyGrid import header [as 别名]
    def load_map(fp):
        
        ogrid = OccupancyGrid()
        step = None
        offset = None
        yaml_file = fp + ".yaml"
        csv_file = fp + ".csv"
        with open(yaml_file, "r") as infile:
            for k, v in yaml.load(infile.read()).iteritems():
                if k == "Header":
                    ogrid.header = v

                elif k == "MapMetaData":
                    ogrid.info = v
                    step = v.resolution
                    offset = (v.origin.position.x, v.origin.position.y)

                elif k == "GridFile":
                    print "GridFile: ", v
                else: 
                    print "Unexpected k : ", k
                    raise TypeError("Unexpected key type in yaml file: " + yaml_file)

            ogrid.data = list(np.loadtxt(csv_file, dtype=np.int8, delimiter=","))

        print "Map loaded"
        
        return ogrid, step, offset
开发者ID:kekraft,项目名称:contamination_stack,代码行数:30,代码来源:point_2_world.py

示例2: get_message

# 需要导入模块: from nav_msgs.msg import OccupancyGrid [as 别名]
# 或者: from nav_msgs.msg.OccupancyGrid import header [as 别名]
    def get_message(self):
        ogrid = OccupancyGrid()
        ogrid.header = navigator_tools.make_header(frame="enu")
        ogrid.info.resolution = self.resolution
        ogrid.info.height, ogrid.info.width = self.grid.shape
        ogrid.info.origin = self.origin
        grid = np.copy(self.grid)
        ogrid.data = np.clip(grid.flatten() - 1, -100, 100).astype(np.int8)

        return ogrid
开发者ID:uf-mil,项目名称:Navigator,代码行数:12,代码来源:start_gate.py

示例3: publish_grid

# 需要导入模块: from nav_msgs.msg import OccupancyGrid [as 别名]
# 或者: from nav_msgs.msg.OccupancyGrid import header [as 别名]
 def publish_grid(self):
     '''
     Take the occupancy grid and send it out over ros with timestamps and whatnot.
     '''
     t = rospy.Time.now()
     header = Header(stamp=t, frame_id='/map')
     # Populate occ grid msg
     occ_msg = OccupancyGrid()
     occ_msg.header = header
     occ_msg.info = self.meta_data
     # Make sure values don't go out of range
     occ_grid = self.searched + self.markers - 1
     occ_msg.data = np.clip(occ_grid.flatten(), -1, 100)
     self.occ_grid_pub.publish(occ_msg)
开发者ID:jpanikulam,项目名称:Sub8,代码行数:16,代码来源:marker_occ_grid.py

示例4: get_message

# 需要导入模块: from nav_msgs.msg import OccupancyGrid [as 别名]
# 或者: from nav_msgs.msg.OccupancyGrid import header [as 别名]
    def get_message(self):
        if self.grid is None:
            fprint("Ogrid was requested but no ogrid was found. Using blank.", msg_color='yellow')
            self.grid = np.zeros((self.height / self.resolution, self.width / self.resolution))

        ogrid = OccupancyGrid()
        ogrid.header = navigator_tools.make_header(frame="enu")
        ogrid.info.resolution = self.resolution
        ogrid.info.height, ogrid.info.width = self.grid.shape
        ogrid.info.origin = self.origin
        grid = np.copy(self.grid)
        ogrid.data = np.clip(grid.flatten() - 1, -100, 100).astype(np.int8)

        return ogrid
开发者ID:whispercoros,项目名称:Navigator,代码行数:16,代码来源:circle_sim.py

示例5: make_ogrid

# 需要导入模块: from nav_msgs.msg import OccupancyGrid [as 别名]
# 或者: from nav_msgs.msg.OccupancyGrid import header [as 别名]
    def make_ogrid(self, np_arr, size, center):
        np_center = np.array(center)
        np_origin = np.append((np_center - size / 2)[:2], 0)
        origin = mil_tools.numpy_quat_pair_to_pose(np_origin, [0, 0, 0, 1])

        ogrid = OccupancyGrid()
        ogrid.header = mil_tools.make_header(frame='enu')
        ogrid.info.origin = origin
        ogrid.info.width = size / self.resolution
        ogrid.info.height = size / self.resolution
        ogrid.info.resolution = self.resolution

        ogrid.data = np.clip(np_arr.flatten() - 1, -100, 100).astype(np.int8)
        return ogrid
开发者ID:ironmig,项目名称:Navigator,代码行数:16,代码来源:circle_tower.py

示例6: publishMapArray

# 需要导入模块: from nav_msgs.msg import OccupancyGrid [as 别名]
# 或者: from nav_msgs.msg.OccupancyGrid import header [as 别名]
def publishMapArray(msg):
    global mapMetaData, header
    msg[msg==5]=50
    msg[msg==256]=0
    processedMap = OccupancyGrid()
    data =[]
    for i in range(len(msg)):
        #processedMap.data.append(msg[i])    
        for j in range(len(msg[i])):
            data.append(int(msg[i][j]))
    processedMap.info = mapMetaData
    processedMap.header = header
    processedMap.data=data
    #processedMap = OccupancyGrid(header,mapMetaData,data)
    pub = rospy.Publisher('ProcessedMap', OccupancyGrid, queue_size = 10)
    emptyMsg = OccupancyGrid()
    pub.publish(processedMap)
    print "publishing..."
    pub.publish(processedMap)
    msg[msg==50]=5
    msg[msg==0]=256
开发者ID:thabib510,项目名称:native,代码行数:23,代码来源:goalListener.py

示例7: publishMapArray

# 需要导入模块: from nav_msgs.msg import OccupancyGrid [as 别名]
# 或者: from nav_msgs.msg.OccupancyGrid import header [as 别名]
def publishMapArray(msg):
    global mapMetaData, header, oldMap
    msg[msg==5]=50
    msg[msg==256]=0
    processedMap = OccupancyGrid()
    data =[]
    for i in range(len(msg)):
        #processedMap.data.append(msg[i])    
        for j in range(len(msg[i])):
            data.append(int(msg[i][j]))
    processedMap.info = mapMetaData
    processedMap.header = header
    processedMap.data=data
    pub = rospy.Publisher('ProcessedMap', OccupancyGrid, queue_size = 10)
    rate = rospy.Rate(10) # 10hz
    while (not rospy.is_shutdown() and oldMap):
        str_log = "message sent at: %s" % rospy.get_time()
        rospy.loginfo(hello_str)
        pub.publish(processedMap)
        rate.sleep()
    print "publishing..."
    pub.publish(processedMap)
    msg[msg==50]=5
    msg[msg==0]=256
开发者ID:thabib510,项目名称:native,代码行数:26,代码来源:cleanMapNode.py


注:本文中的nav_msgs.msg.OccupancyGrid.header方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。