Hemo200
(Hesham Hassan)
August 24, 2024, 1:10am
1
Hi. Is there any way to make the drone take off automatically and wait at a specific height using a switch like DJI drones?
Jai.GAY
(Jai GAY)
August 24, 2024, 2:20am
2
I never try before, I think lua script can do it.
I use it to set different parameters before takeoff due to different payload weight and cg.
Hemo200
(Hesham Hassan)
August 24, 2024, 2:25am
3
Thanks for your quick reply, but I have no experience with lua script.
dkemxr
(Dave)
August 24, 2024, 3:05am
4
AUTO_OPTIONS,3
Configure an Auto Mission with one Takeoff command to the altitude you want it to go to.
Switch to Auto Mode and Arm it. It will takeoff and sit at the altitude you programmed until you switch to another mode. Suggest having it at mid throttle and switch to Loiter.
1 Like
Hemo200
(Hesham Hassan)
August 24, 2024, 5:32am
5
dkemxr:
Mission
Thanks for your reply, but can this work without using the mission planner every time?
Yes, IIRC takeoff takes only altitude.
It takes off and ascends to specified altitude before continuing navigation (with takeoff only mission switching to RTL and hanging in place).
2 Likes
Jai.GAY
(Jai GAY)
August 24, 2024, 10:13am
7
Here, via lua script
https://ardupilot.org/copter/docs/common-lua-scripts.html#rc-channels-rc
https://ardupilot.org/copter/docs/common-lua-scripts.html#arming-arming
https://ardupilot.org/copter/docs/common-lua-scripts.html#vehicle-vehicle
Example
-- example of getting RC input
local scripting_rc_1 = rc:find_channel_for_option(300)
local scripting_rc_2 = rc:find_channel_for_option(301)
local flip_flop = 0
function update()
pwm1 = rc:get_pwm(1)
pwm2 = rc:get_pwm(2)
pwm3 = rc:get_pwm(3)
pwm4 = rc:get_pwm(4)
gcs:send_text(0, "RCIN 1:" .. tostring(pwm1) .. " 2:" .. tostring(pwm2).. " 3:" .. tostring(pwm3).. " 4:" .. tostring(pwm4))
-- read normalized input from designated scripting RCx_OPTION
if scripting_rc_1 then
gcs:send_text(0, "Scripting in 1:" .. tostring(scripting_rc_1:norm_input()))
end
-- read switch input from second designated scripting RCx_OPTION
if scripting_rc_2 then
This file has been truncated. show original
1 Like