locusrobotics / qgis_ros

ROS QGIS Plugin prototype
MIT License
45 stars 9 forks source link

Add NavSatFixTranslator and the ability to change CRS per message type #12

Closed romainreignier closed 4 years ago

romainreignier commented 4 years ago

Thanks a lot of this qgis_ros package, it is quite useful to use QGis to see geographic data.

So I have added a NavSatFixTranslator to use ROS standard sensor_msgs/NavSatFix GNSS receiver messages.

I had to add a new CRS in order to get the points on a correct location on a map, so I have added a crsName member to the Translator base class.

I had to use dicts to store CRS PROJ4 data and QgsCoordinateReferenceSystem objects because the raw PROJ4 string contains spaces and cannot be used in the uri passed to QgsVectorLayer constructor when subscribing to a topic.

ablakey commented 4 years ago

Thanks for the contribution!

I am not in a position to test this with NavSatFix data. If you've got a simple testing strategy that's reasonably easy and safe to share, that would be great. Otherwise I will defer to you to decide that this works as intended. The diff looks good to me.

I think there may be a case that if we handle more than 1 CRS, we should be more generic than hard-coding 2 of them. However, I think WGS84 and Simple should cover most robotics + GIS use cases. This is a problem I'm happy to kick down the road.

I'd love to hear more about what you're doing with QGIS-ROS, if you've got any public links/details to share.

Let me know if you think it's good to merge and I'll do so.

romainreignier commented 4 years ago

Ok, thank you for the feedback.

Tomorrow, I might be able to record a trivial rosbag in Gazebo for you to test. Actually, there may be publicly available rosbags from autonomous driving projects like Autoware.

I am not doing much with QGIS-ROS for now, I work on phenotyping solutions and wanted to view positions on a map. I already use QGIS a bit for other geo data like shapefiles and geotiff. Furthermore, I have seen the talk at ROSCon and always wanted to try it out one day.

romainreignier commented 4 years ago

Hi!

I have used a sample bag from Autoware ROSBAG Demo:

sample_moriyama_150324.tar.gz

It contains nmea_msgs/Sentence that I converted to sensor_msgs/NavSatFix with the nmea_navsat_driver.

So here it is: sample_moriyama_150324_navsatfix.bag.tar.gz

And the result in QGIS : 20200430-162700

The live topic version can be tested with rosbag play.

Note that I could not used lz4 compressed bag directly. It seems to be an issue with Python 3 because I can reproduce it with a simple script inspired from rosbag tutorial. It works with Python 2 but not with Python 3. This may be caused by ros-melodic-roslz4 that it targeted for Python 2 on Melodic. So it hould work on Noetic.

Also, I have done my PR against the master branch but because I am on Melodic, I have actually used the ab-handle-empty-module-names branch so maybe this branch should also merged to master.

ablakey commented 4 years ago

Thanks for the reminder. That branch should be merged. I'll test this out and then merge both today.