Open rmackay9 opened 6 years ago
Actually i think there should be at least two way of it working. I think the way it is now is very very usefull as it allows to have the copter fly an auto mission and let the pilot correct for small alignment issues (precision crop spraying) while the copter still flies to the opposite side of the field. If every correction takes it out of the zig zag mode than it 'll be a lot less usefull. Maybe 2 different modes, Absolute ZigZag and Safe ZigZag. Just my ideas.
Corrado
ZigZag mode should switch back to manual control (i.e. acts like Loiter) if the pilot provides roll/pitch input while the vehicle is flying autonomously. This would improve safety because currently it only switches back to manual mode if the user moves the auxiliary switch to the middle position.
ZigZag mode will be included in Copter-3.7 (PR is here).
The implementation of this is not particularly difficult, we should somewhere call, "get_pilot_desired_lean_angles" and then check if the safe_sqrt(sq(target_roll)+sq(target_pitch)) (i.e. the desired lean angle) is greater than some constant (like 5 degrees). If it is, we should probably call, "ModeZigZag::return_to_manual_control".
I'm not quite sure where we should put this code. It could go near the top of auto_control() and then return.. then within ModeZigZag::run() it would end up calling manual_control(). My only concern about this is that the state changes are a bit hidden. In some ways, it makes more sense to put this check within ModeZigZag::run() near the similar check of "reached_destination()".