Hi Guys,
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:
home.alt
and
current_loc.alt
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.
Replies
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.