Rover: move gripper up to AP_Vehicle

also make the singleton return a reference rather than a pointer
This commit is contained in:
Peter Barker 2024-02-21 17:40:36 +11:00 committed by Peter Barker
parent ccc9231c67
commit c26bb2b33b
4 changed files with 18 additions and 20 deletions

View File

@ -1,5 +1,7 @@
#include "Rover.h"
#include <AP_Gripper/AP_Gripper.h>
/*
Rover parameter definitions
*/
@ -580,11 +582,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @User: Standard
AP_GROUPINFO("MIS_DONE_BEHAVE", 38, ParametersG2, mis_done_behave, 0),
#if AP_GRIPPER_ENABLED
// @Group: GRIP_
// @Path: ../libraries/AP_Gripper/AP_Gripper.cpp
AP_SUBGROUPINFO(gripper, "GRIP_", 39, ParametersG2, AP_Gripper),
#endif
// 39 was AP_Gripper
// @Param: BAL_PITCH_TRIM
// @DisplayName: Balance Bot pitch trim angle
@ -923,6 +921,21 @@ void Rover::load_parameters(void)
}
#endif
// PARAMETER_CONVERSION - Added: Feb-2024 for Copter-4.6
#if AP_GRIPPER_ENABLED
{
// Find G2's Top Level Key
AP_Param::ConversionInfo gripper_info;
if (!AP_Param::find_top_level_key_by_pointer(&g2, gripper_info.old_key)) {
return;
}
const uint16_t gripper_old_index = 39; // Old parameter index in g2
const uint16_t gripper_old_top_element = 4071; // Old group element in the tree for the first subgroup element (see AP_PARAM_KEY_DUMP)
AP_Param::convert_class(gripper_info.old_key, &gripper, gripper.var_info, gripper_old_index, gripper_old_top_element, false);
}
#endif
// PARAMETER_CONVERSION - Added: Feb-2024 for Rover-4.6
#if HAL_LOGGING_ENABLED
AP_Param::convert_class(g.k_param_logger, &logger, logger.var_info, 0, 0, true);

View File

@ -8,7 +8,6 @@
#include <AP_AIS/AP_AIS.h>
#include <AP_Beacon/AP_Beacon.h>
#include <AP_Follow/AP_Follow.h>
#include "AP_Gripper/AP_Gripper.h"
#include <AP_Proximity/AP_Proximity.h>
#include "AP_Rally.h"
#include <AP_SmartRTL/AP_SmartRTL.h>
@ -372,10 +371,6 @@ public:
AC_Sprayer sprayer;
#endif
#if AP_GRIPPER_ENABLED
AP_Gripper gripper;
#endif
#if HAL_RALLY_ENABLED
// Rally point library
AP_Rally_Rover rally;

View File

@ -35,8 +35,6 @@
#include "version.h"
#undef FORCE_VERSION_H_INCLUDE
#include "AP_Gripper/AP_Gripper.h"
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
#define SCHED_TASK(func, _interval_ticks, _max_time_micros, _priority) SCHED_TASK_CLASS(Rover, &rover, func, _interval_ticks, _max_time_micros, _priority)
@ -101,9 +99,6 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = {
#if AP_SERVORELAYEVENTS_ENABLED
SCHED_TASK_CLASS(AP_ServoRelayEvents, &rover.ServoRelayEvents, update_events, 50, 200, 66),
#endif
#if AP_GRIPPER_ENABLED
SCHED_TASK_CLASS(AP_Gripper, &rover.g2.gripper, update, 10, 75, 69),
#endif
#if AC_PRECLAND_ENABLED
SCHED_TASK(update_precland, 400, 50, 70),
#endif

View File

@ -14,11 +14,6 @@ static void failsafe_check_static()
void Rover::init_ardupilot()
{
// init gripper
#if AP_GRIPPER_ENABLED
g2.gripper.init();
#endif
// initialise notify system
notify.init();
notify_mode(control_mode);