Skip to content

Commit

Permalink
adding INDI custom controller
Browse files Browse the repository at this point in the history
  • Loading branch information
Astik-2002 committed May 7, 2024
1 parent 276afbb commit f062822
Show file tree
Hide file tree
Showing 5 changed files with 497 additions and 5 deletions.
8 changes: 8 additions & 0 deletions libraries/AC_CustomControl/AC_CustomControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "AC_CustomControl_Backend.h"
// #include "AC_CustomControl_Empty.h"
#include "AC_CustomControl_PID.h"
#include "AC_CustomControl_INDI.h"
#include <GCS_MAVLink/GCS.h>
#include <AP_Logger/AP_Logger.h>

Expand All @@ -33,6 +34,9 @@ const AP_Param::GroupInfo AC_CustomControl::var_info[] = {
// parameters for PID controller
AP_SUBGROUPVARPTR(_backend, "2_", 7, AC_CustomControl, _backend_var_info[1]),

// parameters for INDI controller
AP_SUBGROUPVARPTR(_backend, "3_", 8, AC_CustomControl, _backend_var_info[2]),

AP_GROUPEND
};

Expand Down Expand Up @@ -62,6 +66,10 @@ void AC_CustomControl::init(void)
_backend = new AC_CustomControl_PID(*this, _ahrs, _att_control, _motors, _dt);
_backend_var_info[get_type()] = AC_CustomControl_PID::var_info;
break;
case CustomControlType::CONT_INDI:
_backend = new AC_CustomControl_INDI(*this, _ahrs, _att_control, _motors, _dt);
_backend_var_info[get_type()] = AC_CustomControl_INDI::var_info;
break;
default:
return;
}
Expand Down
3 changes: 2 additions & 1 deletion libraries/AC_CustomControl/AC_CustomControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <AP_Motors/AP_MotorsMulticopter.h>

#ifndef CUSTOMCONTROL_MAX_TYPES
#define CUSTOMCONTROL_MAX_TYPES 2
#define CUSTOMCONTROL_MAX_TYPES 3
#endif

class AC_CustomControl_Backend;
Expand Down Expand Up @@ -49,6 +49,7 @@ class AC_CustomControl {
CONT_NONE = 0,
CONT_EMPTY = 1,
CONT_PID = 2,
CONT_INDI = 3,
}; // controller that should be used

enum class CustomControlOption {
Expand Down
Loading

0 comments on commit f062822

Please sign in to comment.