Browse Source

AP_Mount: allow users to disable yaw on 3-axis gimbals

Also fixes 3-axis gimbal support for SToRM32 serial and MAVLink gimbals
master_rangefinder
Randy Mackay 3 years ago committed by Andrew Tridgell
parent
commit
2bcb503170
  1. 2
      libraries/AP_Mount/AP_Mount_Alexmos.cpp
  2. 6
      libraries/AP_Mount/AP_Mount_Backend.h
  3. 2
      libraries/AP_Mount/AP_Mount_Gremsy.h
  4. 7
      libraries/AP_Mount/AP_Mount_SToRM32.cpp
  5. 2
      libraries/AP_Mount/AP_Mount_SToRM32.h
  6. 7
      libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp
  7. 2
      libraries/AP_Mount/AP_Mount_SToRM32_serial.h
  8. 2
      libraries/AP_Mount/AP_Mount_Servo.cpp

2
libraries/AP_Mount/AP_Mount_Alexmos.cpp

@ -99,7 +99,7 @@ void AP_Mount_Alexmos::update() @@ -99,7 +99,7 @@ void AP_Mount_Alexmos::update()
// has_pan_control - returns true if this mount can control it's pan (required for multicopters)
bool AP_Mount_Alexmos::has_pan_control() const
{
return _gimbal_3axis;
return _gimbal_3axis && yaw_range_valid();
}
// get attitude as a quaternion. returns true on success

6
libraries/AP_Mount/AP_Mount_Backend.h

@ -46,7 +46,7 @@ public: @@ -46,7 +46,7 @@ public:
// return true if healthy
virtual bool healthy() const { return true; }
// has_pan_control - returns true if this mount can control it's pan (required for multicopters)
// returns true if this mount can control its pan (required for multicopters)
virtual bool has_pan_control() const = 0;
// get mount's mode
@ -115,6 +115,10 @@ protected: @@ -115,6 +115,10 @@ protected:
bool yaw_is_ef;
};
// returns true if user has configured a valid yaw angle range
// allows user to disable yaw even on 3-axis gimbal
bool yaw_range_valid() const { return (_state._pan_angle_min < _state._pan_angle_max); }
// returns true if mavlink heartbeat should be suppressed for this gimbal (only used by Solo gimbal)
virtual bool suppress_heartbeat() const { return false; }

2
libraries/AP_Mount/AP_Mount_Gremsy.h

@ -34,7 +34,7 @@ public: @@ -34,7 +34,7 @@ public:
bool healthy() const override;
// has_pan_control
bool has_pan_control() const override { return true; }
bool has_pan_control() const override { return yaw_range_valid(); }
// handle GIMBAL_DEVICE_INFORMATION message
void handle_gimbal_device_information(const mavlink_message_t &msg) override;

7
libraries/AP_Mount/AP_Mount_SToRM32.cpp

@ -104,13 +104,6 @@ void AP_Mount_SToRM32::update() @@ -104,13 +104,6 @@ void AP_Mount_SToRM32::update()
}
}
// has_pan_control - returns true if this mount can control it's pan (required for multicopters)
bool AP_Mount_SToRM32::has_pan_control() const
{
// we do not have yaw control
return false;
}
// set_mode - sets mount's mode
void AP_Mount_SToRM32::set_mode(enum MAV_MOUNT_MODE mode)
{

2
libraries/AP_Mount/AP_Mount_SToRM32.h

@ -30,7 +30,7 @@ public: @@ -30,7 +30,7 @@ public:
void update() override;
// has_pan_control - returns true if this mount can control it's pan (required for multicopters)
bool has_pan_control() const override;
bool has_pan_control() const override { return yaw_range_valid(); }
// set_mode - sets mount's mode
void set_mode(enum MAV_MOUNT_MODE mode) override;

7
libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp

@ -133,13 +133,6 @@ void AP_Mount_SToRM32_serial::update() @@ -133,13 +133,6 @@ void AP_Mount_SToRM32_serial::update()
}
}
// has_pan_control - returns true if this mount can control it's pan (required for multicopters)
bool AP_Mount_SToRM32_serial::has_pan_control() const
{
// we do not have yaw control
return false;
}
// set_mode - sets mount's mode
void AP_Mount_SToRM32_serial::set_mode(enum MAV_MOUNT_MODE mode)
{

2
libraries/AP_Mount/AP_Mount_SToRM32_serial.h

@ -33,7 +33,7 @@ public: @@ -33,7 +33,7 @@ public:
void update() override;
// has_pan_control - returns true if this mount can control it's pan (required for multicopters)
bool has_pan_control() const override;
bool has_pan_control() const override { return yaw_range_valid(); };
// set_mode - sets mount's mode
void set_mode(enum MAV_MOUNT_MODE mode) override;

2
libraries/AP_Mount/AP_Mount_Servo.cpp

@ -117,7 +117,7 @@ void AP_Mount_Servo::update() @@ -117,7 +117,7 @@ void AP_Mount_Servo::update()
// returns true if this mount can control its pan (required for multicopters)
bool AP_Mount_Servo::has_pan_control() const
{
return SRV_Channels::function_assigned(_pan_idx);
return SRV_Channels::function_assigned(_pan_idx) && yaw_range_valid();
}
// get attitude as a quaternion. returns true on success

Loading…
Cancel
Save