Skip to content

Commit

Permalink
wip4
Browse files Browse the repository at this point in the history
  • Loading branch information
Hwurzburg committed Oct 18, 2024
1 parent 0e2abb2 commit e0a0809
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions libraries/AP_Mount/AP_Mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ class AP_Mount
// this operation requires 60us on a Pixhawk/PX4
void set_mode_to_default() { set_mode_to_default(_primary); }
void set_mode_to_default(uint8_t instance);

//set operating mode, not to be confused with modes like retracted,usually axis locking modes
void set_mount_mode(uint8_t mount_lock_mode);

// set yaw_lock used in RC_TARGETING mode. If true, the gimbal's yaw target is maintained in earth-frame meaning it will lock onto an earth-frame heading (e.g. North)
// If false (aka "follow") the gimbal's yaw is maintained in body-frame meaning it will rotate with the vehicle
Expand Down
4 changes: 4 additions & 0 deletions libraries/AP_Mount/AP_Mount_Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ class AP_Mount_Backend
// set yaw_lock used in RC_TARGETING mode. If true, the gimbal's yaw target is maintained in earth-frame meaning it will lock onto an earth-frame heading (e.g. North)
// If false (aka "follow") the gimbal's yaw is maintained in body-frame meaning it will rotate with the vehicle
void set_yaw_lock(bool yaw_lock) { _yaw_lock = yaw_lock; }

//set operating mode, not to be confused with modes like retracted,usually axis locking modes
void set_mount_mode( uint8_t mount_lock_mode) { _mount_lock_mode = mount_lock_mode; } ;
uint8_t _mount_lock_mode;

// set angle target in degrees
// roll and pitch are in earth-frame
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_Mount/AP_Mount_CADDX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void AP_Mount_CADDX::send_target_angles(const MountTarget& angle_target_rad)

//todo: add mode here
cmd_set_angles_data.mode = GIMBAL_MODE_TILT_ROLL_LOCK;
cmd_set_angles_data.mode = mount_lock_mode;
cmd_set_angles_data.mode = _mount_lock_mode;

// CRC here
uint16_t crc16 = 0;
Expand Down
4 changes: 0 additions & 4 deletions libraries/AP_Mount/AP_Mount_CADDX.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ class AP_Mount_CADDX : public AP_Mount_Backend_Serial
// has_pitch_control - returns true if this mount can control its tilt
bool has_pitch_control() const override { return pitch_range_valid(); };

void set_mount_mode(const uint8_t mount_lock_mode);

uint8_t mount_lock_mode;


protected:

Expand Down
6 changes: 3 additions & 3 deletions libraries/RC_Channel/RC_Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1759,13 +1759,13 @@ bool RC_Channel::do_aux_function(const AUX_FUNC ch_option, const AuxSwitchPos ch
}
switch (ch_flag) {
case AuxSwitchPos::LOW:
// nothing
mount->set_mount_mode(0);
break;
case AuxSwitchPos::MIDDLE:
// nothing
// mount->set_mount_mode(1);
break;
case AuxSwitchPos::HIGH:
//nothing
// mount->set_mount_mode(2);
break;
}
break;
Expand Down

0 comments on commit e0a0809

Please sign in to comment.