Copter: Allow scripting to run

This commit is contained in:
Michael du Breuil 2019-02-28 23:40:53 -07:00 committed by Andrew Tridgell
parent 1420ac868d
commit cac4b91671
4 changed files with 20 additions and 0 deletions

View File

@ -170,6 +170,10 @@
#include <AP_RPM/AP_RPM.h>
#endif
#ifdef ENABLE_SCRIPTING
#include <AP_Scripting/AP_Scripting.h>
#endif
// Local modules
#ifdef USER_PARAMS_ENABLED
#include "UserParameters.h"

View File

@ -929,6 +929,11 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @Path: ../libraries/AC_AutoTune/AC_AutoTune.cpp
AP_SUBGROUPPTR(autotune_ptr, "AUTOTUNE_", 29, ParametersG2, Copter::AutoTune),
#endif
#ifdef ENABLE_SCRIPTING
// Scripting is intentionally not showing up in the parameter docs until it is a more standard feature
AP_SUBGROUPINFO(scripting, "SCR_", 30, ParametersG2, AP_Scripting),
#endif
AP_GROUPEND
};

View File

@ -583,6 +583,11 @@ public:
// we need a pointer to autotune for the G2 table
void *autotune_ptr;
#endif
#ifdef ENABLE_SCRIPTING
AP_Scripting scripting;
#endif // ENABLE_SCRIPTING
};
extern const AP_Param::Info var_info[];

View File

@ -244,6 +244,12 @@ void Copter::init_ardupilot()
startup_INS_ground();
#ifdef ENABLE_SCRIPTING
if (!g2.scripting.init()) {
gcs().send_text(MAV_SEVERITY_ERROR, "Scripting failed to start");
}
#endif // ENABLE_SCRIPTING
// set landed flags
set_land_complete(true);
set_land_complete_maybe(true);