Drone Control
Time limit2sMemory limit1024 MB
Given pitch, roll, and yaw targets, find four flap angles that produce them while minimizing the largest absolute flap angle.
- Level
Medium6 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
You are designing a controller for an interesting aircraft called the Single Copter. It has only one propeller, but the outgoing air flow is further shaped by four flaps that control three Euler angles (pitch, roll, and yaw) that help maintain the requested orientation of the craft. Each flap can assume any angle requested by the flight controller, and when the flaps are at certain angles, they exert the requested forces on pitch, roll, and yaw.
Figure D.1: Pitch, roll and yaw on a Single Copter
Define the angles of the flaps as , , , and (for north, east, south, and west, respectively). The forces in the directions of pitch, roll, and yaw are defined by the following equations.
There are four variables and three constraints. From the perspective of aerodynamics, it makes sense to make the largest flap angle as small as possible, so you also want to minimise .
Find the best parameters to send to the Single Copter to achieve the desired pitch, yaw, and roll.
Input
The first line contains the number , , the number of requests. Each of the next lines contains three real numbers , , ().
Output
Output lines. On the -th line, output four numbers , , , , separated by whitespace, as the solution for the -th request.
Your answer is correct if the resulting pitch, roll, and yaw differ from the requested values by at most , and the maximum absolute value of the flap outputs does not exceed the true optimum by more than .


