good afternoon all,
I have been trying to enable vtol transition in my hitl simulation for almost 2 weeks now. Any help would be appreciated.
Issue: when attempting to force fixed wing transition, the following pops up:
needless to say, when doing autonomy, the vehicle just takes off in multicopter mode and stays hovering, without transitioning to fixed wing mode.
Details:
-
Hardware and setup:
I am on voxl2 by modal ai. It is running px4 v1.14.0. Specifically, this custom fork from modalai. Gazebo classic docker container is provided by modal ai as well. The raw code is here. I am trying to enable standard_vtol_hitl model for simulation. -
Attempted solutions:
I have had quite a few things to set up since voxl2 does not inherently support vtol hitl sim. i will outline all the steps I have taken for completion sake.
- enabled missing vtol modules in .px4board file:
CONFIG_PLATFORM_QURT=y
CONFIG_BOARD_TOOLCHAIN="qurt"
CONFIG_BOARD_ROOTFSDIR="/"
CONFIG_MODULES_MUORB_SLPI=y
CONFIG_SYSTEMCMDS_UORB=y
CONFIG_SYSTEMCMDS_PARAM=y
CONFIG_SYSTEMCMDS_ALLOC_TEST=y
CONFIG_ORB_COMMUNICATOR=y
CONFIG_DRIVERS_POWER_MONITOR_VOXLPM=y
CONFIG_DRIVERS_QSHELL_QURT=y
CONFIG_DRIVERS_ACTUATORS_VOXL_ESC=y
CONFIG_DRIVERS_VOXL2_IO=y
CONFIG_DRIVERS_BAROMETER_INVENSENSE_ICP101XX=y
CONFIG_DRIVERS_BAROMETER_MS5611=y
CONFIG_DRIVERS_BAROMETER_BMP280=y
CONFIG_DRIVERS_BAROMETER_BMP388=y
CONFIG_DRIVERS_DISTANCE_SENSOR_VL53L0X=y
CONFIG_DRIVERS_DISTANCE_SENSOR_VL53L1X=y
CONFIG_DRIVERS_DISTANCE_SENSOR_LIGHTWARE_LASER_SERIAL=y
CONFIG_DRIVERS_LIGHTS_RGBLED_NCP5623C=y
CONFIG_DRIVERS_MAGNETOMETER_ISENTEK_IST8310=y
CONFIG_DRIVERS_MAGNETOMETER_ISENTEK_IST8308=y
CONFIG_DRIVERS_MAGNETOMETER_QMC5883L=y
CONFIG_DRIVERS_OSD_MSP_OSD=y
CONFIG_DRIVERS_GPS=y
CONFIG_DRIVERS_RC_CRSF_RC=y
CONFIG_DRIVERS_DIFFERENTIAL_PRESSURE_MS4525DO=y
CONFIG_MODULES_MANUAL_CONTROL=y
CONFIG_MODULES_CONTROL_ALLOCATOR=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_EKF2=y
CONFIG_MODULES_MC_POS_CONTROL=y
CONFIG_MODULES_MC_ATT_CONTROL=y
CONFIG_MODULES_MC_RATE_CONTROL=y
CONFIG_MODULES_MC_HOVER_THRUST_ESTIMATOR=y
CONFIG_MODULES_MC_AUTOTUNE_ATTITUDE_CONTROL=y
CONFIG_MODULES_FW_POS_CONTROL=y
CONFIG_MODULES_FW_ATT_CONTROL=y
CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_FW_AUTOTUNE_ATTITUDE_CONTROL=y
CONFIG_MODULES_AIRSPEED_SELECTOR=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_COMMANDER=y
CONFIG_MODULES_LOAD_MON=y
CONFIG_MODULES_PARAM_SET_SELECTOR=y
CONFIG_MODULES_FLIGHT_MODE_MANAGER=y
CONFIG_MODULES_SIMULATION_PWM_OUT_SIM=y
CONFIG_PARAM_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y #added by myself
I then rebuilt the px4 firmware and re uploaded to voxl2.
- I then followed the vtol setup guide to set the parameters for my transition. Specifically, I set the following:
- VT_F_TRANS_THR = 1.0
- VT_ARSP_BLEND = 0.0 mph
- VT_ARSP_TRANS = 0.0 mph
-
One note, from everywhere on the web that I looked, people with succesful vtol setup had an airspeed reading within their sims. (example) My setup is not showing any airspeed. To verify, I tried enabling airspeed_selector module. I then used
listener airspeed_validatedin px4. I was gettingnanfor my speeds, so I assume i am not getting that sensor’s data from gazebo. -
Following instructions in px4, I saw there was vtol setup without airspeed reading. I followed it, but the result remain unchanged. I still cannot transition. Parameters changed:
- FW_ARSP_MODE = 2 (disabled)
- CBRK_AIRSPD_CHK= 162128
- SYS_MC_EST_GROUP = 2 (ekf2)
- FW_THR_TRIM = 0.7
- VT_TRANS_MIN_TM = 10s
- VT_FW_MIN_ALT = 3m
- My next though was to check gazebo topics of publication
root@ThinkPad-P16s-Gen-2:/usr/workspace/voxl2_hitl_gazebo# gz topic -l
/gazebo/motor_failure_num
/gazebo/performance_metrics
/gazebo/server/control
/gazebo/standard_vtol_hitl_world/atmosphere
/gazebo/standard_vtol_hitl_world/diagnostics
/gazebo/standard_vtol_hitl_world/factory
/gazebo/standard_vtol_hitl_world/factory/light
/gazebo/standard_vtol_hitl_world/gui
/gazebo/standard_vtol_hitl_world/joint
/gazebo/standard_vtol_hitl_world/land_pad/link/gps_target
/gazebo/standard_vtol_hitl_world/light/modify
/gazebo/standard_vtol_hitl_world/log/control
/gazebo/standard_vtol_hitl_world/log/status
/gazebo/standard_vtol_hitl_world/model/info
/gazebo/standard_vtol_hitl_world/model/modify
/gazebo/standard_vtol_hitl_world/physics
/gazebo/standard_vtol_hitl_world/physics/contacts
/gazebo/standard_vtol_hitl_world/playback_control
/gazebo/standard_vtol_hitl_world/pose/info
/gazebo/standard_vtol_hitl_world/pose/local/info
/gazebo/standard_vtol_hitl_world/pose/modify
/gazebo/standard_vtol_hitl_world/request
/gazebo/standard_vtol_hitl_world/response
/gazebo/standard_vtol_hitl_world/sensor
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/airspeed/link/airspeed
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/airspeed/link/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/aruco_cam/link/arucoMarker
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/baro
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/base_link/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/camera/link/irlock
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/elevator/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/gazebo/command/motor_speed
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/gps0/link/gps
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/gps0/link/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/groundtruth
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/imu
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/left_elevon/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/link/airspeed
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/link/gps0
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/mag
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/px4flow/link/opticalFlow
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/right_elevon/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/rotor_0/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/rotor_1/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/rotor_2/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/rotor_3/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/rotor_puller/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/rudder/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/standard_vtol_hitl/imu_link/wrench
/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/vision_odom
/gazebo/standard_vtol_hitl_world/undo_redo
/gazebo/standard_vtol_hitl_world/user_cmd
/gazebo/standard_vtol_hitl_world/user_cmd_stats
/gazebo/standard_vtol_hitl_world/visual
/gazebo/standard_vtol_hitl_world/wind
/gazebo/standard_vtol_hitl_world/world_control
/gazebo/standard_vtol_hitl_world/world_stats
/gazebo/standard_vtol_hitl_world/world_wind
/gazebo/world/modify
- I then looked into mavlink/px4 communication handling. I found 2 scripts of interest:
- this code handles mavlink messages coming from gazebo and communication with gazebo. of note, it does seem to have diff pressure section to accommodate that message:
// differential pressure
if ((hil_sensor.fields_updated & SensorSource::DIFF_PRESS) == SensorSource::DIFF_PRESS) {
differential_pressure_s report{};
report.timestamp_sample = gyro_accel_time;
report.device_id = 1377548; // 1377548: DRV_DIFF_PRESS_DEVTYPE_SIM, BUS: 1, ADDR: 5, TYPE: SIMULATION
report.temperature = hil_sensor.temperature;
report.differential_pressure_pa = hil_sensor.diff_pressure * 100.0f; // hPa to Pa
report.timestamp = hrt_absolute_time();
_differential_pressure_pub.publish(report);
}
- this code handles how gazebo is publishing outgoing mavlink messages. Of interest, is the airspeed message seems to be done here:
CreateSensorSubscription(&GazeboMavlinkInterface::AirspeedCallback, this, joints, nested_model, kDefaultAirspeedModelJointNaming);
- I tried enabling airspeed data to px4 by modifying the airspeed.sdf model, since that is what is called from standard_vtol_hitl.sdf. i added the robotNamespace and topicName to the pluging:
<plugin name='airspeed_plugin' filename='libgazebo_airspeed_plugin.so'>
<robotNamespace>/gazebo/standard_vtol_hitl_world/standard_vtol_hitl/airspeed</robotNamespace>
<topicName>/link/airspeed</topicName>
</plugin>
I also tried the other robot namespace:
<robotNamespace>/gazebo/standard_vtol_hitl_world/standard_vtol_hitl</robotNamespace>
Still no airspeed and no transition.
- Note: when starting fw_rate_control module I get super unstable behavior even in Multicopter flight mode. I have disabled this module for now and only flying with: mc_rate_control, mc_att_control,mc_pos_control, fw_pos_control, fw_att_control,vtol_att_control. However, I tried transitioning with fw_rate_control on before. Still nothing.
adding some logs with param files:
i am pretty lost at this point, so any advice on how to make transition happen is much appreciated. I suspect I am either not publishing sth in gazebo that px4 needs to recognize transition, or I am missing some more modules. (however, I checked the uorb graph and i think I should have the required modules turned on)
thank you in advance to everyone who comments - your help is much appreciated
