After loosing my $1000 drone due to an elevator failure, I'm planning on adding a few safety features to the next beast. One of which will be a parachute.
For this I plan on writing a bit of code to trigger events based on altitude.
I've been looking at the code and I was hoping someone could point me in the right direction. I need to know which variables hold the home altitude and the current altitude.
I believe them to be:
Is this correct?
- Also are the values in meters for each variable?
- What do the altitudes indicate? MSL (Mean Sea Level) or AGL(Above Ground Level)?
If it's AGL does the home altitude initialize to 0 meters?
Thanks for all the help.
You should look at the update_alt() and adjust_altitude() methods. This is where everything is done. From what I can tell, everything is in cm.
There's two ways Arducopter measures altitude. One uses the IMU onboard barometer, which would probably be equivalent to the MSL. The second method is using an externally mounted ultrasonic sonar, which would be the AGL. The sonar only comes into effect below 1000 cm.
Home altitude depends on what you set as your home altitude is whatever altitude you've set in the ground station as your home. Current altitude is the combination of barometer and sonar reading. There's also a concept waypoint altitudes for each waypoint that you set.
Thanks for the reply. I forgot to mention that I'm using ArduPlane and not Arducopter.
I took a look at update_alt(). It seems to be the subroutine which updates the current_loc.alt variable. Now the question is what is current_loc.alt? Is it MSL or AGL? Also what is g.altitude_mix? I tried looking for it under the other tabs but couldn't find it anywhere.
Hi Rigel, you have a nice idea for saving our drones, i hope you make it with the code. till then Arduplanes measure altitude A. using GPS signal (MSL) but very innacurate B. using the barometer sensor (relevent to home alt) very accurate. i suppose mix, combines the the ALT deference between 0 and flight ALT with GPS ALT to show as our flight in the real world. so, in my opinion you have to use baro Alt (when pressure increasing the less Alt you have) for you code.
All this are wrong if the APM barometer is autocalibrated to sea level using Temp sensor, but i dont think so.
hope i helped