Hi all,
I have noticed that the option to ‘Set home position’ in flight does not change anything (wiht qgc: press on a point on the map and then the option to set home here appears).
This is supported by the fact that when initiating RTL procedure, the drone will not go to the new location. This got me wandering about the fact that maybe RTL goes to the Launch location which is usually the TO location (as stated by the name) and not to the Home position.
What is therefore the difference between the two? How can I set a location while in flight that is used as a fallback location by the drone when starting RTL (not a rally point)?
Good question. In PX4, RTL flies to the home position, which is normally set at arming/takeoff. Whether QGC’s ‘Set home here’ actually takes effect in flight depends on your PX4 version, so check the MAVLink console or QGC messages for a rejected/ignored DO_SET_HOME command after you try it. For a reliable in-flight fallback, rally (safe) points are usually the better tool: upload them with your mission in QGC’s Rally tab, and with RTL_TYPE set to use the closest safe destination the vehicle will return to the nearest rally point instead of the launch site. On long-range fixed-wing and VTOL ops we fly at Gauten UAV, we nearly always set a couple of rally points along the route for exactly this reason. Also worth checking RTL_RETURN_ALT and, for VTOL, the RTL land approach settings so the vehicle arrives at the rally point in a sensible configuration.
Hi @yi_yong_li and thanks for the reply. I am flying a quadcopter (not a fixed wing) so the missions might be a shorter in range. I know that setting rally points is a good option, but I would like to avoid going through the mission planner > upload to vehicle as it is slower than just setting a new home pos.
Do you have any fix (I am using a custom version based on PX4 v1.16) or is the solution just checking the console?
I checked the PX4 v1.16.0 source code, and there is a specific setting worth checking before modifying your firmware.
In Commander.cpp, PX4 handles MAV_CMD_DO_SET_HOME, but the command is gated by the COM_HOME_EN parameter.
I would suggest the following:
Check whether COM_HOME_EN is enabled in your custom PX4 build.
Use QGC’s “Set home here” option and inspect the COMMAND_ACK result for MAV_CMD_DO_SET_HOME.
Check the subsequent MAVLink HOME_POSITION message to confirm whether PX4 actually updated the coordinates.
If the command is accepted and the home position changes, but RTL still targets the original location, investigate the RTL destination selection in your custom firmware.
In PX4 v1.16, the manual home-setting function also requires a valid global reference from the local position estimator.
One important detail: setting home manually requires a valid altitude as well as latitude and longitude. A failure in that part of the command can prevent the update.
You should not need to upload a rally-point mission simply to request a new home position.
I would first verify this in SITL, including the RTL destination, before using it as an in-flight fallback.
Could you check the value of COM_HOME_EN and let us know whether the command returns ACCEPTED, DENIED, or TEMPORARILY_REJECTED?
Hi Yiğitcan,
Thanks for the reply. I will check the COM_HOME_EN param (although I am pretty sure that I have already enabled that) and tun a SITL simulation and check the mavlink message. Will let share the result.
I checked the param COM_HOME_EN and it was set to 1. I did not run a simulation before so I did not catch it, but as soon as I set a new home pos, the altitude to some -485m (negative!!).
So the new position is accepted in SITL (confirmed with the mavlink inspector and console) but rejected in the real flights.
I see that commander.cpp handles the altitude as param7, but I also see that in qgc when I enter Application Settings > Maps the Elevetion Provider is set to Copernicus. So I am wandering if this a trustwrthy source or if this has to be changed to smt else.
It could also explain some other issues that I am having with the altitude sometimes reporting wrong measurements because the barometer (main ekf source) and the gnss derived altitude differ between them.
I will try to research this, let me know if you have any ideas.
Thanks for running the SITL test. The difference between SITL and the real vehicle is an important finding.
I would first separate three possible issues: the altitude reference supplied to MAV_CMD_DO_SET_HOME, the command acknowledgement, and the actual HOME_POSITION update.
The approximately -485 m value is worth investigating, but a negative altitude alone does not establish an error. We need to know which altitude reference it represents.
I would not change the QGroundControl Copernicus elevation provider or the EKF height source yet. There is not enough evidence to attribute the problem to either.
Could you check the following?
The exact value and altitude reference used for param7.
The COMMAND_ACK result in SITL and on the real vehicle.
HOME_POSITION before and after the command.
GLOBAL_POSITION_INT and GPS_RAW_INT altitude values, if available.
Your PX4 firmware version and how you send the command.
It would also be useful to distinguish whether the real vehicle explicitly rejects the command or acknowledges it without updating the home position.
I suggest performing these checks on the ground, with propellers removed, before attempting any further in-flight home-position changes.
Once we have those values, we can narrow down whether this is an altitude-reference mismatch, a command-handling difference, or a position-estimation issue.