Script to move the vehicle back

I wanted to know how much a vehicle has moved in the x and y directions, maybe yaw too, by the environment, and I want the script to detect it and move it back. I do not have an RTK setup for cm position monitoring.

What are the best LUA APIs I should use? Is ahrs:get_accel() the correct approach?

Will ahrs:get_position() be helpful in my case?

Why would the vehicle move? Ardupilot constantly tries to hold position (except for the deadband in rover/boat).

Yes, thinking of using Rover or boat.

Use ahrs:get_location()

But what is LOITER mode not doing that you wish to fix?

1 Like

Does Rover or the boat have Loiter mode? I am on a confidential project where I cannot disclose the usage. I studied all vehicle classes and deem the copter is not suitable. I narrowed it down to using a rover or a boat. If I use Loiter for a boat, I need a GPS, right?

I don’t really care about the specific use case, but I do have an interest in any possible need for improved position control, hence my question.

All Rovers can be switched to LOITER mode. It really only makes sense for the boat frame types. HOLD mode (which just stops throttle output) makes more sense for land based vehicles.

As with any position based mode, you need a position source, the most common of which is GPS.

Ya, the project need precision drift control caused by environment, normal GPS cannot produce cm level accuracy.

If I can use a boat frame with OminPlus type and lock its position without GPS, it will be perfect without needing LUA scripting.

It will be as accurate as your navigation tune and position source. You may need to use GUIDED mode if you expect to hold position and heading at the same time.

I’m not super well versed in the omni frame types. Someone else may be able to give some tips there.

1 Like

Your expertise and knowledge of all vehicles’ capability help me a lot, very much appreciated. I will discuss your ideas with the team to see if the Lua scripting can be avoided. thank you so much, @Yuri_Rage

1 Like

You can induce waves and current in SITL, which will cause boat drift. The default RTK GPS is a near perfect position source. That should give you a means to test somewhat easily.

2 Likes

Unfortunately.