Part of the open source project that connects to a drone for flight planning and taking images connects to a drone using the mosquitto library using js. They tested their app using a DJI Phantom 4 Pro as indicated in the code snippet below. My question is how do I find the specific topic to include in the client.subscribe as a parameter in this case it was 'camera/dji.phantom.4.pro.hawk.1'. I tried searching the dji sdk online but I cant seem to find any information. My end goal is to make the functions connect to an arbitrary drone that is SDK ready
// Drone Position
var drone_general_longtitute = 0;
var drone_general_latitude = 0;
var points_two = [];
client.on('connect', function() {
console.log('MQTT SERVER SUCCESSFULLY CONNECTED');
jQuery('#communication_server').removeClass('offline');
jQuery('#communication_server').addClass('online');
client.subscribe('telemetry/dji.phantom.4.pro.hawk.1', function(err) {
if (!err) {
client.publish('presence', 'Hello mqtt')
} else {
console.log(err);
}
})
client.subscribe('camera/dji.phantom.4.pro.hawk.1', function(err) {
if (!err) {
client.publish('presence', 'Hello mqtt')
}
})
client.subscribe('missionStatus/dji.phantom.4.pro.hawk.1', function(err) {
if (!err) {
client.publish('presence', 'Hello mqtt')
}
})
client.subscribe('missionStart/dji.phantom.4.pro.hawk.1', function(err) {
if (!err) {
client.publish('presence', 'Hello mqtt')
}
})
You talk to the author and ask them to document what topics they are using.
You can use wildcard topic patterns to subscribe to all messages, e.g
telemetry/#will get you all the topics that start withtelemtry/but you will still probably need the code author to document the payload of the messages so you can make use of them.