Continuous angle and angular rate: reading a log that crosses the boundary

Practise unwrapping angles over time, calculate the average rotation rate from the real dt, and check ambiguity when data are missing, with examples, worksheets, answers, images and diagrams

Last updated:

Concept image of a desk for learning angle over time, with a blue-needled wheel, a continuous paper roll, a blank card, an IMU module, a microcontroller board and a drone with its propellers removed
Concept image generated with AI; it is not a screenshot or a device model confirmed to be supported

Start the angle-over-time example · Back to the chapter on angles crossing ±180°

Continue with the chapter on smoothing angles versus delay to practise the three-point average and to separate out the time at which the result is ready to use

Objectives and prerequisites

Practise reading an angle that changes from 179° to −179° without interpreting the change in the numbers as a rotation of −358°, and find the average rotation rate from the interval between real samples. Use a PC calculator or paper; no board is needed. Read the shortest-path angle difference before doing this

The realistic-looking image at the start of the chapter was generated with AI and shows a wheel and a continuous paper roll as a conceptual aid; it is not a measuring device or a real Log result. All of the problems are hypothetical numbers, on a single axis , with no real angle for checking accuracy and no firmware run or IMU experiment

Normalize and Unwrap keep different meanings

normalize uses the earlier wrap formula to show an angle in [−180°, 180°), so it does not keep the number of turns, while unwrap accumulates the differences between samples into a continuous number, for example 170, 179, −179, −170° become 170, 179, 181, 190° following the short path chosen

Let a be the displayed angle and u the continuous angle: start with u0 = a0 and then use delta = wrap(a_now − a_previous) and u_now = u_previous + delta . Do not normalize u_now back at every step, because that would lose the continuity we want to keep.

This choice assumes that the size of the real angle change between samples is less than 180° and that the data are on the same axis/zero point. It does not automatically recover lost turns. The starting value u0 can still differ from a path that adds 360k° to the whole series, unless an extra reference is available.

The NumPy unwrap documentation shows the idea of adjusting values by whole turns, and an example for degrees where period = 360; the API's default is 2π for radians. This chapter calculates by hand and did not run the library, and it uses the −180° convention of the previous chapter at the opposite point, so it does not assume that the tie handling or every option of the API gives the same result as this teaching formula.

Joining four angle points and calculating the average rate

Given: the same sample clock with no reset; degrees, seconds and deg/s; choose the short difference under the assumption above, starting at t = 0 ms, u = 170°. The numbers are not the capability or limit of a real drone.

Sample (ms) Displayed angle (°) Continuous angle (°)
0 170 170
10 179 179
20 -179 181
40 -170 190

Calculate rate_average = delta / dt_seconds between two points, not using a dt from the configured sample rate in place of the real dt . The first row has no preceding point, so there is no rate yet.

Interval (ms) delta (°) dt (ms) Average (deg/s)
0→10 9 10 900
10→20 2 10 200
20→40 9 20 450

Interval 10→20 ms: delta = wrap(−179 − 179) = +2°, dt = 0.01 s, giving 200 deg/s . If the numeric difference of −358° were used directly, the result would be −35,800 deg/s, caused by the angle display boundary. For the interval 20→40 ms: delta = +9°, dt = 0.02 s gives 450 deg/s , not the 900 deg/s obtained by wrongly using dt = 0.01 s for that interval.

This rate is the average of the angle change on one axis over the interval , not the gyro value at one instant. A comparison with a gyro requires checking the axis, unit, time interval and angle type first. In three dimensions, the Euler-angle derivative does not equal the body gyro in every attitude. Read the limitations in the Complementary Filter chapter

Graph of the displayed angle and the continuous angle at four points over time, with a diagram for checking the clock, interval and ambiguity before accumulating differences

Matplotlib graph from hypothetical numbers. The connecting lines are there to show the order; they are not a waveform or measured motion between the points. Open the full-size continuous-angle graph

Missing data allows multiple paths

A separate new problem: from t = 40 ms, displayed angle −170°, to t = 240 ms, displayed angle −150°, gap = 0.2 s. The short difference is +20°, but the same end point could also come from a change of +380° or −340° , because they differ by one full turn. The possible average rates are +100, +1,900 and −1,700 deg/s respectively. Without additional evidence, +100 is not chosen as the real motion merely because it is the short path.

If there is a confirmed real rotation-rate bound Ωmax covering the whole interval, and Ωmax × dt < 180° , this is a sufficient condition for a single-axis angle change to be less than half a turn. The demonstration example uses Ωmax = 2,000 deg/s: dt = 0.02 s gives 40° < 180°; dt = 0.2 s gives 400°, which does not guarantee this condition. The bound of 2,000 is an assumption of the problem, not a measured value or a requirement of real equipment. Failing the condition does not prove that more than half a turn occurred. For the end angles of this problem, +20°, +380° and −340° all have a magnitude no greater than 400°, so the path still cannot be determined even with this assumed bound.

At the opposite difference of exactly 180° , two equal paths still exist, and noise near the boundary can change which path is chosen. Unwrapping does not fix noise, bias, disturbing forces or gaps. Study Sampling rate and unmeasured data alongside; a continuous graph does not count as confirming that all samples are present.

Check time and state before dividing or accumulating

  1. Check which point a timestamp refers to (sampling, reading or use) and that it is in the same clock and session. If there was a reset or the relation between the clocks is unknown, split the interval; do not subtract the times directly.
  2. If dt ≤ 0, state the duplicate/ordering/reset that is still unknown. Do not divide by zero or set a dt yourself to get a rate, and do not re-sort timestamps and then claim it is the original capture order.
  3. When there is a gap, check the motion bounds that have evidence. If the number of turns still cannot be chosen, mark it as ambiguous / path cannot yet be chosen and keep the raw data; do not join the line to look smooth as if it were a confirmed result.
  4. After a filter or an axis conversion, check which interval the angle and the time refer to. Read Data age checking to separate what is computable from what is fresh enough for the point of use.

Practice steps and basic advice

Read the angle-over-time set guide then make a copy of the blank angle-over-time planning sheet and write the units/clock/starting value and assumptions. Do the continuous-angle and average-rate problem before opening the angle-over-time answers

Start from the four points, calculating delta → u → dt → rate one interval at a time, check that wrap(u) matches the displayed angle, then separate the gap case and write at least two paths that have the same end point, stating what must be collected before choosing the real path. The advice is to use the real dt, keep full values before rounding, and not use a smooth number or a direct answer as evidence of accuracy. There is no new score in the existing quiz.

Figures and references of the angle-over-time set · Hash list of the angle-over-time set · Back to the MCU overview

Used in courses

How to cite this page

Drone Institute, Rangsit University. (2026). Continuous angle and angular rate: reading a log that crosses the boundary. In UAS Technology Knowledge Hub (B.Tech.). https://rsu-uat.pk-research.work/en/kb/knowledge/microcontrollers/applied/unwrap/

Original from Drone-Hub: https://drone.pk-research.work/knowledge/microcontrollers/applied/unwrap/ · © PK-Research