hmakelin / gisnav

Estimates airborne drone global position by matching video to map retrieved from onboard GIS server.
https://hmakelin.github.io/gisnav
MIT License
47 stars 19 forks source link

Provide mock GPS message with more information than just 3D position #109

Closed hmakelin closed 5 months ago

hmakelin commented 7 months ago

What's the issue The outgoing mock GPS messages would ideally also need 3D velocity and variance estimates to increase chances of being fused by the autopilot navigation filter.

Describe it in detail Currently the mock GPS demo using PX4 will trigger failsafes if the simulated GPS is completely switched off (failure gps off). This is possibly a symptom of the PX4 EKF2 refusing to fuse the SensorGps message.

Logs, screenshots, and other supporting information More context is provided in this comment https://github.com/hmakelin/gisnav/issues/92#issuecomment-1925687077.

hmakelin commented 7 months ago

Probably best approach to tackle this issue would be to integrate an existing EKF package (like robot_localization) and use a simple state model to derive the velocity and variances. GISNav since v0.65 uses tf2 so this should be a bit easier than in earlier versions.

hmakelin commented 7 months ago

Regarding the suggestion in this comment - it might be possible to enable the mock GPS demo again by rolling back the PX4 version but I have no plans on doing it for GISNav as it would also mean reintroducing messages like VehicleGpsPosition and I feel the effort would be better spent in e.g. integrating an EKF.

JiatengSun commented 7 months ago

I understand. Is there any other way to get a demo running without any hassle (I truly don't want to disturb your development plan)? Since I assume you have a demo that is working on your local machine? I am quite new to docker tbh, so I am not sure if there's a way to "clone" a working demo on my PC, or roll back PX4 version to test if any works. :/

I see in the DockerFile we are cloning --branch v1.14.0-beta2, was this version working in your local machine?

hmakelin commented 6 months ago

Hi Jiateng - Apologies for the late reply.

Since I assume you have a demo that is working on your local machine?

My local images are pretty close to current master branch and they should "work" in the sense that you should see some matches and the simulated EKF will possibly blend/fuse the SensorGps messages. But fully killing the simulated GPS will most likely trigger failsafes, and ArduPilot support is not there since it has not been updated for a long time. I also have disabled shared memory on my development machine since I am not confident it works when trying to communicate between host and Docker container.

I see in the DockerFile we are cloning --branch v1.14.0-beta2, was this version working in your local machine?

Since GISNav v0.65 the px4 the Dockerfiles should be using v1.14.0. In GISNav v0.64 I was pulling -beta1 from my own fork of PX4 but haven't used that in a while since I don't have the time to maintain it. I did a quick search for -beta2 through my files on the master branch - could not find anything but I have possibly used that version before too.

Is there any other way to get a demo running without any hassle

I am unfortunately not able to offer you any real help with this but I can say I am currently looking into ways of integrating VO/EKF to hopefully make the integration less brittle

hmakelin commented 6 months ago

My local images are pretty close to current master branch and they should "work"

I should also mention here that I just submitted a PR to fix an issue in the setup.py file or dependencies installation on the current master branch that breaks the gisnav image, see this comment: https://github.com/hmakelin/gisnav/pull/114#issuecomment-1998480716

JiatengSun commented 6 months ago

So what is an appropriate way to tell if the visual navigation is working without completely turning off gps signal? (gps failure off)

hmakelin commented 6 months ago

You could try opening the MAVLink console in QGC Analyze view and typing e.g. listener sensor_gps -n 20. If you see messages there with the satellites_used value at 255 you know the autopilot is receiving the mock GPS messages from GISNav. After that it becomes a matter of configuring the GPS blending settings for the autopilot and resolving this issue.

JiatengSun commented 6 months ago

You could try opening the MAVLink console in QGC Analyze view and typing e.g. listener sensor_gps -n 20. If you see messages there with the satellites_used value at 255 you know the autopilot is receiving the mock GPS messages from GISNav. After that it becomes a matter of configuring the GPS blending settings for the autopilot and resolving this issue.

this is what it returns: pxh> listener sensor_gps -n 20

TOPIC: sensor_gps instance 0 #1 sensor_gps timestamp: 152624000 (0.200000 seconds ago) timestamp_sample: 0 time_utc_usec: 1711329249864173 device_id: 0 (Type: 0x00, UNKNOWN:0 (0x00)) lat: 375233036 lon: -1222530335 alt: 131525 alt_ellipsoid: 131525 s_variance_m_s: 0.25000 c_variance_rad: 0.50000 eph: 1.00000 epv: 1.00000 hdop: 0.00000 vdop: 0.00000 noise_per_ms: 0 jamming_indicator: 0 vel_m_s: 4.93000 vel_n_m_s: -4.92000 vel_e_m_s: -0.23000 vel_d_m_s: 0.03000 cog_rad: 3.18837 timestamp_time_relative: 0 heading: nan heading_offset: nan heading_accuracy: 0.00000 rtcm_injection_rate: 0.00000 automatic_gain_control: 0 fix_type: 3 jamming_state: 0 spoofing_state: 0 vel_ned_valid: True satellites_used: 10 selected_rtcm_instance: 0 Waited for 2.0 seconds without a message. Giving up.

I tried this several times, everytime satellites_used returns 10. (Which is consistent with what QGroundControl is showing)

Back to my previous question, I guess I really wanted a way to visually see that GisNav is working, for example maybe print out what gps coordinate GisNav returns and printing them out when available in a terminal.