Is it possible to send a new vehicle state value through the lua script?

Hello everyone, I’m having same doubts: it is possible to send take a position (for example) manipulate it to the point of getting a new position and send it back as a target position?

  1. I know that it is possible to get a vehicle state contained in the code ( for example print_angles_rates through the ahrs:get_roll function) , but can I send it back to the code? What I mean is, do I want to get my vehicle’s position (the x, y, and z in meters), manipulate that position, and send it back to the code?

  2. Does get_position() function give me this X, Y and Z position or a lat , lon and alt? What I want is the position in relation to the vehicle. I’m looking in the documentation and here but I find other functions that are supposed to be for position, like get_location, and I don’t understand if it returns a coordinate or a value in meters.

Can anyone guide me regarding these issues?

Thank you all!

AHRS:get_position() is just an alias for AHRS:get_location() and returns a Location object containing latitude, longitude, and elevation/altitude.

You can get a Vector3f object (in meters) from the following AHRS bindings that should be self-explanatory:

Use GUIDED mode and the vehicle:set_target_pos_NED() binding to accomplish the rest.

Ok, thanks for help, Yuri!!