Hi everyone !
I control my quadcopter with a joystick and I would like to have the control of the altitude (only Z channel) while being in follow me mode. I think it is possible since the yaw is still available in follow me mode so why not the altitude !
So first thing first I tried to do it in guided mode since follow me is based on guided.
Here’s what I wrote in guided :
// get pilot desired climb rate
target_climb_rate = get_pilot_desired_climb_rate(channel_throttle->get_control_in());
target_climb_rate = constrain_float(target_climb_rate, -get_pilot_speed_dn(), g.pilot_speed_up);
I copied/pasted that under each “// get pilot’s desired yaw rate” I found in the guided mode code, I declared “float target_climb_rate = 0.0f;” each time and I thought it would be okay. I thought that since it worked for yaw it would also for altitude.
At the beginning of the simulation I had the control of altitude and it seemed to be fixed
when the copter is close to the destination the code stops reading my altitude command and go to the destination’s altitude.
I am wondering if I should set the target’s altitude as the current altitude but I don’t know how to do this.
Does anyone has ideas on how to do this ? Or maybe there is a parameter to set somewhere that already allows this ?
Thank you advance for your patience and ideas. I appologies in advance for my mistakes in english.