Servers by jDrones

GPS2 not logging if GPS_TYPE is MAV


(Trixie Roque) #1

Hi,

I’m using a Pixhawk2 autopilot and I’m trying to see if I can switch between a fake_gps (by publishing through mavros/hil/gps) and a real GPS module (HERE2). By itself, the HERE2 GPS seems to be working fine. That is, I set GPS_TYPE as 1 (auto) and I’m able to get a precise reading of my location from the mavros topic mavros/global_position/global. However, now I want to be able to switch between my fake_gps and the HERE2 where my primary is the fake_gps.

On APM Planner, I’ve set the param GPS_TYPE as 14 (MAV) and GPS2_TYPE as 1 (Auto) and GPS_AUTO_SWITCH as 1. However, I haven’t been able to see any messages saying that I’ve been switching between the two nor do I see on my data that there is a fix based on the HERE2 GPS. What I do see is that the fix only depends on the fake_gps. That is, whenever there is a fix on my fake_gps (which I set at 5 for RTK and satellites as 20), there would be a fix on the topic mavros/global_position/global and vice versa.

I’ve checked through the mavros code (AP_GPS.cpp) and I see that I should be able to switch between the two if the status and/or the number of satellites of the one that is not the primary is higher than the current primary starting from this line on AP_GPS.cpp. My test to see if there is a switch is to set my fake_gps status as NO FIX and number of satellites as 0, but I still don’t see my flight controller switching to the HERE2 GPS.

I’ve also noticed that if my HERE2 GPS is GPS2_TYPE, it doesn’t record any GPS2 on my dataflash log on my SD card. I’m thinking that the problem here is that my autopilot just doesn’t see the HERE2 GPS if it is set as GPS2, which is why it doesn’t auto switch.

Has anyone tried to do a fake_gps/real gps auto switch successfully before?

Thanks in advance,
trix


(Trixie Roque) #2

Anybody?

Sorry if I’m being unclear, but I can provide more information if needed. I just need to know what’s wrong with my system that I’m not getting a log for GPS2 for my HERE2 and I’m not sure how to pinpoint what’s causing it.

Thanks,
trix