Servers by jDrones

The copter does not takeoff in Guided mode and EKF_GPS_TYPE = 3 (optical flow)

Yes, but this settings pattern works for ArduCopter V3.6-dev

May I know why using EKF3 instead of EKF2 while optical flow was enabled?

@stanley76726 Hello,
Just like Copter, the EKF do have releases, so EKF3 is the last release, and this is why you need it as primary state estimator in order to acces to the new features.

@ppoirier @dollop
Thank you all for this discussion. I want to do the same and make the copter use rangefinder sensor and px4flow to control its altitude and position and control everything in the code using MAVLink.
As I understand from the discussion, It is possible to use that sensors in Guided mode after setting the value of the parameters.
You mentioned above that I have to “Set home here” before working. If the GPS is disabled, how can I do that? I mean I checked the MAV_CMD_DO_SET_HOME command and it need Latitude and Longitude but if the GPS is disable how can I solve it?
I tried using SITL (APM:Copter V3.6-dev (3852427e)) to arm and takeoff in loiter mode but the drone did not take off. Is that the correct behaviour or that issue is just in the simulator?
Is there any updates about this issue in general I have to take care about?
Again, Thank you very much

To set home, you right click on Mission Planner Map or on SITL
To take off you need to arm and set motor speed == rc 3 1500 (or more)

1 Like

Thank you for our continuous help.
I followed the instructions in wiki and now I am in Calibrate the sensor section.

Here also the log file :…/00003-2017-04-22_00-56-25.bin…
Is the result is good? I noticed that the body and Gyro are close to each other.
Can I now try a short and simple test in loiter mode or I have to do more checks?

@SoubhiOptecks just like I wrote on FB; FlowY need more gain, adjust FLOW_FYSCALER
Then you can give it a try, my mode switch is Stabilize-Alt-Hold-Loiter, I used to test through this sequence, so get ready to switch back to alt-hold if the quad start drifting weird.
Also make sure the focus is adjusted to the testing altitude and that you have good ground texture.

1 Like

Hi @ppoirier, @dollop,
I found very interesting the problem you solved here, because is the same that I’m faceing during these weeks.
I would like to make my copter fly indoor using a rangefinder (MaxSonar EZ4) and the Pix4Flow. The problem is that with all the options set as you described, the result of my script is that in Guided No GPS mode the motors do not rotate.

Giving the take off command from the mission planner the copter completes the take off correctly.

Another try was to give the thrust to the copter until it reaches the corret height and then switch the mode to loiter. But once reached the correct height the copter chenges mode to loiter and falls down.

Outdoor the copter is stable and easy to control with mission planner, in order to move through way points.

If it could help, this is my configuration :

param.param (13.5 KB)

And this is the script that I’m using to take off:

def arm_and_simple_takeoff(Target, vehicle):

my_location_alt = vehicle.location.global_frame
my_location_alt.alt = 0
vehicle.home_location = my_location_alt

while not vehicle.mode == 'LOITER':
    vehicle.mode = VehicleMode("LOITER")

vehicle.armed = True

while not vehicle.armed:
    time.sleep(1)  # Waiting for armed


# Wait until the vehicle reaches a safe height before processing the goto (otherwise the command
#  after Vehicle.simple_takeoff will execute immediately).
while True:
    print " Altitude: ", vehicle.location.global_relative_frame.alt
    # Break and return from function just below target altitude.
    if vehicle.location.global_relative_frame.alt >= Target * 0.95:
        print "Reached target altitude"

Can you help me to solve the problem. Thank you in advance.


I have done new trials today. After that I noticed I was not sending the RC override [3] = 1500, I added this command to my script but nothing changed.
I don’t understand why but it rotates with few rpm anyway stopping its motion after 4 - 5 seconds.

So I tried to send the command

msg = vehicle.message_factory.set_attitude_target_encode(
0, # target system
0, # target component
0b00000000, # type mask: bit 1 is LSB
to_quaternion(roll_angle, pitch_angle), # q
0, # body roll rate in radian
0, # body pitch rate in radian
math.radians(yaw_rate), # body yaw rate in radian

With roll = pitch = yaw = 0 and thrust = 0.7. In this way my copter takes off but I don’t understand why I can’t do it with simple_takeoff function.

Hi my maxbotix sensor reading is ok in GPS denied area??? if ok then i will goto flying test.

Hello, Francesco @Drone_Master.
Did you solve this issue? Could you share what you get working up to now?
Thanks in advance.

Hello ppoirier,

I have adjusted the parameters as specified by yourself, above.

The thing is, I am using the master version of ArduPilot and the paramter “FLOW_ENABLE” is not seen on MP GCS. It is also not seen in the source code, here:

const AP_Param::GroupInfo OpticalFlow::var_info[] = {

at file OpticalFlow.cpp

How can I enable the optical flow? Is setting up the given parameters enough?

Because all I see is “opt_x = 0” and “opt_y = 0” values.

I think you have to specify the type and it is getting enabled with the new method, allowing different OF models

Thank you for your reply. I did enable the type as well, though. Still was getting zero values. However, I checked the OF (which is PX4OF) through MP and saw that the camera vision was fine, I can see grayscale images of the environment and so on.

So, in short, there is nothing else you think could be going wrong, in parameter wise? If so, it’s probably something with the hardware.

Do you have a working rangefinder ? ArduPilot require a Rangefinder for OF to work in standard mode

Oh, I might have a rangefinder lying around somewhere but it wasn’t hooked up. Thanks!

So, I guess that was the problem?

Dear Ppoirier,

I have been trying for long to get the initial position lock using mission planner. Should I be in a specific mode for this to work or do I need GPS for getting this initial lock?

I am trying to control my drone using optical flow(px4flow) and I don’t have any GPS with me. I believe an initial position lock is essential for optical flow to work, is this correct?

When I try to do 'First Flight test ’ in px4flow wiki, with ekf disabled. my copter is not arming showing ‘PreArm: Waiting for Nav Checks’.
Note: In Prearm safety check I have disabled GPS lock.
Can anyone pls give me insight as in how to provide a position lock without GPS !
Thanks in advance!

Hello, you need to set Home using EKF Origin.

As for the Nav Checks, I think the wiki is outdated as we don’t have to disable the EKF to perform tests.

@rmackay9 what do you think Randy ?

1 Like

thanks for your reply.
I tried both actually with EKF origin too, but nothing is happening. I dont understand what is wrong !

Servers by jDrones