當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。