開發紀錄:雲台、IMU、編碼器、STM32 怎麼組起來——以及 BaseCam 該在什麼時候進場

這是 LocalPapa Notes 開發紀錄系列的第三十篇,也是雲台系列的第十三篇。

前面十二篇累積了不少東西:力矩怎麼算雙軸怎麼選型三層迴路怎麼分頻寬參數怎麼量回來文獻分工長什麼樣架構怎麼決定

但這些都在講「怎麼算」,沒有一篇講「怎麼組」。

有人問我一個很基本的問題:雲台、IMU、編碼器、STM32,這四樣東西到底怎麼拼在一起?BaseCam 又是什麼角色、什麼時候該讓它進場?這篇把它講清楚。

一句話版本

IMU 與編碼器量的不是同一件事。

IMU 對慣性空間,編碼器對機構本身。基座不動的時候,兩邊的讀數是一致的;基座一動,兩邊就分岔——而那個差,正是雲台存在的理由。

理解這一句,四個零件的分工就自動排好了。

一、四個零件各自落在哪一層

硬體 × 迴路:哪個零件在哪一層,回授來自哪裡 硬體 × 迴路:哪個零件在哪一層,回授來自哪裡 STM32:三層全包 位置/追蹤環 約 2.4 Hz 把「指到那個方向」變成角速率指令 ω* ② 編碼器(機械角)/影像 ω* 角速率指令 速率/穩定環 約 12.0 Hz 把「視線別動」變成力矩指令 T*——這一層才是雲台的本體 IMU 陀螺(慣性角速率) T* 力矩指令 電流環(FOC) 約 1.7 kHz 把 T* 變成三相電壓,順便處理換相 ① 編碼器(電氣角)+ 電流感測 V 三相電壓 受控體:馬達+機構 擾動從這裡注入:載體運動、風阻、摩擦、背隙 沒有回授,只有擾動 ①② 是同一顆編碼器的兩種用法:換相要的是轉子的電氣角、快而且不必絕對準;位置環要的是關節的機械角、慢但必須絕對準。兩種要求不一樣,所以「有編碼器」不等於「兩件事都解決了」。IMU 與編碼器量的不是同一件事。IMU 對慣性空間,編碼器對機構本身。基座不動時兩邊一致,基座一動就分岔——而那個差正是雲台要對抗的東西。
圖 1:三層迴路由外而內,四個硬體各落在自己那一層,以及兩條性質完全不同的回授路徑。
零件 在哪一層 更新率 量/做什麼
STM32三層全包FOC 換相、速率環、位置環都跑在它上面
IMU(陀螺)速率環回授約 1 kHz慣性空間的 LOS 角速率
編碼器位置環回授 + FOC 換相約 10 kHz機構的關節角與轉子角
馬達+機構受控體擾動從這裡注入

三層迴路的頻寬規劃是第二十五篇那組:位置環 2.4 Hz、速率環 12 Hz、電流環約 1.7 kHz,PWM 20 kHz。

值得注意的是中間那一層才是雲台的本體。位置環決定「指向哪裡」,那是任務層的事;電流環決定「怎麼把力矩變出來」,那是驅動層的事。真正在對抗載體晃動、決定這台雲台穩不穩的,是速率環——而它唯一的回授來源就是那顆陀螺。

所以如果只能把一件事做對,那就是把陀螺裝對地方、把速率環調好

二、同一顆編碼器,兩種完全不同的要求

編碼器有兩個獨立的用途,這件事常被混為一談:

用途一:FOC 換相。 需要的是轉子的電氣角。要求是快——得跟上 PWM,約 10 kHz 等級;但不必絕對準,因為換相只在乎「現在轉子相對於定子在哪」,一個固定的偏移可以在開機校正時吃掉。

用途二:位置環回授。 需要的是關節的機械角。要求是絕對準——2.4 Hz 的迴路對速度沒什麼要求,但如果讀數有 0.5° 的絕對偏差,你的雲台就會穩定地指錯 0.5°,而且沒有任何辦法從內部發現。

兩種要求方向不同,所以「有編碼器」不等於「兩件事都解決了」。實務上會遇到的具體問題:

  • 增量式編碼器(ABZ)開機時不知道自己在哪,得先走到 Z 相或做對齊程序。換相可以忍(開機轉一下就對齊了),位置環不能忍(你不會想每次開機都讓雲台自己甩一圈)。
  • 絕對式編碼器(SPI 磁編,如 AS5048 那類)開機就知道角度,兩件事都能服務——這是雲台幾乎都用絕對式的原因。
  • 減速機構的編碼器要裝在負載側還是馬達側? 馬達側對換相友善(電氣角直接可得),負載側對位置環友善(背隙不進誤差)。這是第二十九篇結論「直驅」的一個附帶好處:直驅時兩側是同一個地方,這個取捨消失了。

三、實體位置比接線圖重要

實體位置:接線圖畫得對,零件裝錯地方一樣不會穩 實體位置:接線圖畫得對,零件裝錯地方一樣不會穩 載體(基座) 方位軸 方位框(叉臂) 鏡頭 內框+相機 俯仰軸 E E IMU MCU 裝在哪 為什麼 多快 IMU(陀螺) 約 1.0 kHz 內框,與相機同一塊剛體 要量的是相機在慣性空間的角速率,裝別的地方量到的就是別的東西 編碼器 ×2 約 10.0 kHz 兩個關節各一,量的是關節兩側的相對角 換相要電氣角、位置環要機械角,同一顆兩用 STM32 PWM 20.0 kHz 基座或方位框,不必跟著俯仰轉 三層迴路都跑在它上面,跟著轉只會多一束線 馬達 ×2 兩個關節,直驅(第 29 篇的結論) 受控體本身 常見錯誤:把 IMU 裝在基座上 那量到的是載體的運動,不是視線的運動。速率環會去穩「基座」,而相機掛在兩個關節的另一端——中間那兩個關節的角度變化,這顆陀螺完全看不到。 把陀螺裝在內框上,是「直接量測 LOS」;裝在基座上再靠編碼器推算,是「間接量測」。後者的誤差會累積機構的每一段柔性與背隙,Kennedy &Kennedy (2003) 比較的就是這兩條路。編碼器與電流取樣的更新率跟換相綁在一起,是全系統最快的兩條線;位置環只有 2.4 Hz,慢了三個數量級。同一顆編碼器同時餵這兩端。
圖 2:雙軸雲台的剖面示意,以及每個零件裝在哪、為什麼裝在那裡、更新率多少。

接線圖畫得再對,零件裝錯地方一樣不會穩。三條規則:

IMU 必須在內框,跟相機同一塊剛體。 你要量的是相機在慣性空間的角速率,不是別的東西的。裝在基座上,量到的就是載體的運動——速率環會去把「基座」穩住,而相機掛在兩個關節的另一端,中間那兩個關節的角度變化這顆陀螺完全看不到。

這不是實作細節,是架構分歧。Kennedy & Kennedy (2003) 把它分成兩條路:

  • 直接量測:陀螺裝在被穩定的物體上(內框),直接量 LOS。
  • 間接量測:陀螺裝在基座,再用編碼器讀數推算 LOS。

間接量測的誤差會累積機構的每一段柔性與背隙——而第二十九篇算過,諧波減速的背隙就已經是 θ_max = 0.1 mrad 的 2.9 到 8.7 倍。所以間接量測在高精度雲台上基本不可行,除非機構剛到誤差可忽略。

編碼器要跨在關節兩側。 它量的是相對角,不是絕對姿態。方位軸那顆量「叉臂相對於基座」,俯仰軸那顆量「內框相對於叉臂」。

STM32 可以留在基座或方位框,不必跟著俯仰轉。 三層迴路都跑在它上面,但它不需要跟被穩定的東西同體。讓它跟著轉只會多一束過關節的線——而過關節的線本身就是第二十三篇摩擦項的一個來源。

至於更新率的量級: 編碼器與電流取樣跟換相綁在一起,是全系統最快的兩條線(10 kHz、20 kHz);陀螺約 1 kHz;位置環只有 2.4 Hz,慢了三個數量級。同一顆編碼器同時餵最快與最慢的那兩端。

四、BaseCam 在哪一段幫得上忙

BaseCam 這類現成控制器蓋到哪一段——以及跟文獻缺口的重疊 BaseCam 這類現成控制器蓋到哪一段——以及跟文獻缺口的重疊 架構選擇 結構/機構 致動器選型 傳動 感測 控制律 應用輸出 雲台文獻(第 28 篇八群的聯集) BaseCam 這類現成控制器 全包 有介面,內容自理 ↑ 文獻沒蓋到,現成品也沒蓋到——這一格是自己的事 反向約束:板子的驅動分層 → 可用電流 → Kt 下限 → 天底禁區 驅動分層 每軸可用電流 需要 Kt ≥ 天底禁區 標準款板載(1.5A 三軸合計) 0.75 A 0.2410 Nm/A 1.29° I2C_Drv 客製 3.00 A 0.0602 Nm/A 0.32° 較大的自製驅動 6.00 A 0.0301 Nm/A 0.16° BaseCamBGC Pro(單軸 13A) 13.00 A 0.0139 Nm/A 0.07° 上排是第 28 篇八個雲台文獻群的區間聯集,下排是現成控制器的覆蓋範圍,兩排都由資料算出來、不是畫上去的。空白處重疊在同一格:致動器選型。而下面那條反向箭頭說明它不只是空白——你選的板子會回頭綁死馬達:板載驅動每軸只有 0.75A,Kt 下限被推到 0.241 Nm/A,天底禁區隨之長到 1.29°;Pro 的 13A 只需要 0.0139,禁區 0.07°。先選板子再選馬達,等於先把禁區選掉了。
圖 3:現成控制器的覆蓋範圍,跟第 28 篇的文獻覆蓋畫在同一條設計鏈上。兩排的空白重疊在同一格。
階段 BaseCam 這類現成控制器
架構決策(幾軸/直驅或減速/動框架或動鏡)不行,這是你的事
力矩預算、馬達選型不行第 28 篇:整個文獻也沒人做)
驅動能力比對開始有影響——它的驅動分層決定可用電流
三層迴路實作(FOC、速率環、位置環)全包
調參GUI 全包
客製控制律(DOB/ADRC/摩擦前饋)又超出範圍,要自己寫韌體

一句話:BaseCam 在「選完馬達之後、要寫客製控制律之前」那一段最有價值。

圖三把它跟第二十八篇的文獻地圖畫在同一條設計鏈上。上排是八個雲台文獻群的區間聯集,下排是現成控制器的覆蓋範圍——兩排都是程式從資料算出來的,不是我畫上去的。結果是兩邊的空白重疊在同一格:致動器選型

這個重疊值得停下來想一下。文獻沒蓋到那一格,是因為「要多大的馬達」取決於你的酬載、風速、頻寬規格,寫不成有普遍性的論文(第二十二篇當初就是因為查無文獻,才去借航太機構標準)。現成品沒蓋到那一格,是因為它是控制器不是機構設計工具。兩個缺口的成因不同,但落點一樣。

而這正是本站那台雲台馬達選型計算機存在的理由。

五、反向約束:板子會回頭綁死馬達

上面那張表有一列寫著「開始有影響」,值得展開,因為它跟直覺相反。

一般會以為順序是:選馬達 → 選能推動它的板子。但實際上板子的驅動分層會回頭決定馬達的 Kt 下限,進而決定天底禁區

`` 驅動分層 → 每軸可用電流 I → Kt ≥ T_required / I → 天底禁區 = asin(ω_LOS·Kt / (0.7·V_bus)) ``

第二十四篇那組常數(俯仰軸 T_required = 0.1807 N·mV_bus = 24 Vω_LOS = 90°/s)算一遍:

驅動分層 每軸可用電流 需要 Kt ≥ 天底禁區
標準款板載(1.5 A 三軸合計)0.75 A0.2410 Nm/A1.29°
I2C_Drv 客製3.00 A0.0602 Nm/A0.32°
較大的自製驅動6.00 A0.0301 Nm/A0.16°
BaseCamBGC Pro(單軸 13 A)13.00 A0.0139 Nm/A0.07°

選標準款板載驅動,等於把天底禁區選成 1.29°。 沒有人會這樣描述那個決定——買板子的時候想的是「夠不夠推」,不是「正下方多大一圈追不動」。但兩者是同一條式子的兩端。

倍率上,0.75 A 到 13 A 是 17.3 倍的電流,換來的是 1.29° 到 0.07° 的禁區——差不多也是 17 倍(禁區在小角度時近似線性於 Kt)。這條關係很直,沒有轉折點可以取巧。

這條反向鏈就是第二十四篇「兩側夾擊」的第三種寫法:扭力需求從下面頂 Kt,禁區容忍度從上面壓 Kt,而驅動分層決定的是下面那一側頂多高。板子選小了,下限被推上去,可行窗就從下面被吃掉。

六、一個最小可行的建構順序

把前面幾篇的結論串起來,順序大致是這樣——注意前四步都還沒碰到韌體

  1. 定規格θ_max(穩定精度)、f_bw(抗擾頻寬)、可接受的天底禁區、要不要影像去旋轉。
  2. 定架構第 29 篇):幾軸 → 直驅或減速 → 要不要粗精複合 → 動框架或動鏡。
  3. 算力矩第 2324 篇):風阻 + 慣性 + 摩擦,乘安全係數;雙軸還要掃俯仰角。
  4. 選馬達與板子:Kt 下限(扭力)與 Kt 上限(禁區)夾出可行窗;板子的可用電流決定下限那一側。
  5. 裝配:陀螺上內框、編碼器跨關節、STM32 留基座。這一步做錯,後面全部白費。
  6. 由內而外調參第 25 篇):電流環先鎖,再速率環,最後位置環。BaseCam 的 GUI 從這裡開始接手。
  7. 量參數第 27 篇):JBT_c 從機器上量回來,驗證第 3 步的假設。
  8. 量性能第 20 篇):LOS 抖動與抗擾傳遞函數,驗證第 1 步的規格有沒有達到。

第 7、8 步會回頭修正第 3 步——這是正常的,不是失敗。真正的失敗是第 5 步做錯而不自知,因為它不會讓你的迴路發散,只會讓你怎麼調都調不到規格,然後你會去怪控制律。

這篇沒有處理的

  • BaseCam 的具體規格未逐項查證。 表中的電流數字(標準款 1.5 A 三軸合計、Pro 單軸 13 A)沿用本站計算機既有的資料來源,並非我為這篇重新向原廠核對;不同世代的板子與韌體版本差異不小,實際數字請以你手上那塊板的規格書為準。「有沒有支援某顆編碼器」這類問題同理。
  • 沒有涵蓋走線、滑環與電磁相容。 過關節的線是摩擦與可靠度的實際來源,連續旋轉軸還需要滑環,這些都是獨立的題目。
  • IMU 只談了陀螺。 加速度計在雲台上主要用來做重力參考與長期漂移修正,那牽涉到姿態融合(互補濾波或 EKF),是另一篇的份量。
  • 「一顆 STM32 跑三層」是簡化。 實務上電流環常常下放到獨立的驅動晶片或第二顆 MCU,特別是多軸系統。分工位置會變,但分層本身不變。
  • 更新率是量級不是規格。 1 kHz/10 kHz/20 kHz 是這類系統的常見量級,用來說明「差三個數量級」這件事,不是設計值。

想一起把這條線推下去的話

要幫忙判斷一個建構方案,我需要知道:

  • 陀螺打算裝在哪(如果答案是「基座」,我們得先聊這件事)
  • 編碼器是絕對式還是增量式,裝在負載側還是馬達側
  • 板子是現成的還是自製的,可用電流多少
  • 你打算自己寫控制律,還是用現成的調參 GUI
  • 第 1 步那四個規格,有幾個是真的定下來了

缺的就說缺,我不會猜一個值幫你填進去。

參考文獻

  • Kennedy, P. J., & Kennedy, R. L. (2003). Direct versus indirect line of sight (LOS) stabilization. IEEE Transactions on Control Systems Technology, 11(1), 3–15. Link
  • Hilkert, J. M. (2008). Inertially Stabilized Platform Technology: Concepts and Principles. IEEE Control Systems Magazine, 28(1), 26–46.
  • Masten, M. K. (2008). Inertially Stabilized Platforms for Optical Imaging Systems. IEEE Control Systems Magazine, 28(1), 47–64.
  • Ekstrand, B. (2001). Equations of Motion for a Two-Axes Gimbal System. IEEE Transactions on Aerospace and Electronic Systems, 37(3), 1083–1091. Link
  • 驅動分層的電流數字沿用本站「BaseCam 雲台自穩控制方案研究筆記」既有整理,同一份資料也是雲台馬達選型計算機的來源。

上一篇:四個架構決策。要算馬達?雲台馬達選型計算機。想追這個系列?把 LocalPapa Notes 加進書籤。

Dev Log: How the Gimbal, IMU, Encoder and STM32 Fit Together — and When BaseCam Should Enter

This is the thirtieth post in the LocalPapa Notes dev-log series, and the thirteenth on gimbals.

The previous twelve built up a fair amount: how to compute torque, how to size a two-axis gimbal, how to split bandwidth across three loops, how to measure the parameters back off the machine, what the literature's division of labour looks like, how to decide the architecture.

All of that is about how to compute. None of it is about how to assemble.

Someone asked me a very basic question: the gimbal, the IMU, the encoder, the STM32 — how do these four actually fit together? And what is BaseCam's role, at what point should it enter? This post answers that.

The one-sentence version

The IMU and the encoder do not measure the same thing.

The IMU is referenced to inertial space; the encoder to the mechanism itself. With the base still, the two readings agree. The moment the base moves they diverge — and that divergence is the reason the gimbal exists.

Get that sentence, and the division of labour among the four parts falls out on its own.

1. Which layer each part sits on

Hardware x loops: which part sits on which layer, and where feedback comes from Hardware x loops: which part sits on which layer, and where feedback comes from STM32: all three layers Position / track loop about 2.4 Hz Turns "point that way" into a rate command w* 2 Encoder (mechanical angle) / image w* rate command Rate / stabilizationloop about 12.0 Hz Turns "hold the line of sight still" into atorque command T* — this layer is the gimbal IMU gyro (inertial rate) T* torque command Current loop (FOC) about 1.7 kHz Turns T* into three-phase voltage, andhandles commutation 1 Encoder (electrical angle) + currentsense V three-phase voltage Plant: motor +mechanism Where disturbance enters: base motion, wind,friction, backlash no feedback here, only disturbance 1 and 2 are two uses of one encoder. Commutation wants the rotor's electrical angle: fast, and it need not be absolutely accurate. The position loop wants the joint's mechanical angle: slow, but it must be absolutely accurate. Different requirements — so"we have an encoder" does not mean both are solved.The IMU and the encoder do not measure the same thing. The IMU is referenced to inertial space, the encoder to the mechanismitself. With the base still they agree; the moment the base moves they diverge — and that divergence is exactly what the gimbalexists to fight.
Figure 1: the three loops from outside in, each piece of hardware on its own layer, and two feedback paths of entirely different character.
Part Layer Update rate What it measures / does
STM32all threeFOC commutation, rate loop and position loop all run on it
IMU (gyro)rate-loop feedbackabout 1 kHzLOS angular rate in inertial space
Encoderposition-loop feedback + FOC commutationabout 10 kHzjoint angle and rotor angle of the mechanism
Motor + mechanismplantwhere disturbance enters

The bandwidth plan is post 25's: position loop 2.4 Hz, rate loop 12 Hz, current loop about 1.7 kHz, PWM 20 kHz.

Worth noting: the middle layer is the gimbal. The position loop decides where to point, which is a mission-layer concern. The current loop decides how to produce torque, which is a drive-layer concern. The thing actually fighting airframe motion — the thing that determines whether this gimbal is any good — is the rate loop, and its only source of feedback is that gyro.

So if you can only get one thing right: mount the gyro in the right place and tune the rate loop.

2. One encoder, two entirely different requirements

The encoder has two independent uses, and they get conflated constantly.

Use one: FOC commutation. It wants the rotor's electrical angle. The requirement is speed — it has to keep up with PWM, on the order of 10 kHz — but it need not be absolutely accurate, because commutation only cares where the rotor is relative to the stator, and a fixed offset can be absorbed by a startup alignment.

Use two: position-loop feedback. It wants the joint's mechanical angle. The requirement is absolute accuracy — a 2.4 Hz loop asks nothing of speed, but if the reading carries a 0.5° absolute offset, your gimbal will point 0.5° wrong very stably, with no way to notice from the inside.

The two requirements point in different directions, so "we have an encoder" does not mean both are solved. Concretely:

  • Incremental encoders (ABZ) do not know where they are at power-up; they need an index pulse or an alignment routine. Commutation can live with that (one twitch at startup and it is aligned). The position loop cannot — you do not want the gimbal to sweep itself every time it boots.
  • Absolute encoders (SPI magnetic, the AS5048 class) know the angle at power-up and can serve both. This is why gimbals almost always use absolute encoders.
  • With gearing, does the encoder go on the load side or the motor side? Motor side favours commutation (the electrical angle is directly available); load side favours the position loop (backlash does not enter the error). This is a side benefit of post 29's "direct drive" conclusion: with direct drive the two sides are the same place, and the trade-off disappears.

3. Physical placement matters more than the wiring diagram

Physical placement: a correct wiring diagram still will not stabilize a misplaced part Physical placement: a correct wiring diagram still will not stabilize a misplaced part Airframe (base) Azimuth axis Azimuth yoke Lens Inner frame + camera Elevation axis E E IMU MCU Where Why How fast IMU (gyro) about 1.0 kHz Inner frame, same rigid body as the camera What you need is the camera's rate in inertial space; anywhere elsemeasures something else Encoders x2 about 10.0 kHz One per joint, measuring the relative angle across it Electrical angle for commutation, mechanical angle for the position loop— one part, two uses STM32 PWM 20.0 kHz Base or azimuth yoke — no need to ride the elevation axis All three loops run on it; riding the axis only adds a cable bundle Motors x2 Both joints, direct drive (post 29's conclusion) The plant itself Common mistake: mounting the IMU on the base That measures the airframe's motion, not the line of sight's. The rate loop would stabilize the base, while the camera hangs off the farside of two joints — and this gyro cannot see either joint move. A gyro on the inner frame measures the LOS directly. A gyro on the base plus encoder arithmetic measures it indirectly, and that path accumulates every bit of compliance and backlash in the mechanism. Kennedy & Kennedy (2003) compares exactly these tworoutes.Encoder and current sampling are tied to commutation, making them the two fastest links in the system; the position loop runs at 2.4 Hz, three orders of magnitude slower. The same encoder feeds both ends.
Figure 2: a section view of a two-axis gimbal, plus where each part goes, why it goes there, and how fast it runs.

However correct the wiring diagram, a misplaced part will still not stabilize. Three rules.

The IMU must be on the inner frame, on the same rigid body as the camera. What you need is the camera's rate in inertial space, not something else's. Mount it on the base and you measure the airframe's motion — the rate loop will stabilize the base, while the camera hangs off the far side of two joints whose angular motion this gyro cannot see at all.

This is not an implementation detail, it is an architectural fork. Kennedy & Kennedy (2003) splits it into two routes:

  • Direct: the gyro sits on the stabilized body (the inner frame) and measures the LOS directly.
  • Indirect: the gyro sits on the base, and the LOS is computed from encoder readings.

The indirect path accumulates every bit of compliance and backlash in the mechanism — and post 29 worked out that a harmonic drive's backlash alone is 2.9 to 8.7 times θ_max = 0.1 mrad. So indirect measurement is basically not viable for a high-precision gimbal unless the mechanism is stiff enough for the error to be negligible.

The encoder straddles the joint. It measures a relative angle, not an absolute attitude. The azimuth one measures the yoke relative to the base; the elevation one measures the inner frame relative to the yoke.

The STM32 can stay on the base or the azimuth yoke — it does not have to ride the elevation axis. All three loops run on it, but it does not need to share a body with the thing being stabilized. Making it ride along only adds a cable bundle crossing a joint — and cables crossing joints are themselves one source of post 23's friction term.

On the update rates: encoder and current sampling are tied to commutation, making them the two fastest links in the system (10 kHz, 20 kHz). The gyro is around 1 kHz. The position loop is 2.4 Hz — three orders of magnitude slower. The same encoder feeds both the fastest and the slowest end.

4. Where BaseCam actually helps

What an off-the-shelf controller covers — and where it overlaps the literature gap What an off-the-shelf controller covers — and where it overlaps the literature gap Architecture Structure Motor sizing Transmission Sensing Control law Application Gimbal literature (post 28, all 8 clusters) BaseCam-class off-the-shelf controllers fully covered interface only, content is yours Covered by neither the literature nor the product — this cell is on you Reverse constraint: driver tier -> available current -> Kt floor -> nadir keep-out Driver tier Current per axis Kt floor Nadir keep-out Standard onboard (1.5A across 3 axes) 0.75 A 0.2410 Nm/A 1.29° I2C_Drv custom 3.00 A 0.0602 Nm/A 0.32° Larger custom driver 6.00 A 0.0301 Nm/A 0.16° BaseCamBGC Pro (13A per axis) 13.00 A 0.0139 Nm/A 0.07° The top bar is the union of post 28's eight gimbal clusters; the bottom bar is what an off-the-shelf controller covers.Both are computed, not drawn. Their blanks overlap on one cell: motor sizing. And the arrow below shows it is not merelyblank — the board you pick reaches back and pins the motor. Onboard drive gives 0.75A per axis, pushing the Kt floor to0.241 Nm/A and growing the keep-out to 1.29 degrees; the Pro's 13A needs only 0.0139, for 0.07 degrees. Choosing the boardbefore the motor means the keep-out was chosen for you.
Figure 3: what an off-the-shelf controller covers, drawn on the same design chain as post 28's literature coverage. The two blanks overlap on one cell.
Stage BaseCam-class off-the-shelf controller
Architecture (axis count / direct or geared / frame or mirror)No. This is on you
Torque budget, motor sizingNo (post 28: the literature does not do it either)
Comparing drive capabilityStarts to matter — its driver tier sets the available current
Implementing the three loops (FOC, rate, position)All of it
TuningAll of it, via the GUI
Custom control law (DOB / ADRC / friction feedforward)Out of scope again — you write firmware

In one line: BaseCam is most valuable in the stretch after you have chosen the motor and before you need a custom control law.

Figure 3 puts it on the same design chain as post 28's literature map. The top bar is the union of the eight gimbal-literature clusters; the bottom bar is what the off-the-shelf controller covers — and both are computed from data, not drawn by me. The result: the two blanks overlap on one cell, motor sizing.

That overlap is worth pausing on. The literature misses that cell because "how big a motor" depends on your payload, airspeed and bandwidth spec, which does not make a paper with general validity — post 22 went and borrowed aerospace mechanism standards precisely because nothing else was there. The product misses that cell because it is a controller, not a mechanism design tool. Different causes, same landing spot.

Which is exactly why this site has a gimbal motor sizing calculator.

5. The reverse constraint: the board reaches back and pins the motor

One row above says "starts to matter", and it deserves unpacking, because it runs against intuition.

The assumed order is: pick the motor, then pick a board that can drive it. In practice the board's driver tier reaches back to set the motor's Kt floor, and through it the nadir keep-out:

`` driver tier → available current I per axis → Kt ≥ T_required / I → keep-out = asin(ω_LOS·Kt / (0.7·V_bus)) ``

Running that with post 24's constants (elevation axis T_required = 0.1807 N·m, V_bus = 24 V, ω_LOS = 90°/s):

Driver tier Current per axis Kt floor Nadir keep-out
Standard onboard (1.5 A across 3 axes)0.75 A0.2410 Nm/A1.29°
I2C_Drv custom3.00 A0.0602 Nm/A0.32°
Larger custom driver6.00 A0.0301 Nm/A0.16°
BaseCamBGC Pro (13 A per axis)13.00 A0.0139 Nm/A0.07°

Picking the standard onboard driver is picking a 1.29° nadir keep-out. Nobody describes the decision that way — when you buy the board you are thinking "is it enough to drive it", not "how big a patch straight below can I not track". But they are two ends of the same equation.

In ratios: 0.75 A to 13 A is 17.3× the current, buying 1.29° down to 0.07° of keep-out — also about 17×, since at small angles the keep-out is nearly linear in Kt. The relationship is straight; there is no knee to exploit.

This reverse chain is a third way of writing post 24's "squeezed from both sides": torque demand pushes Kt up from below, keep-out tolerance presses it down from above, and the driver tier decides how high that lower bound sits. Undersize the board and the floor rises, eating the feasible window from underneath.

6. A minimum viable build order

Stringing the previous posts together, the order looks roughly like this — note that the first four steps never touch firmware:

  1. Fix the spec: θ_max (stabilization accuracy), f_bw (rejection bandwidth), acceptable nadir keep-out, whether image derotation is needed.
  2. Fix the architecture (post 29): axis count → direct or geared → coarse-fine or not → frame or mirror.
  3. Compute torque (posts 23 and 24): wind + inertia + friction, times the safety factor; for two axes, sweep elevation as well.
  4. Pick the motor and the board: the Kt floor (torque) and the Kt ceiling (keep-out) bracket a feasible window, and the board's available current sets the floor.
  5. Assemble: gyro on the inner frame, encoders across the joints, STM32 on the base. Get this wrong and everything after it is wasted.
  6. Tune inside out (post 25): lock the current loop, then the rate loop, then the position loop. This is where BaseCam's GUI takes over.
  7. Identify the parameters (post 27): measure J, B and T_c off the machine and check step 3's assumptions.
  8. Measure performance (post 20): LOS jitter and the disturbance-rejection transfer function, to check whether step 1's spec was met.

Steps 7 and 8 will send you back to revise step 3. That is normal, not failure. The real failure is getting step 5 wrong without knowing it — it will not make your loops diverge, it will just make the spec unreachable no matter how you tune, and then you will blame the control law.

The limits of this post

  • BaseCam's specifics were not verified item by item. The current figures in the table (1.5 A across three axes for the standard board, 13 A per axis for the Pro) come from this site's existing source material for the calculator, not from a fresh check with the vendor for this post. Board generations and firmware versions differ meaningfully; use the datasheet for the board in your hand. The same caveat applies to questions like "is this particular encoder supported".
  • Cabling, slip rings and EMC are not covered. Cables crossing joints are a real source of friction and of reliability problems, and a continuously rotating axis needs a slip ring. Separate topics.
  • Only the gyro half of the IMU is discussed. The accelerometer is mainly used for a gravity reference and long-term drift correction, which pulls in attitude fusion (complementary filter or EKF) — a post of its own.
  • "One STM32 runs all three layers" is a simplification. In practice the current loop is often pushed down into a dedicated driver chip or a second MCU, especially in multi-axis systems. Where the work sits changes; the layering does not.
  • The update rates are orders of magnitude, not specifications. 1 kHz / 10 kHz / 20 kHz are typical for this class of system, used here to make the point that they are three orders apart.

How to work through this with me

To help judge a build, I need to know:

  • Where the gyro is going (if the answer is "the base", we need to talk about that first)
  • Whether the encoder is absolute or incremental, and whether it sits on the load side or the motor side
  • Whether the board is off-the-shelf or custom, and how much current it can supply
  • Whether you intend to write your own control law, or use the existing tuning GUI
  • How many of step 1's four specs are actually fixed

If something's missing, say it's missing — I won't guess a value and fill it in for you.

References

  • Kennedy, P. J., & Kennedy, R. L. (2003). Direct versus indirect line of sight (LOS) stabilization. IEEE Transactions on Control Systems Technology, 11(1), 3–15. Link
  • Hilkert, J. M. (2008). Inertially Stabilized Platform Technology: Concepts and Principles. IEEE Control Systems Magazine, 28(1), 26–46.
  • Masten, M. K. (2008). Inertially Stabilized Platforms for Optical Imaging Systems. IEEE Control Systems Magazine, 28(1), 47–64.
  • Ekstrand, B. (2001). Equations of Motion for a Two-Axes Gimbal System. IEEE Transactions on Aerospace and Electronic Systems, 37(3), 1083–1091. Link
  • The driver-tier current figures come from this site's existing "BaseCam gimbal stabilization research notes", the same source that backs the gimbal motor sizing calculator.

Previous post: Four Architecture Decisions. Want to size a motor? Gimbal Motor Sizing Calculator. Want to follow the series? Bookmark LocalPapa Notes.

探索 61 個隱私優先的瀏覽器工具
全程本地運算、檔案不上傳。
前往 LocalPapa →
Explore 61 privacy-first browser tools
Everything runs locally — your files never leave your device.
Visit LocalPapa →

想看英文版?點右上角 EN 切換語言。

Prefer Chinese? Tap at the top-right to switch.