Very useful and very clear explanations. I might have to watch that short section on "LOCAL" again to get that! LOL. "Local" might mean local or it might mean local to the global scope. Nice, Lua... I have never programmed in Lua, but certainly have opportunities where I could make good use of it in the flight controllers. This is a very powerful feature of Ardupilot for sure.
Thank you for sure. When you get ANOTHER hour to devote to Lua, watch Michael’s talk. He explains the local keyword in slightly more detail, also suggesting that it’s useful in memory management as well.
Hello Yuri, I am now facing an issue programming on Lua for Arduplane, I have to say that I understand almost zero about LUA but the code is very simple, I have a servo on port 10 assigned to Script 1 (94) and I want it to move according to the arming state, so, unarmed = 1100us and Armed = 1900us. I wrote a code but I can't get it to work and I am on this for a couple os weeks already, can you help me out? Please!! Thanks The code I wrote looks like this: function beacon() if not arming:is_armed() then SRV_Channels:set_output_pwm(94, 1100) end if arming:is_armed() then SRV_Channels:set_output_pwm(94, 1900) end return beacon()
There's nothing wrong with that function (other than missing an end statement), but you need to constantly check for the arming state. Have a look at the code examples and look at the update() function that is written for most of them. It is typically called recursively on a schedule (that call looks like "return update, 250" assuming the function is scheduled to run again 250 milliseconds later). Find me on the ArduPilot Discuss forum linked in the video description if you need more help.
@@YurisHomebrewDIY I appreciate the time you spent with me but looking into examples and videos is something that I have been doing non-stop for the last 2 weeks with no results, I am not a programmer and I don't understand this, I am already getting tired of trying and nothing, I guess I will leave it away and forget this LUA thing.. this is not for me definitely. Thanks
@@nfvisuals I don't typically post code to comments here, but I hate to see you walk away frustrated over such a simple task. The following code should work for you. It isn't very elegant, and I'd write it differently, but I want you to easily understand the logic, so I used your conditional statements and wrapped them in the correct function syntax. Again, if you want more help on the subject, please start a topic at discuss.ardupilot.org/ (not an advertisement - it's just a better place to have these technical discussions). function update() if not arming:is_armed() then SRV_Channels:set_output_pwm(94, 1100) end if arming:is_armed() then SRV_Channels:set_output_pwm(94, 1900) end return update, 100 end return update()
@@YurisHomebrewDIY WOW... that one worked and there was so little to get there... thank you so much for your help... I did tried the forum a month ago and I got no help, just a guy that said that could do it but had no time, well, he spent much more time reading my post and writing the 2 answers than to write the code for me but... it is what it is... I notice that people are less and less available to help others. Thank you again Yuri.
@@nfvisuals Very glad it worked for you. Sorry your experience on the forum was lacking. I’ve noticed that the help there is sporadic sometimes as well. It’s a small community, and there is quite a hefty expectation that you’ll do your own homework before asking for help. But if you can get a little attention there, the wealth of knowledge is astounding!
Very useful and very clear explanations. I might have to watch that short section on "LOCAL" again to get that! LOL. "Local" might mean local or it might mean local to the global scope. Nice, Lua... I have never programmed in Lua, but certainly have opportunities where I could make good use of it in the flight controllers. This is a very powerful feature of Ardupilot for sure.
Thank you for sure. When you get ANOTHER hour to devote to Lua, watch Michael’s talk. He explains the local keyword in slightly more detail, also suggesting that it’s useful in memory management as well.
Great explanation! Thanks for the video!
Hi i was wondering if you could give me tips or advice on some lua scripting for mission planner as i am using it for my senior design project
How you make the sound : Arming, Parking Brake, is it coming from the flight controller?
very useful tutorial thanks !
Hello Yuri, I am now facing an issue programming on Lua for Arduplane, I have to say that I understand almost zero about LUA but the code is very simple, I have a servo on port 10 assigned to Script 1 (94) and I want it to move according to the arming state, so, unarmed = 1100us and Armed = 1900us.
I wrote a code but I can't get it to work and I am on this for a couple os weeks already, can you help me out? Please!! Thanks
The code I wrote looks like this:
function beacon()
if not arming:is_armed() then
SRV_Channels:set_output_pwm(94, 1100)
end
if arming:is_armed() then
SRV_Channels:set_output_pwm(94, 1900)
end
return beacon()
There's nothing wrong with that function (other than missing an end statement), but you need to constantly check for the arming state. Have a look at the code examples and look at the update() function that is written for most of them. It is typically called recursively on a schedule (that call looks like "return update, 250" assuming the function is scheduled to run again 250 milliseconds later).
Find me on the ArduPilot Discuss forum linked in the video description if you need more help.
@@YurisHomebrewDIY I appreciate the time you spent with me but looking into examples and videos is something that I have been doing non-stop for the last 2 weeks with no results, I am not a programmer and I don't understand this, I am already getting tired of trying and nothing, I guess I will leave it away and forget this LUA thing.. this is not for me definitely. Thanks
@@nfvisuals I don't typically post code to comments here, but I hate to see you walk away frustrated over such a simple task. The following code should work for you. It isn't very elegant, and I'd write it differently, but I want you to easily understand the logic, so I used your conditional statements and wrapped them in the correct function syntax. Again, if you want more help on the subject, please start a topic at discuss.ardupilot.org/ (not an advertisement - it's just a better place to have these technical discussions).
function update()
if not arming:is_armed() then
SRV_Channels:set_output_pwm(94, 1100)
end
if arming:is_armed() then
SRV_Channels:set_output_pwm(94, 1900)
end
return update, 100
end
return update()
@@YurisHomebrewDIY WOW... that one worked and there was so little to get there... thank you so much for your help... I did tried the forum a month ago and I got no help, just a guy that said that could do it but had no time, well, he spent much more time reading my post and writing the 2 answers than to write the code for me but... it is what it is... I notice that people are less and less available to help others. Thank you again Yuri.
@@nfvisuals Very glad it worked for you. Sorry your experience on the forum was lacking. I’ve noticed that the help there is sporadic sometimes as well. It’s a small community, and there is quite a hefty expectation that you’ll do your own homework before asking for help. But if you can get a little attention there, the wealth of knowledge is astounding!
Hi good morning, can you create a script? let me know
What is the voodoo in the mavlink messages on MP?
You have to be more specific than that. I have no idea how to answer.
@@YurisHomebrewDIY 26:10 in video, in messages box 17:24:47 voodoo
@@Tyler-qz9uc it’s just a board ID that’s generated in SITL from my computer’s host name.
@@YurisHomebrewDIY appreciate the response!
Do you have one for Px4 firmware
I’ve never used PX4.