Hey,
I am trying to build a custom version of QGC where I can see the gimbal FOV on the map. As the latest Arducopter 4.6-beta version supports sending the CAMERA_FOV_STATUS messages, I need some customisation to visualise the image center lat, lng, alt onto the Map.
While going through the codes, found out that the src/Gimbal and src/FlightDisplay directories can be used to achieve this.
Modifications done so far:
File: src/Gimbal/GimbalController.h
class FovGimbal : public QObject
{
Q_OBJECT
Q_PROPERTY(uint64_t fovdata[33] READ fovdata[33] WRITE setFovdata NOTIFY fovdataChanged)
public:
explicit FovGimbal(QObject* parent = nullptr) : QObject(parent){
for (int i = 0; i < 33; i++) {
_fovdata[i] = 0; // Example data
}
}
uint64_t fovdata() const { uint64_t list[33];
for (int i = 0; i < 33; i++) {
list.append(_fovdata[i]);
}
return list; }
void setFovdata(const uint64_t newData[33]) { for (int i = 0; i < 33; i++) {
_fovdata[i] = newData[i]; }
emit fovdataChanged(); }
signals:
void fovdataChanged();
private:
uint64_t _fovdata[33];
};
File: src/Gimbal/GimbalController.cc
void
GimbalController::_mavlinkMessageReceived(const mavlink_message_t& message)
{
// Don't proceed until parameters are ready, otherwise the gimbal controller handshake
// could potentially not work due to the high traffic for parameters, mission download, etc
if (!_vehicle->parameterManager()->parametersReady() ) {
return;
}
switch (message.msgid) {
case MAVLINK_MSG_ID_HEARTBEAT:
_handleHeartbeat(message);
break;
case MAVLINK_MSG_ID_GIMBAL_MANAGER_INFORMATION:
_handleGimbalManagerInformation(message);
break;
case MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS:
_handleGimbalManagerStatus(message);
break;
case MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS:
_handleGimbalDeviceAttitudeStatus(message);
break;
// Added this case here...........//
case MAVLINK_MSG_ID_CAMERA_FOV_STATUS:
FovGimbal fovobj;
fovobj.setFovdata(message.payload64);
break;
}
}
File: src/FlightDisplay/FlyView.qml
FovGimbal {
onFovdataChanged: console.log("************ FOV DATA : ", fovdata)
}
Currently just trying to print the data from the CAMERA_FOV_STATUS message. later I will plot the polygon based on that data in the qml file.
The message.payload64 is an uint64 array.
Getting some data type compatibility errors.
Can someone guide if this is the right way? What changes do I need to do further to get it working?
Once I even managed to get it running, but could not see the console.log output. I guess the signal was not getting emitted properly.
Verified that the CAMERA_FOV_STATUS message is being sent to the GCS using MAVLINK Inspector.