grid_map(五):grid_map函数定义、类型定义学习
一、grid_map_cv函数介绍
1.1 grid_map::GridMapCvConverter::initializeFromImage
功能:从图像初始化生成栅格地图
函数简介:
static bool grid_map::GridMapCvConverter::initializeFromImage ( const cv::Mat & image,const double resolution,grid_map::GridMap & gridMap,const grid_map::Position & position ) Initializes the geometry of a grid map from an image. This changes the geometry of the map and deletes all contents of the layers!Parameters:[in] image the image.[in] resolution the desired resolution of the grid map [m/cell]. 栅格地图需要的分辨率[out] gridMap the grid map to be initialized. 需要初始化的栅格地图[in] optional) position the position of the grid map. --栅格地图的位置-地图的原点的原点在栅格地图对应坐标系中的位置--地图的原点为地图的左下角--注:栅格地图右向为x轴正向,上为y轴正向Returns:true if successful, false otherwise.
其中grid_map::Position类型定义如下:
typedef Eigen::Vector2d Position;
函数定义:
static bool initializeFromImage(const cv::Mat& image, const double resolution,grid_map::GridMap& gridMap, const grid_map::Position& position){const double lengthX = resolution * image.rows;const double lengthY = resolution * image.cols;Length length(lengthX, lengthY);gridMap.setGeometry(length, resolution, position);return true;}
1.2 grid_map::GridMap::setGeometry
设置栅格地图在指定坐标系下的位置
void grid_map::GridMap::setGeometry ( const Length & length,const double resolution,const Position & position = Position::Zero() ) Set the geometry of the grid map. Clears all the data.
设置栅格地图的几何位置,并清除数据Parameters:length the side lengths in x, and y-direction of the grid map [m].--x、y方向的长度resolution the cell size in [m/cell].--分辨率position the 2d position of the grid map in the grid map frame [m]. --栅格地图在栅格地图坐标系中的位置
1.3 grid_map::GridMapCvConverter::addLayerFromImage
利用图像数据给栅格地图添加图层
#添加图层的数据类型,及通道数
template<typename Type_ , int NChannels_>
static bool grid_map::GridMapCvConverter::addLayerFromImage ( const cv::Mat & image,const std::string & layer,grid_map::GridMap & gridMap,const float lowerValue = 0.0, //默认值const float upperValue = 1.0, //默认值const double alphaThreshold = 0.5 //默认值) [inline, static]Adds a layer with data from image. 从图像中添加一个有数据的层Parameters:[in] image the image to be added. If it is a color image (bgr or bgra encoding), it will be transformed in a grayscale image. 需要被添加的图像,其中彩色图会转为灰度图[in] layer the layer that is filled with the image data. 需要添加图像数据的图层[out] gridMap the grid map to be populated. 被填充的栅格地图[in] optional) lowerValue value of the layer corresponding to black image pixels.--图层一个栅格中值的最低值-对应图像的黑色像素[in] optional) upperValue value of the layer corresponding to white image pixels.--图层一个栅格中值的最大值-对应图像的白色像素--图层一个栅格中值的范围应该在[lowerValue,upperValue]之间[in] optional) alphaThreshold the threshold ([0.0, 1.0]) for the alpha value at which cells in the grid map are marked as empty.--栅格地图某一栅格标记为空时的阈值(这么小的值,应该不是图像像素,是转化后的栅格地图值),改阈值范围为0~1Returns:true if successful, false otherwise.
1.4 grid_map::GridMap::get
返回图层数据,后续操作可能会改变图层数据
Matrix & grid_map::GridMap::get ( const std::string & layer ) Returns the grid map data for a layer as non-const. Use this method with care!
--返回栅格地图图层数据作为一个非常量,使用这种方法需要注意(是会改变图层数据吗?)Parameters:layer the name of the layer to be returned. --图层名称Returns:grid map data. 栅格地图格式数据Exceptions:std::out_of_range if no map layer with name `layer` is present. --没有该图层时会输出
1.5 const Matrix & grid_map::GridMap::get
返回图层数据,应该不会改变图层的数据
const Matrix & grid_map::GridMap::get ( const std::string & layer ) constReturns the grid map data for a layer as matrix.Parameters:layer the name of the layer to be returned.Returns:grid map data as matrix. Exceptions:std::out_of_range if no map layer with name `layer` is present.
1.6 grid_map::GridMapRosConverter::toOccupancyGrid
转换栅格地图指定图层为ros栅格地图数据类型
void grid_map::GridMapRosConverter::toOccupancyGrid ( const grid_map::GridMap & gridMap,const std::string & layer,float dataMin,float dataMax,nav_msgs::OccupancyGrid & occupancyGrid ) [static]Parameters:[in] gridMap the grid map object.[in] layer the layer that is transformed to the occupancy cell data.[in] dataMin the minimum value of the grid map data (used to normalize the cell data in [min, max]).[in] dataMax the maximum value of the grid map data (used to normalize the cell data in [min, max]).[out] occupancyGrid the message to be populated. 被填充的栅格地图的消息名
1.7 grid_map::GridMap::setTimestamp
设置栅格地图的时间戳
void grid_map::GridMap::setTimestamp ( const Time timestamp ) Set the timestamp of the grid map.
----设置栅格地图的时间戳(单位:纳秒)Parameters:timestamp the timestamp to set (in nanoseconds).
示例:
global_map.setTimestamp(ros::Time::now().toNSec());
二 grid_map类型定义
2.1 grid_map::Index
定义为:
typedef Eigen::Array2i Index;
参考下面,可以为两个int型的元组
template<typename Type >
using Eigen::Array2X = Array< Type, 2, Dynamic >
附录:
grid_map_cv官方文档介绍:grid_map_cv: File List
进入该网页不能够进行搜索查询,但可以在谷歌以“grid_map::xxx::xx”格式进行搜索
@meng
grid_map(五):grid_map函数定义、类型定义学习相关推荐
- main函数的类型定义
void main()还是int main() 最近在论坛上看到有不少网友的程序中,main函数都写成void main(),而不是int main().那么,到底哪个是正确的,或至少是推荐使用的呢? ...
- typescript(四)ts中函数的参数和返回值的类型定义
前面我们讲到过ts的静态类型定义中的函数类型定义,先来回顾下: const fnA: () => string = () => { return '1' } const fnB: () = ...
- Go 学习笔记(27)— type 关键字(类型定义、类型别名、类型查询、定义接口、定义结构体)
1. 类型别名定义 定义类型别名的写法为: type TypeAlias = Type 类型别名规定: TypeAlias 只是 Type 的别名,本质上 TypeAlias 与 Type 是同一个类 ...
- 函数指针的定义与使用
函数指针 一个函数在编译时被分配一个入口地址,函数名代表函数的入口地址,可以定义一个指针,保存函数的入口地址,该指针就是一个函数指针. 函数指针的定义 // 1 直接定义函数指针 // int fun ...
- Go 知识点(05)— 类型别名与类型定义
1. 类型别名 类型别名需要在别名和原类型之间加上赋值符号 = ,使用类型别名定义的类型与原类型等价,Go 语言内建的基本类型中就存在两个别名类型. byte 是 uint8 的别名类型: rune ...
- 函数指针和函数指针类型
参考:https://blog.csdn.net/candyliuxj/article/details/6339414 函数指针 1. 定义 每一个函数都占用一段内存单元,它们有一个起始地址, ...
- java min 函数的使用方法_【Python】Java程序员学习Python(五)— 函数的定义和使用...
不想做一个待宰的羔羊!!!!要自己变得强大.... 函数的定义和使用放在最前边还是有原因的,现在语言趋于通用,基本类型基本都是那些,重点还是学习对象的使用方法,而最根本的还是方法的使用,因此优先介绍, ...
- TS基础1(类型定义、接口)-学习笔记
文章目录 TS基础1(类型定义.接口)-学习笔记 什么是TS TS基础1(类型定义.接口)-学习笔记 什么是TS //ts用法var n:number = 10;let str:string = '1 ...
- html 超链接 javascript 函数 java 未定义_JavaScript 学习笔记(一)
本系列适合作为JS的复习文档. 学习JavaScript,不要以为会做一两个如图片切换.tabs选项卡这样特效,就是精通JavaScript了.JavaScript不仅仅是用来做一两个特效,它更大的用 ...
最新文章
- php in循环与for循环,详谈js中标准for循环与foreach(for in)的区别
- 一个游戏美术写给策划的快速入门
- “豆瓣酱”之用户,场景,功能
- GuGuFishtion(2018 Multi-University Training Contest 7)
- linux下swftools 的配置
- [文摘20071224]七条不可不知的生存法则
- 大型双标现场?摩托车举报特斯拉逆行反被罚
- Html中 table,list等表格 中 js 的 Checkbox全选,反选,单选,获取数据选中行 的写法
- Redis的AOF的配置
- java登录验证用重定向_使用filter进行登录验证,并解决多次重定向问题
- 《软件方法》强化自测题-需求(2)
- 2008下mysql补丁_windows Server 2008 R2安装Mysql 8的打补丁顺序
- 官网下载Tomcat
- 香农编码Shannon
- matlab 光谱共聚焦,激光共焦显微拉曼光谱分析实验数据处理及谱图解析
- c语言股票最大收益_C语言买卖股票问题
- 【最实用的chrome插件】CSDN 浏览器插件:CSDN 开发者助手(测评手册1)
- c语言常用颜色种类,C语言常用颜色种类(国外英语资料).doc
- 结构思考力-读书笔记
- 计算机动画制作 课件,第四章 计算机动画的制作与编辑-课件(PPT).ppt