JonasVautherin / px4-gazebo-headless

An unofficial Ubuntu-based container building and running PX4 SITL (Software In The Loop) through gazebo.
Apache License 2.0
95 stars 47 forks source link

Windows 11 - MAVLink traffic for UDP port not reaching QGC and MAVSDK #49

Open KarthiAru opened 4 months ago

KarthiAru commented 4 months ago

Hi,

The MAVLink traffic for UDP port 14550 (and 14540) does not seem to arrive in QGroundControl (and MAVSDK) on Windows 11 OS. I've installed Docker Desktop on Windows. I've also added two rules for incoming and outgoing connections for the UDP port in the Windows Firewall.

I tried running the following commands, but no luck.

docker run --rm -it jonasvautherin/px4-gazebo-headless:1.14.3
docker run --rm -it jonasvautherin/px4-gazebo-headless:1.14.3 10.0.2.2 10.0.2.2
docker run --rm --network host -it jonasvautherin/px4-gazebo-headless:1.14.3 127.0.0.1 127.0.0.1

Logs:

PS C:\Users\DELL> docker run --rm -it jonasvautherin/px4-gazebo-headless:1.14.3
Scanning dependencies of target gazebo_iris__empty
WARNING gazebo_iris__empty target DEPRECATED, please use gazebo-classic_iris__empty
make[5]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
[  0%] Built target parameters_xml
[  0%] Built target ver_gen
[  0%] Built target events_header
[  0%] Built target uorb_headers
[  0%] Built target flighttasks_generated
[  1%] Built target events_json
[  1%] Built target actuators_json
[  1%] Built target component_general_json
[  1%] Built target romfs_gen_files_target
[ 22%] Built target uorb_msgs
[ 22%] Built target geo
[ 22%] Built target perf
[ 22%] Built target tinybson
[ 24%] Built target work_queue
[ 24%] Built target drivers_board
[ 24%] Built target parameters
[ 25%] Built target px4_work_queue
[ 27%] Built target px4_platform
[ 27%] Built target lockstep_scheduler
[ 27%] Built target px4_daemon
[ 28%] Built target px4_layer
[ 28%] Built target adsb
[ 29%] Built target airspeed
[ 30%] Built target bezier
[ 30%] Built target hysteresis
[ 30%] Built target avoidance
[ 30%] Built target battery
[ 30%] Built target cdev
[ 30%] Built target systemlib
[ 31%] Built target uORB
[ 31%] Built target lib__cdev__test__cdev_test
[ 31%] Built target circuit_breaker
[ 31%] Built target CollisionPrevention
[ 34%] Built target controllib
[ 34%] Built target lib__controllib__controllib_test
[ 34%] Built target conversion
[ 34%] Built target drivers_accelerometer
[ 35%] Built target drivers_gyroscope
[ 35%] Built target drivers_magnetometer
[ 35%] Built target l1
[ 35%] Built target mathlib
[ 35%] Built target output_functions_header
[ 35%] Built target mixer_module
[ 35%] Built target motion_planning
[ 35%] Built target npfg
[ 35%] Built target pid
[ 35%] Built target RateControl
[ 35%] Built target rc
[ 35%] Built target lib__rc__rc_tests
[ 36%] Built target ringbuffer
[ 37%] Built target sensor_calibration
[ 37%] Built target SlewRate
[ 38%] Built target SystemIdentification
[ 38%] Built target tecs
[ 39%] Built target timesync
[ 39%] Built target tunes
[ 39%] Built target variable_length_ringbuffer
[ 39%] Built target version
[ 39%] Built target WeatherVane
[ 39%] Built target wind_estimator
[ 39%] Built target world_magnetic_model
[ 39%] Built target arch_tone_alarm
[ 39%] Built target modules__uORB__uORB_tests
[ 40%] Built target lib__work_queue__test__wqueue_test
[ 41%] Built target drivers__camera_trigger
[ 41%] Built target git_gps_devices
[ 43%] Built target drivers__gps
[ 43%] Built target message_display
[ 43%] Built target drivers__osd__msp_osd
[ 43%] Built target drivers__tone_alarm
[ 43%] Built target modules__airship_att_control
[ 43%] Built target modules__airspeed_selector
[ 43%] Built target modules__attitude_estimator_q
[ 44%] Built target modules__camera_feedback
[ 44%] Built target failure_detector
[ 44%] Built target mode_util
[ 47%] Built target health_and_arming_checks
[ 47%] Built target failsafe
[ 47%] Built target ArmAuthorization
[ 48%] Built target ArmStateMachine
[ 50%] Built target modules__commander
[ 51%] Built target ActuatorEffectiveness
[ 51%] Built target ControlAllocation
[ 52%] Built target modules__control_allocator
[ 52%] Built target modules__dataman
[ 53%] Built target EKF2Utility
[ 57%] Built target modules__ekf2
[ 58%] Built target modules__events
[ 58%] Built target FlightTask
[ 59%] Built target FlightTaskUtility
[ 59%] Built target FlightTaskAuto
[ 59%] Built target FlightTaskDescend
[ 60%] Built target FlightTaskFailsafe
[ 60%] Built target FlightTaskManualAltitude
[ 60%] Built target FlightTaskManualAltitudeSmoothVel
[ 60%] Built target FlightTaskManualAcceleration
[ 61%] Built target FlightTaskManualPosition
[ 61%] Built target FlightTaskManualPositionSmoothVel
[ 61%] Built target FlightTaskTransition
[ 62%] Built target follow_target_estimator
[ 62%] Built target FlightTaskAutoFollowTarget
[ 62%] Built target FlightTaskOrbit
[ 63%] Built target modules__flight_mode_manager
[ 63%] Built target modules__fw_att_control
[ 63%] Built target fw_autotune_attitude_control
[ 63%] Built target launchdetection
[ 63%] Built target runway_takeoff
[ 63%] Built target modules__fw_pos_control
[ 64%] Built target modules__fw_rate_control
[ 65%] Built target drivers__gimbal
[ 65%] Built target modules__gyro_calibration
[ 67%] Built target modules__gyro_fft
[ 68%] Built target modules__land_detector
[ 68%] Built target modules__landing_target_estimator
[ 69%] Built target modules__load_mon
[ 70%] Built target modules__local_position_estimator
[ 71%] Built target modules__logger
[ 71%] Built target modules__mag_bias_estimator
[ 72%] Built target module__manual_control
[ 72%] Built target git_mavlink_v2
[ 72%] Built target mavlink_c_generate_uavionix
[ 74%] Built target modules__mavlink
[ 75%] Built target mavlink_c_generate
[ 75%] Built target modules__mavlink__mavlink_tests
[ 75%] Built target AttitudeControl
[ 76%] Built target modules__mc_att_control
[ 76%] Built target mc_autotune_attitude_control
[ 77%] Built target zero_order_hover_thrust_ekf
[ 77%] Built target modules__mc_hover_thrust_estimator
[ 77%] Built target PositionControl
[ 77%] Built target Takeoff
[ 77%] Built target modules__mc_pos_control
[ 77%] Built target modules__mc_rate_control
[ 77%] Built target geofence_breach_avoidance
[ 78%] Built target mission_feasibility_checker
[ 80%] Built target modules__navigator
[ 80%] Built target modules__payload_deliverer
[ 80%] Built target modules__rc_update
[ 81%] Built target modules__replay
[ 81%] Built target modules__rover_pos_control
[ 81%] Built target data_validator
[ 81%] Built target vehicle_acceleration
[ 81%] Built target vehicle_imu
[ 82%] Built target vehicle_air_data
[ 82%] Built target vehicle_angular_velocity
[ 82%] Built target vehicle_gps_position
[ 82%] Built target vehicle_magnetometer
[ 84%] Built target vehicle_optical_flow
[ 84%] Built target modules__sensors
[ 84%] Built target modules__simulation__battery_simulator
[ 85%] Built target modules__simulation__pwm_out_sim
[ 85%] Built target modules__simulation__sensor_airspeed_sim
[ 85%] Built target modules__simulation__sensor_baro_sim
[ 85%] Built target modules__simulation__sensor_gps_sim
[ 85%] Built target modules__simulation__senosr_mag_sim
[ 86%] Built target modules__simulation__simulator_mavlink
[ 86%] Built target modules__simulation__simulator_sih
[ 87%] Built target modules__temperature_compensation
[ 87%] Built target modules__uuv_att_control
[ 87%] Built target modules__uuv_pos_control
[ 88%] Built target modules__vtol_att_control
[ 88%] Built target systemcmds__actuator_test
[ 88%] Built target systemcmds__bsondump
[ 88%] Built target systemcmds__dyn
[ 89%] Built target systemcmds__failure
[ 89%] Built target systemcmds__led_control
[ 89%] Built target systemcmds__param
[ 89%] Built target systemcmds__perf
[ 89%] Built target systemcmds__sd_bench
[ 90%] Built target systemcmds__shutdown
[ 90%] Built target systemcmds__system_time
[ 93%] Built target systemcmds__tests
[ 94%] Built target systemcmds__tests__hrt_test
[ 94%] Built target systemcmds__topic_listener
[ 94%] Built target systemcmds__tune_control
[ 94%] Built target systemcmds__uorb
[ 95%] Built target systemcmds__ver
[ 95%] Built target systemcmds__work_queue
[ 95%] Built target modules__fake_gps
[ 95%] Built target modules__fake_imu
[ 95%] Built target examples__fake_magnetometer
[ 96%] Built target examples__hello
[ 96%] Built target examples__px4_mavlink_debug
[ 96%] Built target examples__px4_simple_app
[ 96%] Built target examples__work_item
[ 97%] Built target px4
[ 98%] Built target git_sitl_gazebo-classic
[ 98%] Performing build step for 'sitl_gazebo-classic'
[  2%] Built target nav_msgs
[  5%] Built target mav_msgs
[  8%] Built target physics_msgs
[ 11%] Built target std_msgs
[ 13%] Built target klt_feature_tracker
[ 29%] Built target sensor_msgs
[ 45%] Built target models_gen
[ 48%] Built target OpticalFlow
[ 49%] Built target ForceVisual
[ 50%] Built target AdvancedLiftDragPlugin
[ 52%] Built target LiftDragPlugin
[ 55%] Built target gazebo_user_camera_plugin
[ 57%] Built target gazebo_groundtruth_plugin
[ 59%] Built target gazebo_sonar_plugin
[ 60%] Built target gazebo_lidar_plugin
[ 61%] Built target gazebo_random_velocity_plugin
[ 62%] Built target gazebo_camera_manager_plugin
[ 64%] Built target gazebo_opticalflow_mockup_plugin
[ 65%] Built target gazebo_opticalflow_plugin
[ 66%] Built target gazebo_airspeed_plugin
[ 68%] Built target gazebo_airship_dynamics_plugin
[ 70%] Built target gazebo_uuv_plugin
[ 72%] Built target gazebo_vision_plugin
[ 74%] Built target gazebo_imu_plugin
[ 75%] Built target gazebo_gimbal_controller_plugin
[ 76%] Built target gazebo_wind_plugin
[ 79%] Built target gazebo_mavlink_interface
[ 80%] Built target gazebo_motor_model
[ 82%] Built target gazebo_catapult_plugin
[ 83%] Built target gazebo_multirotor_base_plugin
[ 84%] Built target gazebo_usv_dynamics_plugin
[ 86%] Built target gazebo_magnetometer_plugin
[ 88%] Built target gazebo_barometer_plugin
[ 90%] Built target gazebo_parachute_plugin
[ 91%] Built target gazebo_pose_sniffer_plugin
[ 92%] Built target gazebo_controller_interface
[ 93%] Built target gazebo_aruco_plugin
[ 95%] Built target gazebo_drop_plugin
[ 96%] Built target gazebo_irlock_plugin
[ 97%] Built target gazebo_gst_camera_plugin
[ 98%] Built target gazebo_gps_plugin
[100%] Built target gazebo_video_stream_widget
[ 98%] No install step for 'sitl_gazebo-classic'
[ 98%] Completed 'sitl_gazebo-classic'
[100%] Built target sitl_gazebo-classic
Scanning dependencies of target gazebo-classic_iris__empty
SITL ARGS
sitl_bin: /root/Firmware/build/px4_sitl_default/bin/px4
debugger: none
model: iris
world: empty
src_path: /root/Firmware
build_path: /root/Firmware/build/px4_sitl_default
GAZEBO_PLUGIN_PATH :/root/Firmware/build/px4_sitl_default/build_gazebo-classic
GAZEBO_MODEL_PATH :/root/Firmware/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models
LD_LIBRARY_PATH :/root/Firmware/build/px4_sitl_default/build_gazebo-classic
Using: /root/Firmware/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/iris/iris.sdf
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
not running gazebo gui
SITL COMMAND: "/root/Firmware/build/px4_sitl_default/bin/px4" "/root/Firmware/build/px4_sitl_default"/etc

______  __   __    ___
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [px4] startup script: /bin/sh etc/init.d-posix/rcS 0
INFO  [init] found model autostart file as SYS_AUTOSTART=10015
INFO  [param] selected parameter default file parameters.bson
INFO  [param] selected parameter backup file parameters_backup.bson
  SYS_AUTOCONFIG: curr: 0 -> new: 1
ERROR [param] Parameter UXRCE_DDS_KEY not found.
  SYS_AUTOSTART: curr: 0 -> new: 10015
  CAL_ACC0_ID: curr: 0 -> new: 1310988
  CAL_GYRO0_ID: curr: 0 -> new: 1310988
  CAL_ACC1_ID: curr: 0 -> new: 1310996
  CAL_GYRO1_ID: curr: 0 -> new: 1310996
  CAL_ACC2_ID: curr: 0 -> new: 1311004
  CAL_GYRO2_ID: curr: 0 -> new: 1311004
  CAL_MAG0_ID: curr: 0 -> new: 197388
  CAL_MAG0_PRIO: curr: -1 -> new: 50
  CAL_MAG1_ID: curr: 0 -> new: 197644
  CAL_MAG1_PRIO: curr: -1 -> new: 50
* SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
* SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
INFO  [dataman] data manager file './dataman' size is 7866640 bytes
etc/init.d-posix/rcS: 39: [: Illegal number:
INFO  [init] PX4_SIM_HOSTNAME: localhost
INFO  [simulator_mavlink] Waiting for simulator to accept connection on TCP port 4560
INFO  [simulator_mavlink] Simulator connected on TCP port 4560.
INFO  [lockstep_scheduler] setting initial absolute time to 576000 us
INFO  [commander] LED: open /dev/led0 failed (22)
ERROR [param] Parameter UXRCE_DDS_DOM_ID not found.
etc/init.d-posix/rcS: 292: etc/init.d-posix/rcS: uxrce_dds_client: not found
INFO  [mavlink] mode: Normal, data rate: 4000000 B/s on udp port 18570 remote port 14550
INFO  [mavlink] mode: Onboard, data rate: 4000000 B/s on udp port 14580 remote port 14540
INFO  [tone_alarm] home set
INFO  [mavlink] mode: Onboard, data rate: 4000 B/s on udp port 14280 remote port 14030
INFO  [mavlink] mode: Gimbal, data rate: 400000 B/s on udp port 13030 remote port 13280
INFO  [logger] logger started (mode=all)
INFO  [logger] Start file log (type: full)
INFO  [logger] [logger] ./log/2024-06-30/07_49_58.ulg
INFO  [logger] Opened full log file: ./log/2024-06-30/07_49_58.ulg
INFO  [mavlink] MAVLink only on localhost (set param MAV_{i}_BROADCAST = 1 to enable network)
INFO  [mavlink] MAVLink only on localhost (set param MAV_{i}_BROADCAST = 1 to enable network)
INFO  [px4] Startup script returned successfully
pxh> INFO  [tone_alarm] notify negative
INFO  [commander] Ready for takeoff!
JonasVautherin commented 4 months ago

These are the tricks I was doing for the Docker VMs (Windows/macOS), but I haven't tried them in years (I work on Linux). Maybe this has changed.

Let me know if you find a way to fix this on Windows 11. A first thing you could try would be to run a simple Linux image in a docker container, check the network setup and see how you can e.g. ping the Windows host.

Also, is Docker still running in a VM on Windows? Or do they somehow leverage WSL?

KarthiAru commented 4 months ago

These are the tricks I was doing for the Docker VMs (Windows/macOS), but I haven't tried them in years (I work on Linux). Maybe this has changed.

Let me know if you find a way to fix this on Windows 11. A first thing you could try would be to run a simple Linux image in a docker container, check the network setup and see how you can e.g. ping the Windows host.

Also, is Docker still running in a VM on Windows? Or do they somehow leverage WSL?

Docker Desktop v4.31.1 (latest) uses WSL2 based engine by default. I spun up a Ubuntu container and was able to ping the host from the container. Also I was able to send and receive UDP message from the container to the host.

Sending a UDP packet from Docker container

root@docker-desktop:/# echo "Hello QGC" | nc -u 192.168.0.138 14550

Listening for UDP packet from host

PS C:\Users\karth\Documents> python test.py
received message: Hello QGC
 from ('192.168.0.138', 63447)

test.py

import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('0.0.0.0', 14550))

while True:
    data, addr = sock.recvfrom(1024)
    print("received message:", data.decode(), "from", addr)
JonasVautherin commented 4 months ago

Does this mean that 192.168.0.138 is the IP of the host from WSL? In that case did you try the following?

docker run --rm -it jonasvautherin/px4-gazebo-headless:1.14.3 192.168.0.138 192.168.0.138
Miguelmcanabal commented 1 month ago

Try downgrading to Docker Desktop 4.30.0, it worked for me