Skip to content

Commit

Permalink
AP_Mount: integrate topotek gimbal driver
Browse files Browse the repository at this point in the history
Co-authored-by: Randy Mackay <[email protected]>
  • Loading branch information
laozhou-fujian and rmackay9 committed Jul 4, 2024
1 parent ad9652c commit 78415cf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions libraries/AP_Mount/AP_Mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "AP_Mount_Scripting.h"
#include "AP_Mount_Xacti.h"
#include "AP_Mount_Viewpro.h"
#include "AP_Mount_Topotek.h"
#include <stdio.h>
#include <AP_Math/location.h>
#include <SRV_Channel/SRV_Channel.h>
Expand Down Expand Up @@ -156,6 +157,14 @@ void AP_Mount::init()
serial_instance++;
break;
#endif // HAL_MOUNT_VIEWPRO_ENABLED

#if HAL_MOUNT_TOPOTEK_ENABLED
// check for Topotek gimbal
case Type::Topotek:
_backends[instance] = NEW_NOTHROW AP_Mount_Topotek(*this, _params[instance], instance, serial_instance);
_num_instances++;
break;
#endif // HAL_MOUNT_TOPOTEK_ENABLED
}

// init new instance
Expand Down
5 changes: 5 additions & 0 deletions libraries/AP_Mount/AP_Mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class AP_Mount_Siyi;
class AP_Mount_Scripting;
class AP_Mount_Xacti;
class AP_Mount_Viewpro;
class AP_Mount_Topotek;

/*
This is a workaround to allow the MAVLink backend access to the
Expand All @@ -67,6 +68,7 @@ class AP_Mount
friend class AP_Mount_Scripting;
friend class AP_Mount_Xacti;
friend class AP_Mount_Viewpro;
friend class AP_Mount_Topotek;

public:
AP_Mount();
Expand Down Expand Up @@ -114,6 +116,9 @@ class AP_Mount
#endif
#if HAL_MOUNT_VIEWPRO_ENABLED
Viewpro = 11, /// Viewpro gimbal using a custom serial protocol
#endif
#if HAL_MOUNT_TOPOTEK_ENABLED
Topotek = 12, /// Topotek gimbal using a custom serial protocol
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_Mount/AP_Mount_Params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const AP_Param::GroupInfo AP_Mount_Params::var_info[] = {
// @Param: _TYPE
// @DisplayName: Mount Type
// @Description: Mount Type
// @Values: 0:None, 1:Servo, 2:3DR Solo, 3:Alexmos Serial, 4:SToRM32 MAVLink, 5:SToRM32 Serial, 6:Gremsy, 7:BrushlessPWM, 8:Siyi, 9:Scripting, 10:Xacti, 11:Viewpro
// @Values: 0:None, 1:Servo, 2:3DR Solo, 3:Alexmos Serial, 4:SToRM32 MAVLink, 5:SToRM32 Serial, 6:Gremsy, 7:BrushlessPWM, 8:Siyi, 9:Scripting, 10:Xacti, 11:Viewpro, 12:Topotek
// @RebootRequired: True
// @User: Standard
AP_GROUPINFO_FLAGS("_TYPE", 1, AP_Mount_Params, type, 0, AP_PARAM_FLAG_ENABLE),
Expand Down
4 changes: 4 additions & 0 deletions libraries/AP_Mount/AP_Mount_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
#define AP_MOUNT_POI_TO_LATLONALT_ENABLED HAL_MOUNT_ENABLED && AP_TERRAIN_AVAILABLE && BOARD_FLASH_SIZE > 1024
#endif

#ifndef HAL_MOUNT_TOPOTEK_ENABLED
#define HAL_MOUNT_TOPOTEK_ENABLED AP_MOUNT_BACKEND_DEFAULT_ENABLED
#endif

// set camera source is supported on gimbals that may have more than one lens
#ifndef HAL_MOUNT_SET_CAMERA_SOURCE_ENABLED
#define HAL_MOUNT_SET_CAMERA_SOURCE_ENABLED HAL_MOUNT_SIYI_ENABLED || HAL_MOUNT_XACTI_ENABLED || HAL_MOUNT_VIEWPRO_ENABLED
Expand Down

0 comments on commit 78415cf

Please sign in to comment.