Bayley Wang / foc-ed_in_the_bot_compact

robot

Dependencies:   FastPWM3 mbed

Committer:
bwang
Date:
Thu May 04 17:35:10 2017 +0000
Revision:
155:7c6005933d4c
Parent:
152:6877dceec871
Child:
157:a9b2002994d5
05/04/2017 13:34 - changed logic in PwmIn::handle_fall, which no longer resets timer on invalid edges

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bwang15:b583cd30b063 1#ifndef __CONFIG_LOOP_H
bwang15:b583cd30b063 2#define __CONFIG_LOOP_H
bwang15:b583cd30b063 3
bwang22:72840d3db788 4#include "config_inverter.h"
bwang22:72840d3db788 5
bwang120:57b6f3b1356b 6#define K_LOOP_D 0.75f
bwang90:2ef53b1a22de 7#define KI_BASE_D 0.025f
bwang62:581aa9235ad6 8
bwang120:57b6f3b1356b 9#define K_LOOP_Q 1.75f
bwang90:2ef53b1a22de 10#define KI_BASE_Q 0.01f
bwang62:581aa9235ad6 11
bwang152:6877dceec871 12#define F_SLOW_LOOP 50.0f
bwang15:b583cd30b063 13
bwang15:b583cd30b063 14#define INTEGRAL_MAX 1.0f
bwang15:b583cd30b063 15
bwang39:80b38a8e1787 16/*filter strengths, 0-1.0
bwang39:80b38a8e1787 17 higher = stronger filtering*/
bwang93:e7e45957f496 18#define DQ_FILTER_STRENGTH 0.80f
bwang74:f10cb573d7ca 19
bwang154:0a22dcf91577 20/*windows for median filtering*/
bwang152:6877dceec871 21#define THROTTLE_FILTER_WINDOW 7
bwang152:6877dceec871 22#define W_FILTER_WINDOW 3
bwang15:b583cd30b063 23
bwang44:3fd6a43b91f0 24/*internally computed*/
bwang93:e7e45957f496 25#define KP_D (K_LOOP_D / BUS_VOLTAGE / MODULATION_MAX)
bwang93:e7e45957f496 26#define KI_D (KI_BASE_D * K_LOOP_D / BUS_VOLTAGE * 5000.0f / F_SW / MODULATION_MAX)
bwang58:7316c5a4c417 27
bwang93:e7e45957f496 28#define KP_Q (K_LOOP_Q / BUS_VOLTAGE / MODULATION_MAX)
bwang93:e7e45957f496 29#define KI_Q (KI_BASE_Q * K_LOOP_Q / BUS_VOLTAGE * 5000.0f / F_SW / MODULATION_MAX)
bwang58:7316c5a4c417 30
bwang44:3fd6a43b91f0 31#define SLOW_LOOP_COUNTER ((int) (F_SW / F_SLOW_LOOP))
bwang44:3fd6a43b91f0 32
bwang15:b583cd30b063 33#endif