ROS与Qt5人机交互界面开发-实现导航功能的完整显示
ROS与Qt5人机交互界面开发-实现导航功能的完整显示
说明:
- 介绍如何实现导航功能的完整显示
步骤:
- 显示效果
- 设置初始点:
- 设置目标点:
- 核心代码
- 如果看过前几篇博客,其实也就是添加几个图层:
//显示导航相关
void QRviz::Display_Navigate(bool enable,QString Global_topic,QString Global_planner,QString Local_topic,QString Local_planner)
{
if(Navigate_localmap) {delete Navigate_localmap; Navigate_localmap=NULL;}
if(Navigate_localplanner) {delete Navigate_localplanner; Navigate_localplanner=NULL;}
if(Navigate_globalmap) {delete Navigate_globalmap; Navigate_globalmap=NULL;}
if(Navigate_globalplanner) {delete Navigate_globalplanner; Navigate_globalplanner=NULL;}
//local map
Navigate_localmap=manager_->createDisplay("rviz/Map","Qlocalmap",enable);
Navigate_localmap->subProp("Topic")->setValue(Local_topic);
Navigate_localmap->subProp("Color Scheme")->setValue("costmap");
Navigate_localplanner=manager_->createDisplay("rviz/Path","QlocalPath",enable);
Navigate_localplanner->subProp("Topic")->setValue(Local_planner);
Navigate_localplanner->subProp("Color")->setValue(QColor(0,12,255));
//global map
Navigate_globalmap=manager_->createDisplay("rviz/Map","QGlobalmap",enable);
Navigate_globalmap->subProp("Topic")->setValue(Global_topic);
Navigate_globalmap->subProp("Color Scheme")->setValue("costmap");
Navigate_globalplanner=manager_->createDisplay("rviz/Path","QGlobalpath",enable);
Navigate_globalplanner->subProp("Topic")->setValue(Global_planner);
Navigate_globalplanner->subProp("Color")->setValue(QColor(255,0,0));
//更新画面显示
manager_->startUpdate();
}
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号