|
QGroundControl
Ground Control Station for MAVLink Drones
|
Simulates MAVLink Gimbal Manager Protocol for MockLink. More...
#include <MockLinkGimbal.h>
Classes | |
| struct | PitchYawCommand |
| Last MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW received (angles in degrees, rates in deg/s) More... | |
| struct | SetAttitudeCommand |
| Last GIMBAL_MANAGER_SET_ATTITUDE received (rates in deg/s) More... | |
Public Types | |
| enum class | DeltaYawMode { Legacy , Unknown , Explicit } |
| Controls how GIMBAL_DEVICE_ATTITUDE_STATUS.delta_yaw and the yaw frame flags are reported. More... | |
| enum class | InformationResponse { Accept , Nack , Silent } |
| How the manager answers MAV_CMD_REQUEST_MESSAGE(GIMBAL_MANAGER_INFORMATION) More... | |
Public Member Functions | |
| MockLinkGimbal (MockLink *mockLink, bool hasRollAxis=true, bool hasPitchAxis=true, bool hasYawAxis=true, bool hasYawFollow=true, bool hasYawLock=true, bool hasRetract=true, bool hasNeutral=true, uint8_t gimbalDeviceId=MAV_COMP_ID_GIMBAL) | |
| ~MockLinkGimbal ()=default | |
| void | run1HzTasks () |
| Send periodic gimbal status messages (call from 1Hz tasks) | |
| bool | handleMavlinkMessage (const mavlink_message_t &msg) |
| void | setAttitudeDeg (float rollDeg, float pitchDeg, float yawDeg) |
| Pins gimbal attitude (degrees) and disables the automatic oscillation. | |
| void | setDeltaYawMode (DeltaYawMode mode) |
| void | setDeltaYawDeg (float deltaYawDeg) |
| void | setYawInEarthFrame (bool earthFrame) |
| void | setPrimaryControl (uint8_t sysid, uint8_t compid) |
| Overrides who holds primary control as reported in GIMBAL_MANAGER_STATUS. | |
| void | sendGimbalDeviceAttitudeStatusNow () |
| Sends GIMBAL_DEVICE_ATTITUDE_STATUS immediately instead of waiting for the 1Hz worker. | |
| void | sendGimbalManagerStatusNow () |
| void | sendGimbalManagerInformationWithDeviceId (uint8_t deviceIdField) |
| Raw sends with protocol-violating field overrides, for exercising QGC's rejection paths. | |
| void | sendGimbalManagerStatusWithDeviceId (uint8_t deviceIdField) |
| void | sendGimbalDeviceAttitudeStatusFrom (uint8_t sourceCompid, uint8_t deviceIdField) |
| void | setInformationResponse (InformationResponse response) |
| void | setIgnoreStatusIntervalRequests (int count) |
| The first count MAV_CMD_SET_MESSAGE_INTERVAL requests for GIMBAL_MANAGER_STATUS are ACKed but not honoured. | |
| QList< int > | statusIntervalRequests () const |
| Every GIMBAL_MANAGER_STATUS interval value (us) received, in order. | |
| PitchYawCommand | lastPitchYawCommand () const |
| SetAttitudeCommand | lastSetAttitudeCommand () const |
| bool | yawLock () const |
| uint8_t | gimbalDeviceId () const |
Simulates MAVLink Gimbal Manager Protocol for MockLink.
Supports a Gimbal Manager on MAV_COMPID_AUTOPILOT1 with a single gimbal device with the id MAV_COMP_ID_GIMBAL. Gimbal attitude is simulated with a slow oscillation when not under manual control.
Gimbal capabilities are configurable via MockLink config.
Supported MAVLink messages / commands: MAV_CMD_REQUEST_MESSAGE (GIMBAL_MANAGER_INFORMATION) MAV_CMD_SET_MESSAGE_INTERVAL (GIMBAL_MANAGER_STATUS, GIMBAL_DEVICE_ATTITUDE_STATUS) MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE GIMBAL_MANAGER_SET_ATTITUDE (rate control) Periodic sending of GIMBAL_MANAGER_STATUS and GIMBAL_DEVICE_ATTITUDE_STATUS
Definition at line 27 of file MockLinkGimbal.h.
|
strong |
Controls how GIMBAL_DEVICE_ATTITUDE_STATUS.delta_yaw and the yaw frame flags are reported.
| Enumerator | |
|---|---|
| Legacy | No YAW_IN_*_FRAME flag, delta_yaw = 0 (pre-extension firmware wire image) |
| Unknown | Frame flag set, delta_yaw = NaN. |
| Explicit | Frame flag set, delta_yaw = value from setDeltaYawDeg() |
Definition at line 31 of file MockLinkGimbal.h.
|
strong |
How the manager answers MAV_CMD_REQUEST_MESSAGE(GIMBAL_MANAGER_INFORMATION)
| Enumerator | |
|---|---|
| Accept | ACK and send the message. |
| Nack | ACK with MAV_RESULT_UNSUPPORTED, no message. |
| Silent | Swallow the request, no ACK, no message. |
Definition at line 57 of file MockLinkGimbal.h.
|
explicit |
Definition at line 14 of file MockLinkGimbal.cc.
|
default |
|
inline |
Definition at line 111 of file MockLinkGimbal.h.
| bool MockLinkGimbal::handleMavlinkMessage | ( | const mavlink_message_t & | msg | ) |
Handle all incoming MAVLink messages for gimbal.
Definition at line 72 of file MockLinkGimbal.cc.
| MockLinkGimbal::PitchYawCommand MockLinkGimbal::lastPitchYawCommand | ( | ) | const |
Definition at line 466 of file MockLinkGimbal.cc.
| MockLinkGimbal::SetAttitudeCommand MockLinkGimbal::lastSetAttitudeCommand | ( | ) | const |
Definition at line 472 of file MockLinkGimbal.cc.
| void MockLinkGimbal::run1HzTasks | ( | ) |
Send periodic gimbal status messages (call from 1Hz tasks)
Definition at line 36 of file MockLinkGimbal.cc.
Referenced by MockLink::run1HzTasks().
| void MockLinkGimbal::sendGimbalDeviceAttitudeStatusFrom | ( | uint8_t | sourceCompid, |
| uint8_t | deviceIdField | ||
| ) |
Definition at line 442 of file MockLinkGimbal.cc.
| void MockLinkGimbal::sendGimbalDeviceAttitudeStatusNow | ( | ) |
Sends GIMBAL_DEVICE_ATTITUDE_STATUS immediately instead of waiting for the 1Hz worker.
Definition at line 419 of file MockLinkGimbal.cc.
| void MockLinkGimbal::sendGimbalManagerInformationWithDeviceId | ( | uint8_t | deviceIdField | ) |
Raw sends with protocol-violating field overrides, for exercising QGC's rejection paths.
Definition at line 431 of file MockLinkGimbal.cc.
| void MockLinkGimbal::sendGimbalManagerStatusNow | ( | ) |
Definition at line 425 of file MockLinkGimbal.cc.
| void MockLinkGimbal::sendGimbalManagerStatusWithDeviceId | ( | uint8_t | deviceIdField | ) |
Definition at line 436 of file MockLinkGimbal.cc.
| void MockLinkGimbal::setAttitudeDeg | ( | float | rollDeg, |
| float | pitchDeg, | ||
| float | yawDeg | ||
| ) |
Pins gimbal attitude (degrees) and disables the automatic oscillation.
Definition at line 385 of file MockLinkGimbal.cc.
| void MockLinkGimbal::setDeltaYawDeg | ( | float | deltaYawDeg | ) |
Definition at line 400 of file MockLinkGimbal.cc.
| void MockLinkGimbal::setDeltaYawMode | ( | DeltaYawMode | mode | ) |
Definition at line 394 of file MockLinkGimbal.cc.
| void MockLinkGimbal::setIgnoreStatusIntervalRequests | ( | int | count | ) |
The first count MAV_CMD_SET_MESSAGE_INTERVAL requests for GIMBAL_MANAGER_STATUS are ACKed but not honoured.
Definition at line 454 of file MockLinkGimbal.cc.
| void MockLinkGimbal::setInformationResponse | ( | InformationResponse | response | ) |
Definition at line 448 of file MockLinkGimbal.cc.
| void MockLinkGimbal::setPrimaryControl | ( | uint8_t | sysid, |
| uint8_t | compid | ||
| ) |
Overrides who holds primary control as reported in GIMBAL_MANAGER_STATUS.
Definition at line 412 of file MockLinkGimbal.cc.
| void MockLinkGimbal::setYawInEarthFrame | ( | bool | earthFrame | ) |
Reporting frame for yaw: flags carry YAW_IN_EARTH_FRAME and q encodes yaw + delta_yaw. A PITCHYAW command overrides this with its own frame flags.
Definition at line 406 of file MockLinkGimbal.cc.
| QList< int > MockLinkGimbal::statusIntervalRequests | ( | ) | const |
Every GIMBAL_MANAGER_STATUS interval value (us) received, in order.
Definition at line 460 of file MockLinkGimbal.cc.
| bool MockLinkGimbal::yawLock | ( | ) | const |
Definition at line 478 of file MockLinkGimbal.cc.