APMRover2: Allow scripting to run

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

View File

@ -703,6 +703,11 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @User: Standard
AP_GROUPINFO("BAL_PITCH_TRIM", 40, ParametersG2, bal_pitch_trim, 0),
#ifdef ENABLE_SCRIPTING
// Scripting is intentionally not showing up in the parameter docs until it is a more standard feature
AP_SUBGROUPINFO(scripting, "SCR_", 41, ParametersG2, AP_Scripting),
#endif
AP_GROUPEND
};

View File

@ -399,6 +399,11 @@ public:
// balance both pitch trim
AP_Float bal_pitch_trim;
#ifdef ENABLE_SCRIPTING
AP_Scripting scripting;
#endif // ENABLE_SCRIPTING
};
extern const AP_Param::Info var_info[];

View File

@ -81,6 +81,11 @@
#include <AP_Follow/AP_Follow.h>
#include <AP_OSD/AP_OSD.h>
#include <AP_WindVane/AP_WindVane.h>
#ifdef ENABLE_SCRIPTING
#include <AP_Scripting/AP_Scripting.h>
#endif
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
#include <SITL/SITL.h>
#endif

View File

@ -196,6 +196,12 @@ void Rover::startup_ground(void)
);
#endif
#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
// so set serial ports non-blocking once we are ready to drive
serial_manager.set_blocking_writes_all(false);