dsuarezv / mavlink.net

A better MavLink object generation for C#. Richer message classes are generated from the object definitions.
39 stars 35 forks source link

Udp message sending #10

Closed vitiokss closed 9 years ago

vitiokss commented 9 years ago

Hi David, First of all Thank you very much for the effort and great implementation. I have tried to find your personal contact information, but can't succeed so i just writing here.

I do have question what am i doing wrong in this case? Let's say i want to change the mode of the UAV, so i am sending the message like that. It just a small snippet from your mavlinknet-cli, where most of the examples were just getting the heartbeat data.

       mMavlinkClient = new MavLinkUdpTransport()
        {
            TargetIpAddress = targetIp,
            UdpTargetPort = targetPort, 
            UdpListeningPort = listenPort
        };

        mMavlinkClient.OnPacketReceived += mMavlinkClient_OnPacketReceived;
        mMavlinkClient.Initialize();
      UasCommandInt command = new UasCommandInt()
      {
        Command = MavCmd.DoSetMode,
        Param1 = (float)MavMode.AutoDisarmed,
        TargetComponent = mMavlinkClient.MavlinkComponentId,
        TargetSystem = mMavlinkClient.MavlinkSystemId
      };
      mMavlinkClient.SendMessage(command);

But it seems that my UAV does not take any action. Do i missing something? Can you please help a bit to understand correctly.

Moreover lets say i request for paramlist from UAV. So to get it, should i just catch all of them in the event handler mMavlinkClient_OnPacketReceived ?

Thank you very much for your answer, it would help me a lot to understand it.

dsuarezv commented 9 years ago

Hi,

SendMessage is enough to actually send the message to the UAV, so my guess is that your problem may be that you need to do more things (send more messages) to change the state.

I would recommend using the mavlinkscope sample project here to "sniff" the traffic between the ground station and the UAV to see what messages are needed to perform the action you want.

about OnPacketReceived, yes, all packets are sent to that event, so you can process them there.

Cheers!

BTBlueSkies commented 9 years ago

Are you able to get the heartbeat message? On Jan 25, 2015 4:10 PM, "David Suarez" notifications@github.com wrote:

Hi,

SendMessage is enough to actually send the message to the UAV, so my guess is that your problem may be that you need to do more things (send more messages) to change the state.

I would recommend using the mavlinkscope sample project here https://github.com/dsuarezv/mavlinkclient-cs/tree/master/mavlinkscope to "sniff" the traffic between the ground station and the UAV to see what messages are needed to perform the action you want.

about OnPacketReceived, yes, all packets are sent to that event, so you can process them there.

Cheers!

— Reply to this email directly or view it on GitHub https://github.com/dsuarezv/mavlink.net/issues/10#issuecomment-71393716.