PX4 / jMAVSim

Simple multirotor simulator with MAVLink protocol support
BSD 3-Clause "New" or "Revised" License
82 stars 207 forks source link

"getting required buffer size failed" on jmavsim simulation on Windows 10 #86

Open copterspace opened 5 years ago

copterspace commented 5 years ago

Hello, dear friends! I derscribed problem and solution I found here: https://github.com/PX4/Firmware/issues/11030

But nobody replied me yet, I am not sure if this problem of jmavsim or PX4 Firmware, but file I corrected is in Firmware repository.

Description of the bug On Windows 10 jmavsim simulation trying to broadcast mavlink (in jmavsim console): param set MAV_BROADCAST 1 leading system to reproduce error message in endless cycle: WARN [mavlink] getting required buffer size failed

To Reproduce I need to connect external ROS system to jmavsim simulation via mavros, to write/test simple python programms for autonomous flight. I do the following steps:

Start simulator: make px4_sitl jmavsim In simulator - allow external broadcast of mavlink: param set MAV_BROADCAST 1 Start mavros on external ros machine to connect to my simulation: roslaunch mavros px4.launch fcu_url:="udp://@192.168.1.36:14557" Test the mavros connection to fcu: rostopic echo /mavros/state

On Linux Ubuntu it works OK, on 4th step I see continious mavlink heartbeat messages. But when I try to do the same on Windows 10 simulation - on step 2 I have endless cycle of messages in jmavsim console: WARN [mavlink] getting required buffer size failed This cycle restarts even when I stop and restart simulation. It ends only after I switch off MAV_BROADCAST=0 on Windows machine via QGroundControl.

Expected behavior Same good as on Linux.

Additional context It seems the problem is in https://github.com/PX4/Firmware/blob/master/src/modules/mavlink/mavlink_main.cpp , lines 1029-1046. It has an option for Mac: ifconf.ifc_len = 1024; but on Windows program thinks it runs on Linux and because of this misbehaves.

I created Pull request https://github.com/PX4/Firmware/pull/11037, but yet there was also no comments.