I cannot switch to LOITER mode after take off in ALTHOLD.
My setup:
PX2 controller with Copter 3.4.5 stable firmware.
LIDAR Lite v2 set as range finder.
PX4FLOW Optical Flow sensor reporting good values.
ALTHOLD flight mode works well.
No GPS is attached.
My symptoms:
I get a pre-arm check error: “Need 3D Fix”
When I switch in-flight to LOITER, I get an error message in the logs: “Subsystem:10 ErrorCode:5”, which I believe is: ERROR_SUBSYSTEM_FLIGHT_MODE and ERROR_CODE_DEST_OUTSIDE_FENCE.
There seems to be no effect when I switch to LOITER mode during flight. The copter has significant drift.
What I have tried:
I have gone over the PX4Flow setup instructions several times and confirmed that I am getting good values from the sensor.
I have triple-checked that my EK2_GPS_TYPE is 3 for optical flow.
I have triple-checked that the geofence is disabled.
Thanks for the reply. Today I found the problem. Since px4flow sonar cant be used, I have connected the analog pin of sonar to 6.6 v Adc of pixhawk. It is working very good with Alt Hold mode. But when I switch to loiter it is not working. But if I put the EK2_ALT_SOURCE to Baro meter it is going to loiter. Can this issue be solved ?
As per your suggestion, will that Copter 3.5 work with the above sonar configuration instead of lidar ?
I was able to resolve my issues by reloading the firmware. I had tried this unsuccessfully before, but I found some other advice that said to load the firmware for a different type of airframe (e.g., ArduPlane), then reload the ArduCopter firmware. This resolved my issue of not being able to switch to loiter mode.
Last time I checked, there was a strong recommendation not to use the onboard sonar because it is unreliable over a large number of surface types. I recommend doing some testing on surfaces you will be flying over before actually flying.
I tried the both the ways as you suggested. But still I am not able to enter into loiter mode.
Its is beeping twice and showing flight mode is not changed. I observed one thing with copter 3.5.1, after putting FLOW ENABLE to 1 and restarting the pixhawk again the FLOW ENABLE is going back to 0.
If you have good readings from optical flow (numbers change values an polarity according to movements) and that you have readings from sonar and EKF is ser correctly it should get into loiter
Otherwise click on the reset the parameters button and reconfigure
I tried calibrating my px4flow sensor as per the documentation. My optical flow data is very very noisy. I have kept chess checker board to focus and tune the FLOW_FX and FLOW_FY. I am gettingg very noisy values.
Is this data recorded during flight, or just while you’re holding it in your hand? If it’s during flight, you might want to make sure that your props are very well balanced. If you have your Pixhawk connected to MissionPlanner or QGroundControl while you try to arm in loiter mode, it should give you a reason why it is unable to arm. Have you checked this? What was the reason?
If you connect your pixhawk to the MissionPlanner or QGroundControl software while you try to arm the system, it will give you a reason why it cannot arm. Have you tried this? What was the reason given for not being able to arm?
Arming in LOITER works when powered with USB, LOG file displays OF information.
Currently I don’t have telemetry so I have to read the log to see why the arming doesn’t work with battery.
When powered with battery, arming/ mode switch fails, and the log doesn’t have optical flow data. I enabled logging while not armed and FLOW parameters are alright. Is the reason for arming/mode switch failure logged somewhere in the log file?
Are you using pixhawk2 the cube together with arducopter 3.5?