本文整理匯總了Python中nav_msgs.msg.OccupancyGrid.data[-i]方法的典型用法代碼示例。如果您正苦於以下問題:Python OccupancyGrid.data[-i]方法的具體用法?Python OccupancyGrid.data[-i]怎麽用?Python OccupancyGrid.data[-i]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nav_msgs.msg.OccupancyGrid
的用法示例。
在下文中一共展示了OccupancyGrid.data[-i]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: publish
# 需要導入模塊: from nav_msgs.msg import OccupancyGrid [as 別名]
# 或者: from nav_msgs.msg.OccupancyGrid import data[-i] [as 別名]
def publish(self, real_width=10.0, real_height=10.0, offset=0.0, resolution=0.05):
width = int(real_width / resolution)
height = int(real_height / resolution)
og = OccupancyGrid()
og.info.resolution = resolution
og.info.width = width
og.info.height = height
og.info.origin.position.x = -real_width/2
og.info.origin.position.y = -real_height/2 + offset
og.info.origin.orientation.w = 1.0
og.data = [0] * width * height
for i in range(width):
og.data[i] = 100
og.data[-i] = 100
for i in range(height):
og.data[i*width] = 100
og.data[(i+1)*width-1] = 100
self.pub.publish(og)