Servers by jDrones

Sending Rc_override from another application to mission planner, is it possible?

(a-lala) #1

I want to make an application can send RC_OVERRIDE to mission planner and I don’t know how to do it.

does mission planner has any functionality for this issue? or do I have to add it ?
Can any one help me with this issue.

(aesreal) #2

I guess a way is to try starting a python server on MissionPlanner and if there are any input from your application, it would run the RC_OVERRIDE command

(a-lala) #3

Thanks for your reply!!
I want to do the following:

  1. Making “opencv tracking object c++ application” on the GCS PC
  2. Based on the previous, output the rc_override “controlling the Quadcopter with tracking output”

Can I send the RC_OVERRIDE straight from the c++ app or I must to run the python server which I don’t know how to do it, either :sweat_smile:!

(aesreal) #4

Well, if I’m not wrong, you want to use another application (eg. c++ app) to send an RC_OVERRIDE to let MP know that it has to control the drone. Correct me if I’m wrong.

In this case, instead of just sending an RC_OVERRIDE over, you might want to try using MP’s own override functions, which can be done in either C# or Python (I did mine in Python).

So the logic would be for your app to inform that C# or Python script that you want an RC_OVERRIDE, with parameters sent from the app.

I’m not sure if you can send an RC_OVERRIDE straight from your c++ app, but if there is no other way, you could try doing the above described steps.

An example for the Python Script could be something like

import socket
import select
from thread import start_new_thread
import clr
import MissionPlanner

class Server(object):
   def __init__(self, host, port): = host
       self.port = port
       self.connections = []

       self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
       self.server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
            self.server_socket.bind((host, port))
        except socket.error as msg:

   def listen(self):

       while 1:
           read_sockets, write_sockets, error_sockets =,[],[])
           for sock in read_sockets:
               if sock == self.server_socket:
                   client, address = self.server_socket.accept()
                   self.client = client
                   start_new_thread(self.controller, ())

   def controller(self):

   def run(self):
       start_new_thread(self.listen, ())

host_name = 'localhost'
port_num = 5000
Svr = Server(host_name, port_num)

Run the above code under the “Scripts” tab which is together with the other Actions,Preflight tabs, located under Flight Data.

Then afterwards you can open a socket from your c++ app and connect to this mini Python server., send your parameters over and use MP’s Script.RC function to override the RC channels.

Hope these helps

See more:

(a-lala) #5

I appreciate your reply!!!
you got what I need. This feature is awesome. I did n’t understand it when I read about it first time, now I got it with your explanation.
OK, I’ll try use your python script code even though I’m new python programmer and I’ll make a thread in my c++ code to connect with it and send the RC values.
I’ll tell you what will happens with me!
Thanks, your help was very useful!!!