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

@SoubhiOptecks
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

@ppoirier
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 :https://www.dropbox.com/s/qf…/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

print 'ENTERING LOITER MODE'
while not vehicle.mode == 'LOITER':
    vehicle.mode = VehicleMode("LOITER")
    time.sleep(0.05)
print 'LOITER MODE SET'

vehicle.armed = True
vehicle.flush()

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

vehicle.simple_takeoff(Target)

# 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"
        break
    time.sleep(1)

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

Francesco

Hi,
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,
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
thrust)

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 ?
https://ardupilot.org/copter/docs/common-px4flow-overview.html#first-flight-copter-only

1 Like

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

@ppoirier,

We probably want to make sure that the EKF is not using the optical flow sensor… I’m actually a little unsure if it will try to use the optical flow sensor if EK2_GPS_TYPE = 0 (“GPS 3D Vel and 2D Pos”) which is the default.

I suspect you’re right, I’m just not completely sure.

@anish, it’s key that the vehicle appear on the Ground Stations map. If it’s not appearing there then the EKF is not completing it’s initialisation and calculating a position estimate. Normally this is because it’s missing some piece of data or the data it’s getting is not consistent.

By the way, we strongly recommend upgrading to Copter-3.6.12 (or better yet 4.0.0) to avoid the possibility of “I2C storms” causing a lockup of the flight controller. The upgrade from Copter-3.6.9 should be relatively painless.

EDIT: it’s very helpful to provide an onboard load (aka dataflash log) because it helps us see what is really going on with the autopilot. I’d recommend setting LOG_DISARMED = 1 then do the test and then post a log (or provide a link) here.

Thanks for using AP!

1 Like

When you set EKF origin, you should see the vehicle appearing on the map and if you perform full zoom, you should see the vehicle moving if you ‘’ Walk the quad’’

Question: Do you have a functioning rangefinder connected to the Flight Controller ?

1 Like

I have a tera one range finder and I’m presently waiting for the i2c adapter to be delivered to connect it to the autopilot.
Is it influencing the initial position lock ?

So it is NOT presently connected ?
If its the case , OpticalFlow cannot start