autoware:gnss_localizer nmea2tfpose 节点相关


本系列文章由@邻居张师傅 出品,转载请注明出处。

文章链接: https://editor.csdn.net/md?not_checkout=1&articleId=109842026

邮箱:zhangyh.nb@qq.com



overview

gnss_localizer将NMEA消息从GNSS接收器转换到(x,y,z,侧倾,俯仰,偏航)位置。


NMEA消息

GPS 的一种消息格式

.bag包中包含NMEA消息,消息类型为nmea_msgs/Sentence:

nmea_msgs/Sentence 
std_msgs/Header header
string sentence # NMEA0183格式的ASCII字符串

查看 nmea_sentence 话题发布的 nmea_msgs/Sentence 消息:

$ rostopic echo /nmea_sentence
---
header: 
  seq: 160226
  stamp: 
    secs: 1427157854
    nsecs: 546808958
  frame_id: "/gps"
sentence: "$GNRMC,004359.40,A,3514.1250755,N,13700.0880895,E,15.8924,222.208,240315,7.321,E,D*2F"
---
header: 
  seq: 160227
  stamp: 
    secs: 1427157854
    nsecs: 563855886
  frame_id: "/gps"
sentence: "$GPGGA,004359.40,3514.1250755,N,13700.0880895,E,5,10,0.96,42.3297,M,38.4418,M,1.4,0556*4C"
---
header: 
  seq: 160228
  stamp: 
    secs: 1427157854
    nsecs: 573806047
  frame_id: "/gps"
sentence: "$GNVTG,222.208,T,229.529,M,15.8924,N,29.4326,K,D*3C"
---
header: 
  seq: 160229
  stamp: 
    secs: 1427157854
    nsecs: 583868980
  frame_id: "/gps"
sentence: "QQ02C,INSATT,V,004359.40,8.091,10.146,233.312,@F1"
---
header: 
  seq: 160230
  stamp: 
    secs: 1427157854
    nsecs: 596791982
  frame_id: "/gps"
sentence: "WW03C,INSDAT,004359.40,1.555,-2.312,-9.001,0.671,0.114,-1.266,@37"
---

nmea2tfpose 节点

接受nmead话题的消息,转换后发送给tf库PoseStamped消息,实现 map 坐标系 到 gps 坐标系的转换
该节点发布的消息如下:

header: 
  seq: 181
  stamp: 
    secs: 1427157662
    nsecs: 371006965
  frame_id: "map"
pose: 
  position: 
    x: -7606963.92947
    y: 35556078.0335
    z: 47.7636
  orientation: 
    x: 0.000958006771906
    y: -0.113925190181
    z: -0.430242612233
    w: 0.895495074182
---

.lanunch文件:

	  <node pkg="gnss_localizer" type="nmea2tfpose" name="nmea2tfpose" output="log">
	    <param name="plane" value="$(arg plane)"/>

调用:

$ roslaunch gnss_localizer nmea2tfpose.launch plane:=7

roslaunch gnss_localizer nmea2tfpose.launch plane:=7


关键源码

初始化:
在这里插入图片描述
回调函数
在这里插入图片描述在这里插入图片描述在这里插入图片描述
在这里插入图片描述

  • 3
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
#include "ros/ros.h" #include "nmea_converter/nmea_converter.hpp" static ros::Publisher pub1, pub2, pub3; static nmea_msgs::Sentence sentence; static std::string sub_topic_name, pub_fix_topic_name, pub_gga_topic_name, pub_gst_topic_name; bool flag = false; void nmea_callback(const nmea_msgs::Sentence::ConstPtr &msg) { sensor_msgs::NavSatFix fix; UnicoreData data; sentence.header = msg->header; sentence.sentence = msg->sentence; bool flag = ConverterToFix(sentence, data, &fix); if (flag == true && fix.header.stamp.toSec() != 0) { pub1.publish(fix); } } int main(int argc, char **argv) { ros::init(argc, argv, "nmea_converter_node"); ros::NodeHandle n; n.getParam("sub_topic_name", sub_topic_name); n.getParam("pub_fix_topic_name", pub_fix_topic_name); n.getParam("pub_gga_topic_name", pub_gga_topic_name); // n.getParam("output_gga", output_gga); std::cout << "sub_topic_name " << sub_topic_name << std::endl; std::cout << "pub_fix_topic_name " << pub_fix_topic_name << std::endl; std::cout << "pub_gga_topic_name " << pub_gga_topic_name << std::endl; std::cout << "pub_rmc_topic_name " << pub_gst_topic_name << std::endl; // std::cout << "output_gga " << output_gga << std::endl; // std::cout << "output_gst " << output_gst << std::endl; ros::Subscriber sub = n.subscribe(sub_topic_name, 1000, nmea_callback); pub1 = n.advertise<sensor_msgs::NavSatFix>(pub_fix_topic_name, 1000); // if (output_gga) // pub2 = n.advertise<nmea_msgs::Gpgga>(pub_gga_topic_name, 1000); // if (output_gst) // pub3 = n.advertise<nmea_msgs::Gpgst>(pub_gst_topic_name, 1000); ros::spin(); return 0; } 上面这段代码运行时会报以下错误,请帮我检查一下:couldn't register subscriber on topic [/]
07-15
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值