Setting the homepoint and EKF Origin via script?

Hello,

I´m not sure if my question will fit in this sub category, if it is the wrong one, pls move it.

We have build a rover for inspection applications. We use the Pixhawk Orange with the latest firmware and Encoder motors.

The telemetry works, we can see the distance to home etc.

What I would like to have is an easy option for the customer to set the home point and EKF Origin via Herelink. So far we need to go via Mission Planner and set this.

Would there be a way, to do this via a script and press of a button on the herelink controller?

I think this can be achieved via LUA scripting.
Take a look at below examples.

1 Like

I agree with @Mustafa_Gokce that this should be possible with a lua script. Remember the EKF origin can only be set once but home can be set as many times as you’d like.

1 Like

Yes, it works very well. Even GPS coordinates don’t need to be the real ones; they need just to be correct ‘relative’. I suppose that Guided mode works but I have pending to try it. I wonder if the compass is strictly necessary.

What I couldn’t make work is rotation (ATT.DesYaw=0).

Thank you for the feedback @Mustafa_Gokce and @rmackay9 , the script works fine for setting EKF and Home. But could not get the one working with RC channel, but I need to mention, that I do not have any experience with LUA scripts and I´m just happy I got the first one working :wink:

Just one question, the wiki says:

https://ardupilot.org/copter/docs/common-lua-scripts.html

Can I assign here also a RC channel to a script? So if the rover starts, the scripts starts and if I switch the channel it will run the script again?

@Christian81,

No, but a script can monitor an RC channel and then do something.

@rmackay9

Thank you for the info. I tried it again with RCIN script, but could not get it to work. Would anyone have an idea how the script should look like, that will run the AHRS script again, if the RC channel is used?