Connecting to a DJI drone using MQTT
CompletedPart 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') } })
Please sign in to leave a comment.
Comments
1 comment