Learning Lua Scripting for Copter

Hey @Yuri_Rage, I am starting the new topic here as you told me.

How can I simulate it in SITL or test in the real drone? I can assign a switch for turning off the GPS but it is turning off both GPS.

And one more thing I am using one CAN GPS & 1 M10 GPS with cube orange.
I am facing one problem, when I set the GPS_Type=9 (CAN GPS) and GPS_type=1 then my GPS2 will not detect at all. If I keep the GPS_type=1 & GPS_type=2 then my GPS2 will detect but GPS1 will not configure.

I have tried all ways arounf by setting the baud rate & GPS_type2 to ublox, nmea, etc but nothing works. It seems like at one time I can use either CAN GPS or M10 UART GPS.

Earlier when I using both GPS with 6C, they both were working fine without any issue.

You need to make sure that all unused serial ports are set to -1.

Look at the SIM_ parameters for inducing SITL faults.

1 Like

Thanks @Yuri_Rage
I tried in SITL with some small changes in the code, it is working fine. Now will test with the drone, just one thing I want to know.

Is it possible to set up lua scripting in a way that it will keep executing once the drone is ON? as it a failsafe script so I don’t want to assign it to some switch for executing.

and for the heading or yaw failsafe, currently the drone will circle around and crash badly if the compass error comes. I am planning to write a script so if the compass error increases the drone would switch to land mode instead of crashing. What is your opinion on that? I need to see whether the Land mode needs the compass.