From 74fb500efe4344c3629bd6bbc8cd8cbce27111ac Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Sun, 4 Aug 2013 23:20:21 +0900 Subject: [PATCH] Copter: integrate AC_Sprayer --- ArduCopter/ArduCopter.pde | 12 ++++++++++++ ArduCopter/Parameters.h | 3 ++- ArduCopter/Parameters.pde | 6 ++++++ ArduCopter/config.h | 5 +++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index 63bf112487..1093394909 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -104,6 +104,7 @@ #include // software in the loop support #include // main loop scheduler #include // RC input mapping library +#include // Crop sprayer library // AP_HAL to Arduino compatibility layer #include "compat.h" @@ -830,6 +831,13 @@ static AP_Mount camera_mount2(¤t_loc, g_gps, &ahrs, 1); AC_Fence fence(&inertial_nav); #endif +//////////////////////////////////////////////////////////////////////////////// +// Crop Sprayer +//////////////////////////////////////////////////////////////////////////////// +#if SPRAYER == ENABLED +static AC_Sprayer sprayer(&inertial_nav); +#endif + //////////////////////////////////////////////////////////////////////////////// // function definitions to keep compiler from complaining about undeclared functions //////////////////////////////////////////////////////////////////////////////// @@ -1253,6 +1261,10 @@ static void slow_loop() camera_mount2.update_mount_type(); #endif +#if SPRAYER == ENABLED + sprayer.update(); +#endif + // agmatthews - USERHOOKS #ifdef USERHOOK_SLOWLOOP USERHOOK_SLOWLOOP diff --git a/ArduCopter/Parameters.h b/ArduCopter/Parameters.h index b54caf8fae..975862995d 100644 --- a/ArduCopter/Parameters.h +++ b/ArduCopter/Parameters.h @@ -87,7 +87,8 @@ public: k_param_circle_rate, k_param_sonar_gain, k_param_ch8_option, - k_param_arming_check_enabled, // 32 + k_param_arming_check_enabled, + k_param_sprayer, // 33 // 65: AP_Limits Library k_param_limits = 65, // deprecated - remove diff --git a/ArduCopter/Parameters.pde b/ArduCopter/Parameters.pde index 8af262050a..8fe53b43cb 100644 --- a/ArduCopter/Parameters.pde +++ b/ArduCopter/Parameters.pde @@ -991,6 +991,12 @@ const AP_Param::Info var_info[] PROGMEM = { GOBJECT(camera_mount2, "MNT2_", AP_Mount), #endif +#if SPRAYER == ENABLED + // @Group: SPRAYER_ + // @Path: ../libraries/AC_Sprayer/AC_Sprayer.cpp + GOBJECT(sprayer, "SPRAY_", AC_Sprayer), +#endif + #if CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL GOBJECT(sitl, "SIM_", SITL), #endif diff --git a/ArduCopter/config.h b/ArduCopter/config.h index 4a64eb83ed..00a8edffb5 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -464,6 +464,11 @@ #define OPTFLOW_IMAX 1 #endif +////////////////////////////////////////////////////////////////////////////// +// Crop Sprayer +#ifndef SPRAYER + # define SPRAYER DISABLED +#endif ////////////////////////////////////////////////////////////////////////////// // RADIO CONFIGURATION