Browse Source

Sub: Allow scripting to run

mission-4.1.18
Michael du Breuil 6 years ago committed by Andrew Tridgell
parent
commit
e8401671e3
  1. 5
      ArduSub/Parameters.cpp
  2. 9
      ArduSub/Parameters.h
  3. 4
      ArduSub/Sub.h
  4. 6
      ArduSub/system.cpp

5
ArduSub/Parameters.cpp

@ -634,6 +634,11 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = { @@ -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
};

9
ArduSub/Parameters.h

@ -4,6 +4,10 @@ @@ -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: @@ -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[];

4
ArduSub/Sub.h

@ -119,6 +119,10 @@ @@ -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

6
ArduSub/system.cpp

@ -190,6 +190,12 @@ void Sub::init_ardupilot() @@ -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

Loading…
Cancel
Save