zhanghanduo / ROS_leaflet_gps

Draw GPS trajectory using leaflet and read from ROS topic
61 stars 16 forks source link

How to obtain the GPS pose topic /gps_pose in the sample bag? #4

Closed RichardHansir closed 3 years ago

RichardHansir commented 3 years ago

Hello,how to obtain the GPS pose topic /gps_pose in the sample bag? How to convert gps topic sensor_msgs/NavSatFix data to geometry_msgs/PoseWithCovarianceStamped? 图片1

zhanghanduo commented 3 years ago

There are two methods you can employ: 1) Use the gps_to_pose_conversion_node to convert from NavSatFix to geometry_msgs/Pose: https://github.com/ethz-asl/geodetic_utils/tree/master/geodetic_utils 2) If you are familiar with GPS, you can directly adjust my code and convert the NavSatFix data to project the 2D map point to visualize. something like https://geospace-code.github.io/pymap3d/ned.html

RichardHansir commented 3 years ago

Thanks for your quick reply,i will try to solve it according to your method.

RichardHansir commented 3 years ago

Thanks for your answer,i have solved the GPS pose topic. But there is a new question, the gps trajectory and slam trajectory not in the real word position. Is there anything missing?

zhanghanduo commented 3 years ago

I am not sure what you specifically mean by real world position.

I guess they are not aligned into the same reference frame. Normally visual SLAM output trajectory is in camera frame, namely z-front, x-right, right-handed coordinate system; your converted gps trajectory should be local ENU co-ordinates (z-up, east and north direction). So you have to firstly align the orientation of your gps and camera(or IMU) because your camera initial orientation and position are (0,0,0,1) and (0,0,0), but gps output at initial time is not.

RichardHansir commented 3 years ago

GPS trajectory and slam trajectory are not located in the real world, just like I am in Beijing, but displayed in other cities. 选区_090

zhanghanduo commented 3 years ago

Ah, sorry it is my fault. Check the code here: https://github.com/zhanghanduo/ROS_leaflet_gps/blob/e0b3edcc74a67e20dd5f7ef042be38818f84a3a0/scripts_resuse_path.js#L276

The 48 and 'N' refers to Singapore local UTM property. You can go to the website: https://www.gps-latitude-longitude.com/ and type in "Beijing" and find the UTM coordinates of the map pin: "50S". You can replace 48 and N with 50 and S. Then you can try it and see if the issue is solved.

zhanghanduo commented 3 years ago

Ah, sorry it is my fault. Check the code here:

https://github.com/zhanghanduo/ROS_leaflet_gps/blob/e0b3edcc74a67e20dd5f7ef042be38818f84a3a0/scripts_resuse_path.js#L276

The 48 and 'N' refers to Singapore local UTM property. You can go to the website: https://www.gps-latitude-longitude.com/ and type in "Beijing" and find the UTM coordinates of the map pin: "50S". You can replace 48 and N with 50 and S. Then you can try it and see if the issue is solved.

Just replace all the 48 and N in the reuse_path.js. There are two places.

GPS to UTM coordinate is not straightforward. As this is a self-use project, I didn't take time to do the automatic GPS conversion. If you have such need, feel free to contribute!

RichardHansir commented 3 years ago

I'm sorry to say I still didn’t show the track in the correct city. I have opend index_path.html in chrome and replaced all the 48 and N in the scripts_resuse_path.js. Is there anything else need to change?

zhanghanduo commented 3 years ago

I'm sorry to say I still didn’t show the track in the correct city. I have opend index_path.html in chrome and replaced all the 48 and N in the scripts_resuse_path.js. Is there anything else need to change?

Sorry about the inconvenience. I haven't used the code for almost two years :crying_cat_face: Need some time to check the problem. So after replacing the 48 and N you still get the same wrong location?

At the same time you can also double-check whether you have correctly converted the GPS to local pose msg.

RichardHansir commented 3 years ago

Thanks for your kindly help, I replaced the 48 and N and still got the wrong location,but the city was changed. I will carry on check the pose msg.

zhanghanduo commented 3 years ago

If you don't mind, you could me your ros bag and modified code. I am busy these two days, but I will try to solve it after that.

RichardHansir commented 3 years ago

I fixed it by converting GPS LLA Coordinate System to UTM system instead of LLA to ENU. I don't know if this is correct, at least displayed correctly.

zhanghanduo commented 3 years ago

:+1: