2016年6月2日 星期四

雲台抖動與果凍效應



1. 雲台先決?大錯特錯!
大家觀察一下雲台,不難發現雲台物理上限制了它只能修正三軸上的“轉動”。無法修正三軸線快速位移造成的抖動。 減震球故名思議是減震!不是減抖。市面上的三軸雲台在修正角度這方面通通半斤八兩。 沒有什麼好壞。差別在於好不好配減震球罷了。
1.果凍與抖動
務必把果凍與抖動分清楚。果凍效應是來自掃描式觀光元件在掃描時高頻振動造成錯位。 這是振動造成的沒有疑問。 抖動本身是整個雲台跟相機在一起抖。 抖不是振,抖相對低頻了很多。 
果凍是相機沒有做好減震。
抖動是飛機的問題。
3. 飛機雲台,一半一半
為什麼雲台會抖動?原因不少。不良設計的機架,安裝不當。減震阻尼過軟,雲台本身太輕,飛控修正過慢,轉速過低的槳,太軟的槳。 都有可能造成如此結果。
所有我個人認為航拍不穩定,飛機本身有很大的責任。
4. APM 體系的建議- 加STAB_P
目前看到大部分的APM體系的飛控大家的STAB_P 太低了。 只有3~4左右。
APM 的控制圈中 STAB_P 太低會造成修正不夠多。我看過有人說STAB_P是調手感的。也許就是STAB_P過低的原因?
5. 其他建議
飛機重量要夠,不然就是槳小。 轉速很重要,很重要。 共軸雙槳單槳可以低一點,但是平鋪的四 六 八 軸,轉速還是要高一點為妙。
雲台減震建議偏軟一點點。
6. 一些心得
然後要如何確定修正夠不夠?讓鏡頭拍飛機的腳。正確的表現應該要在旋停時腳不會快速晃動,應該要穩穩的,最多有一點修正姿態的位移。
看減震球會不會太軟?用力戳一下中心板,看雲台會不會抖。 如果微微抖兩下那應該是剛好。 如果抖的持續時間有點長,可以加硬減震球,如果在加就太硬了,會有果凍的話。 可以加點球的數目。
如果都不行,可以求助奇門組件。比如海綿,耳塞,鋼絲。。。
7. 隨意整理了一下,應該價值頗多。 這裡寫的有些東西是瞎試很久也很難試出來的。可以寫的太多了。就先這樣吧!


===========================================================

其實只要能消掉震動~ 
剩下的抖動從軟體後製下手都有不錯的效果~
我覺得三軸雲台用來緩衝 Yaw 是他最主要的功能,

XD 震動或抖動我會乖乖地從雲台PID 或 飛機的PID下手.


我覺得自己玩下來抖動才真的是要研究的東西~
XD 不知道郭大對於空拍用的PID有沒有什麼心得可以分享~
STAB_P 調高姿態修正會比較快~ 可是抖動多半是姿態修正而產生的,

XD 那到底是要他修正快一點~還是修正慢一點哪個會比較穩~
好像就又有一點難取捨了...


非常棒的分享,另外果凍還有一招可以用減光鏡去降低快門越亮的環境需要減越多

===================================================================

郭大對於振動的分析很清楚,其實應該不少人都在調雲台這塊上面花了很多心力,相對的也都各自有得到一些經驗。
撇開大疆那種作弊雲台不說,一般自組機加上市售/自組雲台,仔細看畫面邊緣配合風切聲就可以發現,風吹來的時候,幾乎沒有不經軟體修正就可以讓畫面完全沒有振動的,輕微的可以用軟體後製來修正,嚴重的振動就要調整雲台減震機構或機身/雲台PID。


空拍畫面的振動跟抖動之中,最討厭的就是果凍,因為果凍很難用軟體消除!我趁機搭順風車分享一下我跟果凍奮戰的經驗。
果凍通常是來自於相對較低頻的震動,也就是減震球濾不掉的部份,尤其是低轉速配大槳,平衡一不對就是果凍吃到飽。這時候的作法就是從最基本的機身振動平衡開始下手。
槳靜平衡-->馬達動平衡-->槳裝上馬達之後的整體動平衡。
槳的靜平衡:大家應該都很清楚不用我多嘴,我們就跳過XD
馬達動平衡:可以看一下這段影片,很詳細。
http://m.youtube.com/watch?v=RItntpZZH4g
補充一點就是,有時候在50%油門的部份已經調到很穩了,移到30%或70%震動卻又變大,這表示平衡還是沒有配好,只是50%的地方剛好震動互相抵消而已,通常很難全段油門都平衡不震動,建議針對常用油門區間(比方說35%~80%)去調整就好,太低的跟太高的油門使用率很低可以放生。
組合動平衡:有時候明明前面兩個都平衡好了,最後一個整體動平衡卻往往鬼打牆似的抖起來,我困擾了很久,後來才發現槳的品質影響也很大,爛槳有可能靜平衡ok了,一轉起來卻因為左右螺距的差異讓鼓風的力道不同而產生振動,所以槳的錢不要省,一樣是1555碳纖槳,價格可以從幾百到破千,這價差不是沒有原因的。
另一個就是快拆槳座/子彈頭,快拆槳座一定要跟著馬達一起跑動平衡,不然就沒意義了,好的快拆槳座虛位小結構又穩固,至於那種夾馬達軸心的子彈頭,根本震動大魔王來著,請直接扔掉XD

最後提一下摺疊槳,折疊槳是給有愛或是人品爆發的人玩的,我的愛有限,人品也不好,所以我放棄用折疊槳

一點經驗分享,還請大家多多指教。


======================================================================

上面這位神人就是拼影片直出不後製除震的一員 。誠如郭兄所言,該優先處理的是機子飛行中帶來的震動,處理好了再來著眼雲台,因此絕對不是雲台先決。拿個生活中的例子來說,開車走爛馬路震得很不舒服,所有人都該去換車子避震器嗎?政府難道不該把馬路修平修好嗎?

2016年5月29日 星期日

Build tower app



Build Setup Android Studio

Fredia Huya-Kouadio edited this page on 4 Oct 2015 · 4 revisions

Android Studio environment setup

Tower is configured to use Android Studio, so you'll need to download Android Studio.
Once Android Studio is installed and running, choose Import Project and navigate to your localtower folder. Choose the build.gradle file and Android Studio should import and open the project.

Building the app

You should now be ready to build and run the app on your test device.
The first time you try to run the application you'll need to set up your Run/Debug Configuration.
Choose Run > Edit Configurations... and click the '+' symbol at the top left of the window. Enter a name for the configuration at the top of the window ('Tower' is fine), then select 'Android Application.'
Now choose 'Tower' in the Module dropdown and 'USB Device' under the Target Device section.
Save these settings, then connect your Android device via USB and choose Run > Debug. At this point the app should install and launch on your device. If you are having trouble, feel free to ping the developers on the gitter channel.


Ref : https://github.com/DroidPlanner/Tower/wiki/Build-Setup---Android-Studio

follow me explain


Follow Me is now supported for all 3DR copters running ArduCopter version 3.2! For instructions on how to update the ArduCopter firmware on your vehicle, view the video tutorial here.
Follow Me is an advanced in-flight feature of Tower that uses an Android phone or tablet as a virtual tether, allowing the drone to track you with the camera as you move.
You’ll need one person–the actor–that will carry the ground station and be followed by the drone, and one person–the operator–that will carry the controller and be ready to regain manual control at any time. 3DR’s 3PV™ (Third Person View) Follow Me technology requires a GPS enabled Android device with OTG USB.
In order to use Follow Me, you’ll first need to connect to Tower.

Start Follow Me

When you’re ready to start, take off in loiter (LTR), and climb to the altitude that you want the drone to maintain during Follow Me. Don’t forget to turn on your camera before takeoff! To activate Follow Me, select Follow on Tower.




When Follow Me is activated, you will see Guided as the mode at the top of the screen.



If the Follow-Me icon turns red, Tower is searching for GPS on your device. When the device acquires a strong GPS lock, the icon will turn blue and Follow Me will activate.





Angles

Follow Me features six angles to compose your shot. Select the name of the angle to choose from the drop-down menu.

Leash
The drone follows behind the actor at a specified distance.
Lead
The drone flies in front of the actor, facing towards them and maintaining a specified distance.
Left/Right
The drone keeps pace with the actor on either their left or right side, faces towards them, and maintains a specified distance.
Circle
The drone flies a circle pattern around the actor at a specified radius, facing in.

Altitude

When activated, Follow Me will maintain the drone’s current altitude. To adjust the radius during Follow Me, select the + and – options under “Altitude” to increase or decrease the altitude by one meter. Tower will display the current target altitude in parentheses.

Radius

The radius determines the horizontal distance between the actor and the drone. Each angle has a specified default radius that will be used when you activate Follow Me.
AngleDefault Radius
Leash8 m
Lead15 m
Left/Right10 m
Orbit15 m
Above*0 m
To adjust the radius during Follow Me, select the + and – options under “Radius” to increase or decrease the radius by one meter. Tower will display the current radius in parentheses.

Safety

To switch out of Follow Me from Tower the actor can tap “Loiter”. The drone must have GPS lock to engage loiter mode. To switch out of Follow Me using the controller, the operator can switch into standard (altitude hold) and regain manual control or switch RTL ON to recall the drone to the launch point. To switch into loiter using the controller, the operator must switch into standard and back into loiter.

GPS Failsafe

Follow Me requires GPS lock. If the drone loses GPS lock during Follow Me, it will initiate a GPS failsafe and switch to standard manual flight (altitude hold mode). If this is occurs, the drone will immediately transfer manual control to the operator. Because of this, the operator should ensure that the throttle stick is set to center position at all times during Follow Me.

Pebble Watch Control

To control the drone using a Pebble watch, make sure the Pebble is synced and connected to your tablet. In Tower, select the Tower logo in the top-left corner of the screen, select Settings, and select Update Pebble. The Tower app will automatically launch onto the Pebble.




Ref : https://3dr.com/kb/follow-instructions/

2016年4月21日 星期四

apm setup




必要硬體設定


在初次設定中,其中一步就是您必須使用Mission Planner來設定一些必要的硬體組件,此頁面將詳細介紹您選擇機架方向、設定RC搖控器/接收機、及校正羅盤及加速度計的流程。

選擇機架類型

在Mission Planner的Initial Setup畫面中選擇Mandatory Hardware > Frame Type。選擇對應您飛行器的機架類型。而方向的話預設的情況下是設定為X,如果您想讓其中一個機臂朝向前方請選擇Plus(+)的設定,對於三軸飛行器(Tricopter)、傳統直升機及Y6,是不理會機架類型的。
(如果是H型機架的四軸飛行器請在Advanced Parameter頁籤中將此選項設為3,並且為了使用H型機架的架構將左後方及右後方的螺旋槳交換,同時反轉這兩個馬達的旋轉方向(透過交換馬達的兩根線),並將前面兩個馬達也使用同樣步驟操作。

校正羅盤

要執行基礎的羅盤校正請跟隨下列步驟:
  • Intial Setup > Mandatory Hardware選擇Compass,並選擇您羅盤擺放位置的正確設定。
  • 請確定EnableAutoDec的核選方塊已勾選。
  • 點選 “Live Calibration” 按鈕。
  • 下一步請選擇您飛控的設定,如果是Pixhawk或是PX4請選擇有Pixhawk圖片的Pixhawk/PX4的選項。如果是APM2.6請選擇有GPS+羅盤模組圖片的APM with External Compass選項,這些選項將會自動幫您輸入對應您飛控板的正確數值,請確定您在安裝GPS+羅盤模組時,上面的箭頭是與飛控上的前頭一樣朝著飛行器的正前方。
  • 這時將會彈出一個視窗告知您有60秒的時間來將APM/PX4繞著所有的軸向來旋轉,請點選"OK"。
  • 接著會有一個顯示Mission Planner正在收集羅盤資料的倒數計時畫面。
  • 接著在這60秒內您必須抓住您的飛行器在控中慢慢的旋轉讓每一面(前方、後方、左方、右方、上方及下方)都朝著地面數秒鐘。
  • 當完成之後會有另一個視窗彈出告知您它所計算出來的新差異值。
  • 在APM上,只要全部的三個值都介於-150到150之前就表示這些值正常,請點選"OK"。
  • ,在PX4及Pixhawk上這三個值必須比150大或小於-150,請點選OK。
可人觀看這個影片是一個羅盤校正的範例。
關於更詳細的羅盤校正及其它設定如"compassmot(*)“的設定程序可以在這裡(*)找到。
有關磁力干擾的原因跟減少方法可以在這裡(*)找到。

校正加速度計

在Initial Setup裡從左側選單選擇Accel Calibration。
如果你是使用ArduCopter以上請確定您已勾選AC 3.0+的核取方塊。而如果您是使用2.9.1b(或更早的版本),請不要勾選此核取方塊。在此程序中您須要在過程中將飛行器如下圖所示的每一面依次擺好飛行器,此步驟中的水平位置是否正確是非常重要的,因為這將是飛控在飛行過程中控制您水平姿態的依據。
請不要在每一個步驟按下按鍵後立即移動您的飛行器,要如何放置並保持飛行器可以觀看此影片的範例。
如果您已經準備好要校正了請按下Calibrate Accel
Mission Planner會提示彈出對話框告知您將飛行器放置各個校正方向,過程中會告知您須要放置的方向。(無須一定要去點選Click When Done按鈕)
當Mission Planner如下圖所示的顯示 “Calibration Successful!"表示您已完成了校正程序。

校正搖控器

打開搖控器並確認搖控模式為飛機(APM不管您是使用哪一種平台來飛行,都必須是使用飛機模式),並且將所有的微調(trim)調回中點。
Mode 1搖控器(日本手),是使用左邊搖桿來控制pitch跟yaw,右邊搖桿則是油門跟roll。
Mode 2搖控器(美國手),是使用左邊搖桿來控制油門跟yaw,古邊搖桿則是pitch跟roll。
無論是哪一種搖控器、其中一個三段開關應該設為通道5來控制飛行模式。
另外也可以將旋鈕設為通道6來做為飛行中調參使用,而通道7跟通道8可以設為開關做它其額外的功能。
點選Mission Planner畫面右下方的"Calibrate Radio"按鈕,Mission Planner將會呼叫一個對話框來提醒您是否打開搖控器、電池是否確定沒有接上以及槳是否已拆下。點選OK即可繼續。
點選OK之後,移動搖控器的搖桿及切換開關到各自的移動極限並觀察搖控校準條的結果。在校準條上將會出現紅色的線以標示行程的最大及最小值,最後切換通道5開關及旋轉通道6的旋鈕來確認它們的移動範圍(通道7及通道8在基礎操作中用不到)。
您的搖控器應該要改變成如下的方向:
通道1 : 低位=roll 向左 ; 高位=roll向右。
通道2 : 低位=pitch向前 ; 高位=pitch向後。
通道3 : 低位=油門減少(關閉) ; 高位=油門增加。
通道4 : 低位=yaw向左 ; 高位=yaw向右。
當roll、pitch、油門、yaw及通道5(及可選的通道6、7、8)的校正條上的紅線都設定到各自的最低位及最高位後請點選Click when Done。Mission Planner將會顯示一個校正資料結果的訊息視窗,通常值會落在最小1100及最大1900之間。如果校正條的方向與您搖控器搖桿移動的方向相反代表該通道在您搖控器上設的了反向。可以使用搖控器的通道反向功能來在搖控端將它們轉向到正確的方向。(如果您對這步驟不熟悉可以查看您搖控器材的說明書來設定)

cleanflight code study 00


// mw.c
void taskMainPidLoop(void)
{
    cycleTime = getTaskDeltaTime(TASK_SELF);
    dT = (float)cycleTime * 0.000001f;

    // Calculate average cycle time and average jitter
    filteredCycleTime = filterApplyPt1(cycleTime, &filteredCycleTimeState, 1, dT);
   
    debug[0] = cycleTime;
    debug[1] = cycleTime - filteredCycleTime;

    imuUpdateGyroAndAttitude();

    annexCode();

    if (rxConfig()->rcSmoothing) {
        filterRc();
    }

#if defined(BARO) || defined(SONAR)
    haveProcessedAnnexCodeOnce = true;
#endif

#ifdef MAG
        if (sensors(SENSOR_MAG)) {
            updateMagHold();
        }
#endif

#if defined(BARO) || defined(SONAR)
        if (sensors(SENSOR_BARO) || sensors(SENSOR_SONAR)) {
            if (FLIGHT_MODE(BARO_MODE) || FLIGHT_MODE(SONAR_MODE)) {
                applyAltHold();
            }
        }
#endif

    // If we're armed, at minimum throttle, and we do arming via the
    // sticks, do not process yaw input from the rx.  We do this so the
    // motors do not spin up while we are trying to arm or disarm.
    // Allow yaw control for tricopters if the user wants the servo to move even when unarmed.
    if (isUsingSticksForArming() && rcData[THROTTLE] <= rxConfig()->mincheck
#ifndef USE_QUAD_MIXER_ONLY
#ifdef USE_SERVOS
                && !((mixerConfig()->mixerMode == MIXER_TRI || mixerConfig()->mixerMode == MIXER_CUSTOM_TRI) && mixerConfig()->tri_unarmed_servo)
#endif
                && mixerConfig()->mixerMode != MIXER_AIRPLANE
                && mixerConfig()->mixerMode != MIXER_FLYING_WING
#endif
    ) {
        rcCommand[YAW] = 0;
    }

    if (throttleCorrectionConfig()->throttle_correction_value && (FLIGHT_MODE(ANGLE_MODE) || FLIGHT_MODE(HORIZON_MODE))) {
        rcCommand[THROTTLE] += calculateThrottleAngleCorrection(throttleCorrectionConfig()->throttle_correction_value);
    }

#ifdef GPS
    if (sensors(SENSOR_GPS)) {
        if ((FLIGHT_MODE(GPS_HOME_MODE) || FLIGHT_MODE(GPS_HOLD_MODE)) && STATE(GPS_FIX_HOME)) {
            updateGpsStateForHomeAndHoldMode();
        }
    }
#endif

    // PID - note this is function pointer set by setPIDController()
    pid_controller(
        pidProfile(),
        currentControlRateProfile,
        imuConfig()->max_angle_inclination,
        &accelerometerConfig()->accelerometerTrims,
        rxConfig()
    );

    mixTable();

#ifdef USE_SERVOS
    filterServos();
    writeServos();
#endif

    if (motorControlEnable) {
        writeMotors();
    }

#ifdef USE_SDCARD
        afatfs_poll();
#endif

#ifdef BLACKBOX
    if (!cliMode && feature(FEATURE_BLACKBOX)) {
        handleBlackbox();
    }
#endif
}



src/main/flight/Imu.c




static void imuCalculateEstimatedAttitude(void)
{
    static filterStatePt1_t accLPFState[3];
    static uint32_t previousIMUUpdateTime;
    float rawYawError = 0;
    int32_t axis;
    bool useAcc = false;
    bool useMag = false;
    bool useYaw = false;

    uint32_t currentTime = micros();
    uint32_t deltaT = currentTime - previousIMUUpdateTime;
    previousIMUUpdateTime = currentTime;

    // Smooth and use only valid accelerometer readings
    for (axis = 0; axis < 3; axis++) {
        if (imuRuntimeConfig->acc_cut_hz > 0) {
            accSmooth[axis] = filterApplyPt1(accADC[axis], &accLPFState[axis], imuRuntimeConfig->acc_cut_hz, deltaT * 1e-6f);
        } else {
            accSmooth[axis] = accADC[axis];
        }
    }

    if (imuIsAccelerometerHealthy()) {
        useAcc = true;
    }

#ifdef MAG
    if (sensors(SENSOR_MAG) && isMagnetometerHealthy()) {
        useMag = true;
    }
#endif
#if defined(GPS)
    else if (STATE(FIXED_WING) && sensors(SENSOR_GPS) && STATE(GPS_FIX) && GPS_numSat >= 5 && GPS_speed >= 300) {
        // In case of a fixed-wing aircraft we can use GPS course over ground to correct heading
        rawYawError = DECIDEGREES_TO_RADIANS(attitude.values.yaw - GPS_ground_course);
        useYaw = true;
    }
#endif

    imuMahonyAHRSupdate(deltaT * 1e-6f,
                        gyroADC[X] * gyroScale, gyroADC[Y] * gyroScale, gyroADC[Z] * gyroScale,
                        useAcc, accSmooth[X], accSmooth[Y], accSmooth[Z],
                        useMag, magADC[X], magADC[Y], magADC[Z],
                        useYaw, rawYawError);

    imuUpdateEulerAngles();

    imuCalculateAcceleration(deltaT); // rotate acc vector into earth frame
}


STATIC_UNIT_TESTED void imuUpdateEulerAngles(void)
{
    /* Compute pitch/roll angles */
    attitude.values.roll = lrintf(atan2_approx(rMat[2][1], rMat[2][2]) * (1800.0f / M_PIf));
    attitude.values.pitch = lrintf(((0.5f * M_PIf) - acos_approx(-rMat[2][0])) * (1800.0f / M_PIf));
    attitude.values.yaw = lrintf((-atan2_approx(rMat[1][0], rMat[0][0]) * (1800.0f / M_PIf) + magneticDeclination));

    if (attitude.values.yaw < 0)
        attitude.values.yaw += 3600;

    /* Update small angle state */
    if (rMat[2][2] > smallAngleCosZ) {
        ENABLE_STATE(SMALL_ANGLE);
    } else {
        DISABLE_STATE(SMALL_ANGLE);
    }
}