Monday, September 15, 2014

Software architecture




Resources used for this research:


ROS: http://www.ros.org/

Crazyflie node: https://github.com/jlamyi/crazyflie

Crazyflie pc client: https://github.com/bitcraze/crazyflie-clients-python (x-mode is not supported in this version)

Crazyflie firmware: 



Monday, September 1, 2014

Vertical fly test

Goal: To make crazyflie to fly straight vertically with different thrust values

      Crazyflie was tested with default firmware, and below data are initial test parameters

Test vehical: crazyflie-ch10
PID control parameters:

#define PID_ROLL_RATE_KP  70.0
#define PID_ROLL_RATE_KI  0.0
#define PID_ROLL_RATE_KD  0.0
#define PID_ROLL_RATE_INTEGRATION_LIMIT    100.0

#define PID_PITCH_RATE_KP  70.0
#define PID_PITCH_RATE_KI  0.0
#define PID_PITCH_RATE_KD  0.0
#define PID_PITCH_RATE_INTEGRATION_LIMIT   100.0

#define PID_YAW_RATE_KP  50.0
#define PID_YAW_RATE_KI  25.0
#define PID_YAW_RATE_KD  0.0
#define PID_YAW_RATE_INTEGRATION_LIMIT     500.0

#define PID_ROLL_KP  3.5
#define PID_ROLL_KI  2.0
#define PID_ROLL_KD  0.0
#define PID_ROLL_INTEGRATION_LIMIT    20.0

#define PID_PITCH_KP  3.5
#define PID_PITCH_KI  2.0
#define PID_PITCH_KD  0.0
#define PID_PITCH_INTEGRATION_LIMIT   20.0

#define PID_YAW_KP  0.0
#define PID_YAW_KI  0.0
#define PID_YAW_KD  0.0
#define PID_YAW_INTEGRATION_LIMIT     360.0


#define DEFAULT_PID_INTEGRATION_LIMIT  5000.0


Thrust = 59000 (Crazyflie accelerates from 41000 to 59000 at 6 seconds):




   When thrust = 60000, data above shows that pitch has an error of  <1 degree, and roll has an error of <1.5 degrees. Crazyflie keeps flying straight vertically with thrust = 60000.


Thrust = 50000:




       When thrust = 50000, Crazyfile is unstable, and flies over different positions. Pitch has an error of 7.7 degrees at most, and roll maintains an error of <2 degrees.


Thrust = 41000:


      It is hard to collect valid data for this test since it crashes very soon after it takes off and reaches 41000

Saturday, August 30, 2014

PID tuning 7-31

PID tuning

      Setup for tuning:


    Kp, kd and ki were tested with different values to make crazyflie stable. Ki was always set to be zero. Kp and kd were increased until reach the point of instability, and then they were tuned down 5 - 10 points.

   It turns out that 30 to 40 are the suitable values for kp (both for pitch and roll) in the test:



     Ki was modified to be 100 (both for pitch and roll), and violent vibrations happened:

        
    A problem happens during the test. Crazyflie could not be changed into X-mode. This reason probably contributes to the difference between experimental coefficient values and theoretical values.


Pitch control

Crazyflie ROS node

      In this test, a crazyflie script was executed in ROS and modified to implement controllers, and output information such as time, pitch, roll, cmd_pitch, cmd_roll and other data from crazyflie.



Pitch control

    Goal: To make crazyflie stable at 15 degrees of pitch.

    Test with only PID control on its own firmware, it stabilizes at 15 degrees as expected finally:

           

    Data from test (thrust = 41000, crazyflie-ch10, cmd_pitch = 15.0):

   
     The data above show that the actual pitch oscillates around 15 degrees with its own PID control, and has an error of  + 0~15 degree (actual pitch is at a range of 15 to 30 degrees) (for pitch_ki = 2.0, pitch_kp = 3.5, pitch_kd = 0) (test for 120 seconds).

     When thrust is increased to 60000 (thrust = 60000, crazyflie-ch10, cmd_pitch = 15.0):



     Actual pitch is very close to cmd_pitch in the first 17 seconds, which has only +1 degree of error. (this is more accurate than when thrust = 41000) However, after the first 17 seconds, the error increase rapidly as time increases. When in the 30th second, actual pitch reaches 74 degrees! (unstable at the end)

     The guess of the reason is that yaw control is not good enough. Because when thrust was increased a lot, actual yaw changes much faster. Above pictures show that actual yaw changes from 144 to 108 degrees as the pitch error increases from 1 to 60 degrees. The fast change of yaw may contribute to a larger pitch error.

     Test with proportional control on crazyflie ros node and PID control on firmware. It was unstable and behaviors crazily:



Sunday, August 10, 2014

Assembly and flight test 7-2

     The Crazyflie Nano Quadcopter is a miniature quadcopter that fits in hand. It only weights about 19 grams and is 9 cm motor-to-motor.


     Here’are the specifications of the Crazyflie Nano Quadcopter 10-DOF version:
  • Small and lightweight, around 19g and about 90mm motor to motor
  • Flight time up to 7 minutes with standard 170mAh Li-Po battery
  • Standard micro-USB connector for charging which takes ~20min for the stock 170mAh Li-Po battery
  • On-board low-energy radio@1mW based on the nRF24L01+ chip. Up to 80m range (environment dependent) when using the Crazyradio USB dongle
  • Radio bootloader which enabled wireless update of the firmware
  • Powerful 32 bit MCU: STM32F103CB @ 72 MHz (128kb flash, 20kb RAM)
  • 3-axis high-performance MEMs gyros with 3-axis accelerometer: Invensense MPU-6050
  • Expansion header 2×10 pins 1.27mm (0.05”) pitch including power, I2C/UART, SPI/ADC. Header also contains ARM Cortex 10-pin JTAG (header not included)
  • 4-layer low noise PCB design with separate voltage regulators for digital and analog supply
  • 3-axis magnetometer HMC5883L (compass)
  • High precision altimeter MS5611-01BA03



     Since it is design with 4-layer low noise PCB, it is hard to get solder out if it is stuck in soldering holes. It was a lesson learned in soldering the motors on :)
 


      The first flight test for crazyflie on July 2nd. Before this test, DroidMote was used for controlling with an android device. However, it depends on wifi network too much, so it was given up. In this test, Crazyflie was controlled by an xbox controller with PC Crazyflie-client. Due to that the controller is not tuned, crazyflie could not flies stably as expected but is tend to move to one direction.