Sub: Allow scripting to run

This commit is contained in:
Michael du Breuil 2019-02-28 23:41:05 -07:00 committed by Andrew Tridgell
parent cac4b91671
commit e8401671e3
4 changed files with 24 additions and 0 deletions

View File

@ -634,6 +634,11 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @Path: ../libraries/RC_Channel/RC_Channels_VarInfo.h
AP_SUBGROUPINFO(rc_channels, "RC", 17, ParametersG2, RC_Channels),
#ifdef ENABLE_SCRIPTING
// Scripting is intentionally not showing up in the parameter docs until it is a more standard feature
AP_SUBGROUPINFO(scripting, "SCR_", 18, ParametersG2, AP_Scripting),
#endif
AP_GROUPEND
};

View File

@ -4,6 +4,10 @@
#include <AP_Gripper/AP_Gripper.h>
#ifdef ENABLE_SCRIPTING
#include <AP_Scripting/AP_Scripting.h>
#endif
// Global parameter class.
//
class Parameters {
@ -331,6 +335,11 @@ public:
// control over servo output ranges
SRV_Channels servo_channels;
#ifdef ENABLE_SCRIPTING
AP_Scripting scripting;
#endif // ENABLE_SCRIPTING
};
extern const AP_Param::Info var_info[];

View File

@ -119,6 +119,10 @@
#include <AP_Camera/AP_Camera.h> // Photo or video camera
#endif
#ifdef ENABLE_SCRIPTING
#include <AP_Scripting/AP_Scripting.h>
#endif
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
#include <SITL/SITL.h>
#endif

View File

@ -190,6 +190,12 @@ void Sub::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
// we don't want writes to the serial port to cause us to pause
// mid-flight, so set the serial ports non-blocking once we are
// ready to fly