Hi everyone, I’m a new MAVSDK user. I have to program both sides - the ground station, AND the drone simulator (using a third party component to do all drone dynamics, and providing my own mavlink communication module to allow communication with the ground station module that is using MAVSDK).
While succeeding in discovering the drone system on the MAVSDK side, I’m not able to get any comm from the ground station at the drone side.
MAVSDK listens to UDP port 14540, and currently the drone side listens to UDP port 14580 (I tried several. none worked). All is done on the same PC (Windows 10), using localhost 127.0.0.1
Which UDP port shall I use on the drone side? Which UDP port does MAVSDK send commands to? Can this be configured?
Sorry if this sounds too trivial or attests to my ignorance on the subject.
Help is appreciated. Thanks!
If you are using an already established ground station such as QGroundControl then your MAVSDK should start a connection on udp://:14550 port. On the other hand if you are trying to connect your drone to a custom ground station then you could use any free udp port you desire. You just have to make sure that MAVSDK establishes connection, for example in python it is done by using
await self.drone.connect(system_address="udp://:[desired port]"). Also on the drone/simulator side you need to start mavlink message transmission by specifying the port (for example:127.0.0.1:14580) and the baud rate.
I hope this helps
Thanks, Tahir for your reply.I’m using C++. For connection I use the following line of code -
tried also “udp://:14540”
This returns ConnectionResult::Success
To the best of my knowledge, this is what allows me to get messages from the drone (that transmits to udp port 14540).
Is there another connection I should be making to connect to the receiving port on the simulator end (14580)? How does MAVSDK on my custom ground station know which udp port it should send command to?
OK, figured this out. I needed only one socket for two way communication.