Browse Source

增加AC_ZR_App,增加一些参数

release-4.2.3
zbr3550 3 years ago committed by Brown.Z
parent
commit
8eb68e5b79
  1. 3
      ArduCopter/Copter.h
  2. 2
      ArduCopter/Parameters.cpp
  3. 1
      ArduCopter/Parameters.h
  4. 1
      ArduCopter/wscript
  5. 2
      just_build.sh
  6. 51
      libraries/AC_ZR_APP/AC_ZR_App.cpp
  7. 48
      libraries/AC_ZR_APP/AC_ZR_App.h

3
ArduCopter/Copter.h

@ -70,6 +70,8 @@
#include <AP_ADSB/AP_ADSB.h> // ADS-B RF based collision avoidance module library #include <AP_ADSB/AP_ADSB.h> // ADS-B RF based collision avoidance module library
#include <AP_Proximity/AP_Proximity.h> // ArduPilot proximity sensor library #include <AP_Proximity/AP_Proximity.h> // ArduPilot proximity sensor library
#include <AC_ZR_APP/AC_ZR_App.h>
// Configuration // Configuration
#include "defines.h" #include "defines.h"
#include "config.h" #include "config.h"
@ -993,6 +995,7 @@ private:
Mode *mode_from_mode_num(const Mode::Number mode); Mode *mode_from_mode_num(const Mode::Number mode);
void exit_mode(Mode *&old_flightmode, Mode *&new_flightmode); void exit_mode(Mode *&old_flightmode, Mode *&new_flightmode);
AC_ZR_App zr_app;
public: public:
void failsafe_check(); // failsafe.cpp void failsafe_check(); // failsafe.cpp
}; };

2
ArduCopter/Parameters.cpp

@ -734,6 +734,8 @@ const AP_Param::Info Copter::var_info[] = {
// @Path: Parameters.cpp // @Path: Parameters.cpp
GOBJECT(g2, "", ParametersG2), GOBJECT(g2, "", ParametersG2),
GOBJECT(zr_app, "ZR", AC_ZR_App),
// @Group: // @Group:
// @Path: ../libraries/AP_Vehicle/AP_Vehicle.cpp // @Path: ../libraries/AP_Vehicle/AP_Vehicle.cpp
{ AP_PARAM_GROUP, "", Parameters::k_param_vehicle, (const void *)&copter, {group_info : AP_Vehicle::var_info} }, { AP_PARAM_GROUP, "", Parameters::k_param_vehicle, (const void *)&copter, {group_info : AP_Vehicle::var_info} },

1
ArduCopter/Parameters.h

@ -376,6 +376,7 @@ public:
// 254,255: reserved // 254,255: reserved
k_param_vehicle = 257, // vehicle common block of parameters k_param_vehicle = 257, // vehicle common block of parameters
k_param_zr_app = 258, // 253 - Logging Group
// the k_param_* space is 9-bits in size // the k_param_* space is 9-bits in size
// 511: reserved // 511: reserved

1
ArduCopter/wscript

@ -31,6 +31,7 @@ def build(bld):
'AP_OSD', 'AP_OSD',
'AC_AutoTune', 'AC_AutoTune',
'AP_KDECAN', 'AP_KDECAN',
'AC_ZR_APP',
], ],
) )

2
just_build.sh

@ -0,0 +1,2 @@
./waf configure --board Pixhawk4
./waf copter

51
libraries/AC_ZR_APP/AC_ZR_App.cpp

@ -0,0 +1,51 @@
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AC_ZR_App.h"
AC_ZR_App *AC_ZR_App::_singleton;
// table of user settable parameters
const AP_Param::GroupInfo AC_ZR_App::var_info[] = {
// @Param: _TYPE
// @DisplayName: 1st GPS type
// @Description: GPS type of 1st GPS
// @Values: 0:None,1:AUTO,2:uBlox,3:MTK,4:MTK19,5:NMEA,6:SiRF,7:HIL,8:SwiftNav,9:UAVCAN,10:SBF,11:GSOF,13:ERB,14:MAV,15:NOVA,16:HemisphereNMEA,17:uBlox-MovingBaseline-Base,18:uBlox-MovingBaseline-Rover,19:MSP,20:AllyStar,21:ExternalAHRS
// @RebootRequired: True
// @User: Advanced
AP_GROUPINFO("_TYPE", 0, AC_ZR_App, _type, 1),
AP_GROUPINFO("_ID_TYPE", 1, AC_ZR_App, sysid_type, 0 ),
AP_GROUPINFO("_ID_BOARD_ID", 2, AC_ZR_App, sysid_board_id, 100),
AP_GROUPINFO("_ID_DL1", 3, AC_ZR_App, sysid_dl1, 0x8175),
AP_GROUPINFO("_ID_DL2", 4, AC_ZR_App, sysid_dl2, 0x6fda),
AP_GROUPINFO("_ID_DL3", 5, AC_ZR_App, sysid_dl3, 0xf38f),
AP_GROUPINFO("_ID_DL4", 6, AC_ZR_App, sysid_dl4, 0xbf48),
AP_GROUPEND
};
// constructor
AC_ZR_App::AC_ZR_App()
{
AP_Param::setup_object_defaults(this, var_info);
if (_singleton != nullptr) {
AP_HAL::panic("AC_ZR_App must be singleton");
}
_singleton = this;
}

48
libraries/AC_ZR_APP/AC_ZR_App.h

@ -0,0 +1,48 @@
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <AP_HAL/AP_HAL.h>
#include <AP_Param/AP_Param.h>
class AC_ZR_App
{
public:
AC_ZR_App();
/* Do not allow copies */
AC_ZR_App(const AC_ZR_App &other) = delete;
AC_ZR_App &operator=(const AC_ZR_App&) = delete;
static AC_ZR_App *get_singleton() {
return _singleton;
}
static const struct AP_Param::GroupInfo var_info[];
protected:
AP_Int8 _type;
AP_Int8 sysid_type; // modify by @Brown
AP_Int32 sysid_board_id;
AP_Int32 sysid_dl1;
AP_Int32 sysid_dl2;
AP_Int32 sysid_dl3;
AP_Int32 sysid_dl4;
private:
static AC_ZR_App *_singleton;
void get_deadline_params(int32_t &deadline);
};
Loading…
Cancel
Save