Drone does not hold position in loiter mode

Just guessing, but what if your WPNAV settings have some junk or incorrect values.
What’s in:
WPNAV_ACCEL
WPNAV_ACCELZ
WPNAV_LOIT_JERK
WPNAV_LOIT_MAXA
WPNAV_LOIT_MINA
(Edit) actually check all WPNAV settings for sane looking values, considering centimeters are used.

Make sure WPNAV_RFND_USE is 0 and PRX_TYPE is 0

I’ll try looking in your logs, it’ll be my first time checking other peoples logs so no guarantees.

Edit: I cant make sense of your altitude by baro or GPS, it’s like you’re still on the ground or below (could be propwash from being too close to the ground).
Vcc is not reported, that rings alarm bells to me.
You look to be on 3.6 dev - have you tried a normal stable version? 3.5.4
And reset all params to defaults before calibration.

Thank you very much for your help.
Yes, flashed 3.5.4 arducopter. I set the baro as a sensor for altitude (I used to us rangefinder also).

Why? what does that mean?

Thank you

Please check your transmitter trims to make sure they are centered. You can use trim in manually flown modes like Acro, Stabilize or Alt Hold. But in any GPS augmented mode like Loiter transmitter trim will make the aircraft take off in the direction the trim is set.

Are you giving the GPS enough time to for the EKF to be happy with it.

Before you try to use Loiter I am assuming you wait until you get the green LED to indicate GPS lock, yes?

But when you get the green LED are you switching to loiter to check that it stays green?
There can be quite a wait before the EKF is happy with the GPS but it still shows green in Stab and Alt hold, but only when you switch guided modes does it go back to blue.
AND, this only happens if NOT armed.
So if you arm in Stab with a green LED but the EKF is not happy, switching to Loiter will still show you the green LED even though the firmware will not actually switch to loiter.

It’s a real gotcha that the devs don’t seem interested in looking at.

I guess it means whatever hardware you have is not set up to measure and report Vcc, which seems very strange to me - voltages are critical for electric powered flight. But anyway your rig is pwering up i suppose.
I’d go back to basics, disconnect any unnecessary hardware, rangefinders, sonar and so on - get the base flight controller working with all default parameters and any needed tweaks to hover throttle and pitch/roll sensitivity.
Stick to stabilise mode for flight tests, then as Chris and Mike said, check what messages you get changing into assisted modes while still on the ground.