Vehicle:get_target_location() in lua Copter

Hello !

I am trying to write a little script for a copter and I would like to access the current target location of the vehicle. I found vehicle:get_target_location() on this page and tryied it but it returns null all the time. I’ve tried it on a plane and it worked and I had the location but not in copter. Is there an equivalent for Copter ?

Here’s my script :

function update()
local next_WP = vehicle:get_target_location()
if not next_WP then
– not in a flight mode with a target location
gcs:send_text(0,“not in a flight mode with target loc”)
else
gcs:send_text(0,"target loc : " … next_WP:lat() … " ; " … next_WP:lng() )
end

return update, 1000
end

return update()

thanks in advance

Which firmware version are you using? Is it 4.5.0-dev from today? If not, please test with that version.

Hum no it was 4.4. But I just tried with current 4.5 and I still have nothing :
this is during an auto flight


and this is guided

Maybe something is wrong with my script in copter but in plane i get :
in guided


in auto

you found a bug. Report it at GitHub - ArduPilot/ardupilot: ArduPlane, ArduCopter, ArduRover, ArduSub source

1 Like