ardupilot
ardupilot copied to clipboard
AP_Scripting: applet for Plane follow on a switch
DRAFT for comment. This builds on the existing plane_guided_follow.lua example. It adds speedup/slowdown so the following vehicle can "catch up" with the target and prevents guided mode from attempting to loiter around the target vehicle when it gets close. Also adds FOLL_ACT_FN so that an RC switch can be used to trigger/exit the follow.
Note the change to GCS_Mavlink.cpp, without this one line in handle_command_int_do_reposition to set plane.guided_state.target_heading_type = GUIDED_HEADING_NONE, nothing works. With this line, like magic - follow!
Updated, but still draft. Re-written to use the new MAVLink/Lua interface in #27365
Includes a Lua module for a "PI" controller. This is basically just extracted as is from the plane_aerobatics.lua and generalized so it can be used without copying. Ideally "D" would be added.
This is a draft for comm
this needs a GCS text announcing that its been loaded, like we do in other applets
Done
libraries/AP_Scripting/applets/plane_follow.lua:152:21: value assigned to variable target_offsets is overwritten on line 153 before use
I have to call two methods on AP_Follow to get all the values I need and both of them return target_offsets. Do you think I should refactor the code in AP_Follow so I can call a single method?
The scripting checks are also reporting:
How can I run these checks myself?
How can I run these checks myself?
This should work:
apt install lua-check
./Tools/scripts/run_luacheck.sh
You can also run the new checks with:
python ./Tools/scripts/run_lua_language_check.py