Browse Source

Sub: make mount/gimbal inclusion configurable per-board

c415-sdk
Andy Piper 5 years ago committed by Andrew Tridgell
parent
commit
07df203d19
  1. 4
      ArduSub/ArduSub.cpp
  2. 2
      ArduSub/Parameters.cpp
  3. 2
      ArduSub/Sub.h
  4. 2
      ArduSub/commands_logic.cpp
  5. 8
      ArduSub/config.h
  6. 8
      ArduSub/control_auto.cpp
  7. 4
      ArduSub/flight_mode.cpp
  8. 2
      ArduSub/joystick.cpp
  9. 2
      ArduSub/system.cpp

4
ArduSub/ArduSub.cpp

@ -43,7 +43,7 @@ const AP_Scheduler::Task Sub::scheduler_tasks[] = {
#if AC_FENCE == ENABLED #if AC_FENCE == ENABLED
SCHED_TASK_CLASS(AC_Fence, &sub.fence, update, 10, 100), SCHED_TASK_CLASS(AC_Fence, &sub.fence, update, 10, 100),
#endif #endif
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
SCHED_TASK_CLASS(AP_Mount, &sub.camera_mount, update, 50, 75), SCHED_TASK_CLASS(AP_Mount, &sub.camera_mount, update, 50, 75),
#endif #endif
#if CAMERA == ENABLED #if CAMERA == ENABLED
@ -126,7 +126,7 @@ void Sub::fast_loop()
// check if we've reached the surface or bottom // check if we've reached the surface or bottom
update_surface_and_bottom_detector(); update_surface_and_bottom_detector();
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
// camera mount's fast update // camera mount's fast update
camera_mount.update_fast(); camera_mount.update_fast();
#endif #endif

2
ArduSub/Parameters.cpp

@ -468,7 +468,7 @@ const AP_Param::Info Sub::var_info[] = {
// @Path: ../libraries/AP_AHRS/AP_AHRS.cpp // @Path: ../libraries/AP_AHRS/AP_AHRS.cpp
GOBJECT(ahrs, "AHRS_", AP_AHRS), GOBJECT(ahrs, "AHRS_", AP_AHRS),
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
// @Group: MNT // @Group: MNT
// @Path: ../libraries/AP_Mount/AP_Mount.cpp // @Path: ../libraries/AP_Mount/AP_Mount.cpp
GOBJECT(camera_mount, "MNT", AP_Mount), GOBJECT(camera_mount, "MNT", AP_Mount),

2
ArduSub/Sub.h

@ -359,7 +359,7 @@ private:
#endif #endif
// Camera/Antenna mount tracking and stabilisation stuff // Camera/Antenna mount tracking and stabilisation stuff
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
AP_Mount camera_mount; AP_Mount camera_mount;
#endif #endif

2
ArduSub/commands_logic.cpp

@ -789,7 +789,7 @@ void Sub::do_roi(const AP_Mission::Mission_Command& cmd)
// point the camera to a specified angle // point the camera to a specified angle
void Sub::do_mount_control(const AP_Mission::Mission_Command& cmd) void Sub::do_mount_control(const AP_Mission::Mission_Command& cmd)
{ {
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
camera_mount.set_angle_targets(cmd.content.mount_control.roll, cmd.content.mount_control.pitch, cmd.content.mount_control.yaw); camera_mount.set_angle_targets(cmd.content.mount_control.roll, cmd.content.mount_control.pitch, cmd.content.mount_control.yaw);
#endif #endif
} }

8
ArduSub/config.h

@ -138,14 +138,6 @@
# define CAMERA DISABLED # define CAMERA DISABLED
#endif #endif
//////////////////////////////////////////////////////////////////////////////
// MOUNT (ANTENNA OR CAMERA)
//
#ifndef MOUNT
# define MOUNT ENABLED
#endif
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Flight mode definitions // Flight mode definitions
// //

8
ArduSub/control_auto.cpp

@ -536,14 +536,14 @@ void Sub::set_auto_yaw_roi(const Location &roi_location)
if (roi_location.alt == 0 && roi_location.lat == 0 && roi_location.lng == 0) { if (roi_location.alt == 0 && roi_location.lat == 0 && roi_location.lng == 0) {
// set auto yaw mode back to default assuming the active command is a waypoint command. A more sophisticated method is required to ensure we return to the proper yaw control for the active command // set auto yaw mode back to default assuming the active command is a waypoint command. A more sophisticated method is required to ensure we return to the proper yaw control for the active command
set_auto_yaw_mode(get_default_auto_yaw_mode(false)); set_auto_yaw_mode(get_default_auto_yaw_mode(false));
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
// switch off the camera tracking if enabled // switch off the camera tracking if enabled
if (camera_mount.get_mode() == MAV_MOUNT_MODE_GPS_POINT) { if (camera_mount.get_mode() == MAV_MOUNT_MODE_GPS_POINT) {
camera_mount.set_mode_to_default(); camera_mount.set_mode_to_default();
} }
#endif // MOUNT == ENABLED #endif // HAL_MOUNT_ENABLED
} else { } else {
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
// check if mount type requires us to rotate the quad // check if mount type requires us to rotate the quad
if (!camera_mount.has_pan_control()) { if (!camera_mount.has_pan_control()) {
roi_WP = pv_location_to_vector(roi_location); roi_WP = pv_location_to_vector(roi_location);
@ -562,7 +562,7 @@ void Sub::set_auto_yaw_roi(const Location &roi_location)
// if we have no camera mount aim the quad at the location // if we have no camera mount aim the quad at the location
roi_WP = pv_location_to_vector(roi_location); roi_WP = pv_location_to_vector(roi_location);
set_auto_yaw_mode(AUTO_YAW_ROI); set_auto_yaw_mode(AUTO_YAW_ROI);
#endif // MOUNT == ENABLED #endif // HAL_MOUNT_ENABLED
} }
} }

4
ArduSub/flight_mode.cpp

@ -165,9 +165,9 @@ void Sub::exit_mode(control_mode_t old_control_mode, control_mode_t new_control_
if (mission.state() == AP_Mission::MISSION_RUNNING) { if (mission.state() == AP_Mission::MISSION_RUNNING) {
mission.stop(); mission.stop();
} }
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
camera_mount.set_mode_to_default(); camera_mount.set_mode_to_default();
#endif // MOUNT == ENABLED #endif // HAL_MOUNT_ENABLED
} }
} }

2
ArduSub/joystick.cpp

@ -182,7 +182,7 @@ void Sub::handle_jsbutton_press(uint8_t _button, bool shift, bool held)
break; break;
case JSButton::button_function_t::k_mount_center: case JSButton::button_function_t::k_mount_center:
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
camera_mount.set_angle_targets(0, 0, 0); camera_mount.set_angle_targets(0, 0, 0);
// for some reason the call to set_angle_targets changes the mode to mavlink targeting! // for some reason the call to set_angle_targets changes the mode to mavlink targeting!
camera_mount.set_mode(MAV_MOUNT_MODE_RC_TARGETING); camera_mount.set_mode(MAV_MOUNT_MODE_RC_TARGETING);

2
ArduSub/system.cpp

@ -100,7 +100,7 @@ void Sub::init_ardupilot()
init_optflow(); init_optflow();
#endif #endif
#if MOUNT == ENABLED #if HAL_MOUNT_ENABLED
// initialise camera mount // initialise camera mount
camera_mount.init(); camera_mount.init();
// This step ncessary so the servo is properly initialized // This step ncessary so the servo is properly initialized

Loading…
Cancel
Save