Loiter mode without GPS

Hi, for my university project i need to make a drone that flights inside a greenhouse. I need to put a obstacle avoidance feature like this one
However, it says it works in loiter mode. Is there anyway can i use loiter mode without GPS? As I wont be installing any GPS module to my drone.

Can I use this in a normal flightmode? Thanks

Not 100% sure, but I don’t think so… we need it on Loiter mode to estimate velocity and position, I think that even AltHold needs a GPS Receiver, is the other flight mode that supports this feature.

But, maybe this could help you someway:

Can you confirm me if AltHold needs GPS for flying? Thanks

If I am not mistaken, AltHold uses GPS data to estimate velocities, but I didn’t find anything about it on Wiki, I heard about it in some other post on this forum.

@amilcarlucas can probably elucidate it for you.

AltHold does not need GPS with default EKF settings, possibly only if you change the altitude source.


So with barometer as alt source you do not need GPS for AltHold at all?

1 Like

I believe that to be the case

Hi @GabriGlider,

@xfacta is correct, AltHold does not require a GPS. The full list of flight modes is here on the wiki and the “Pos Sensor” column indicates whether they need a GPS (or other position sensor).

“Simple” object avoidance does work in AltHold but it doesn’t work well because the vehicle can’t stop itself if it doesn’t know its speed and position. The best that can be done is the vehicle leans away from obstacles and this leads to the vehicle bouncing away from obstacles which is OK but not great really.

I think the project might go better if you put an optical flow sensor (like the hereflow) and a downward facing lidar on it. By the way, AP supports various methods of non-GPS navigation listed here.

1 Like

Wow thats fantastic… Thanks for the info and your time mate.
So as I see in your video, it is possible to use Loiter mode but, instead of using GPS as reference, using the optical flow sensor like hereflow right??

If I can do that, can i even use the obstacle avoidance with it? It would be fantastic.

I dont understand whats the point on the Lidar. I see in your post that it is not recomended to use the integrated one in HereFlow. WhyÂż?


The Hereflow integrated lidar sensor is very short-range(2m max) and doesn’t work well in various light conditions. For this reason @rmackay9 is suggesting to use a separate downward facing lidar (with a decent range) for altitude.

1 Like

I agree with what @Clogz has written.

Optical flow is only useful for position estimation I’m afraid. It is not a full 3D SLAM camera or anything fancy like that. It just uses the movement seen by the downward facing camera plus the lidar distance to estimate how quickly the vehicle is moving horizontally.

… ah, maybe I’m misunderstanding what you’re suggesting… using Optical Flow in place of GPS will allow the vehicle to fly in Loiter mode and simple avoidance to work much better because the vehicle will know its horizontal speed so it can slow down and stop before it hits obstacles sensed by separate horizontal facing lidar.

1 Like

Yes, that is exactly my suggestion, so i can use Obstacle Avoidance safely indoors in Loiter mode thanks to HereFlow.

But there is yet one thing i dont understand. Why do i need to use another lidar with HereFlow? Do I need to connect that lidar to HereFlow? If you know any tutorial please let me know.

My dron would be a S500 frame with PixHawk 2.4.8 (only avialable right now here in Spain), with a front face lidar for simple obstacle avoidance. And for Loiter mode, the HereFlow sensor (+down facing lidar?). What Ardupilot version should I use?

Thanks for your time.


As @Clogz says, hereflow’s built in downward facing lidar doesn’t work very well so another separate downward facing lidar is required.

An optical flow sensor must always be paired with a rangefinder (aka sonar, lidar, etc) pointing in the same direction. Imagine looking out a car window, things that are very far away (like mountains) appear to move slowly across your field of view while things that are very close appear to move quickly. You can imagine that for the autopilot’s estimation system to know how quickly it is moving it requires knowing both how quickly things are moving across the camera’s field of view (aka the flow sensor value) and the things’ distance.