mavlink / MAVSDK-Java

MAVSDK client for Java.
71 stars 41 forks source link

goToLocation causing landing #48

Closed JessicaL237 closed 3 years ago

JessicaL237 commented 3 years ago

I've got the drone taking off, and then I'm calling the goToLocation action to get the drone to fly to a specified latitude and longitude. Instead, the drone lands - mavsdk detects a landing. No flying to the location, just landing.

My code: drone.getAction() .gotoLocation(waypoint.latitudeInDigitalDegrees, waypoint.longitudeInDigitalDegrees, (float) waypoint.altitudeInMeters, Float.NaN) .doOnError(throwable -> { LOGGER.error("Failed to go to next waypoint: " + ((Action.ActionException) throwable).getCode()); success.set(false); }).subscribe();

Any information would be greatly appreciated!

JonasVautherin commented 3 years ago

What altitude did you set? I'm asking because the altitude is expected above sea level. So if you are flying, say, in Switzerland, and set the altitude to 50m (hoping for 50m above ground), then that will be at least a few hundred meters under your position :innocent:. The altitude given to gotoLocation in this case should be [ground altitude above sea level] + 50.

hamishwillee commented 3 years ago

@JonasVautherin I'm sure we had a discussion on making this API more transparent recently :-)

JessicaL237 commented 3 years ago

Yes, that was it thanks! Is there an equivalent that uses relative altitude, or an API call to get ground altitude above sea level so I could factor it in?

JonasVautherin commented 3 years ago

The problem is that MAVLink in itself does not know the ground altitude. You would need an elevation model for that, and more or less accuracy depending on your use-case.

We can say "goto this altitude w.r.t. the altitude at which the drone took off" because that we know. If this is not accurate enough in your use-case, you need to get an elevation model and use the ground level from there, or something along those lines.

Does that make sense?

JessicaL237 commented 3 years ago

I think so, thanks

mfran89 commented 1 week ago

hypothetically if the drone is doing a mission and the gotolocation function is called will it exit out of auto mode and use the gotolocation wp as its final/landing wp?

julianoes commented 1 week ago

Please don't necrobump @mfran89. Create a new issue and give enough context.

mfran89 commented 1 week ago

Sorry , I realized that and also decided to go another route !