I am trying to make a small custom version of mission planner. I would like to make a button that launch a takeoff at 5 meters if the vehicle is landed and that sets mode land if the vehicle’s flying. Here’s what I have done so far :
private void But_TOL_Click(object sender, EventArgs e)
{
try
{
if (But_TOL.Text == “Décoller”)
{
//on va essayer de décoller
Settings.Instance[“takeoff_alt”] = “5”;
So I am using the text on the button to decide if I should takeoff or land, at the beginning we have “Décoller” which means takeoff, and once in the air “Attérir” means land. But I would like to find a parameter that knows if we are flying or not. I know Lua has “get_likely_flying” but I didn’t find something similar in MAV.cs. I first thought cs.landed was what I was looking for but returns 0 all the time so I don’t know.
Thank you for your help and for all this community that helped me a lot
landed is true when the system_status in heartbeat is MAV_STATE.STANDBY. Which is sent if the system is NOT in failsafe or not armed. So it can be false on the ground in a failsafe state.
The best way to tell if a vehicle is flying is check if it is armed (MainV2.comPort.MAV.cs.armed)
Yes indeed thanks ! @Eosbandi Oh okay ! But the system could be armed while in the ground with the rotors not spinning right ? I was thinking 2 buttons, one to arm/disarm and the other to takeoff/land. What do you think about using the current, turnrate or even TimeinAir ?
Oh yes obviously… But I can’t put my button as a landing button if I am not flying and just armed, it has to be a takeoff untill it is has left the floor. I thought it would have been easier ! I will try different methods on sitl.
Thank you for your help and for explaining the way it works backstage.