mirror of
https://github.com/rene-dev/stmbl.git
synced 2026-02-05 18:01:21 +08:00
stmsp fix
This commit is contained in:
@@ -23,7 +23,7 @@ HAL_PIN(q);
|
||||
|
||||
static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_t *pin_ptr) {
|
||||
// struct dq_ctx_t * ctx = (struct dq_ctx_t *)ctx_ptr;
|
||||
struct dq_pin_ctx_t *pins = (struct dq_pin_ctx_t *)pin_ptr;
|
||||
struct dq_sp_pin_ctx_t *pins = (struct dq_sp_pin_ctx_t *)pin_ptr;
|
||||
|
||||
//clarke transformation
|
||||
float a = PIN(a);
|
||||
@@ -44,7 +44,7 @@ static void rt_func(float period, volatile void *ctx_ptr, volatile hal_pin_inst_
|
||||
PIN(q) = q;
|
||||
}
|
||||
|
||||
hal_comp_t dq_comp_struct = {
|
||||
hal_comp_t dq_sp_comp_struct = {
|
||||
.name = "dq_sp",
|
||||
.nrt = 0,
|
||||
.rt = rt_func,
|
||||
@@ -55,5 +55,5 @@ hal_comp_t dq_comp_struct = {
|
||||
.rt_stop = 0,
|
||||
.frt_stop = 0,
|
||||
.ctx_size = 0,
|
||||
.pin_count = sizeof(struct dq_pin_ctx_t) / sizeof(struct hal_pin_inst_t),
|
||||
.pin_count = sizeof(struct dq_sp_pin_ctx_t) / sizeof(struct hal_pin_inst_t),
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ COMPS += shared/comps/sim.c
|
||||
COMPS += shared/comps/term.c
|
||||
COMPS += shared/comps/curpid.c
|
||||
COMPS += shared/comps/svm.c
|
||||
COMPS += shared/comps/dq.c
|
||||
COMPS += shared/comps/dq_sp.c
|
||||
COMPS += shared/comps/idq.c
|
||||
COMPS += shared/comps/pole.c
|
||||
COMPS += shared/comps/map.c
|
||||
|
||||
@@ -126,18 +126,14 @@ struct svm_pin_ctx_t{ // found in shared/comps/svm.c
|
||||
hal_pin_inst_t enw;
|
||||
};
|
||||
|
||||
struct dq_pin_ctx_t{ // found in shared/comps/dq.c
|
||||
struct dq_sp_pin_ctx_t{ // found in shared/comps/dq_sp.c
|
||||
hal_pin_inst_t rt_prio;
|
||||
hal_pin_inst_t frt_prio;
|
||||
hal_pin_inst_t mode;
|
||||
hal_pin_inst_t u;
|
||||
hal_pin_inst_t v;
|
||||
hal_pin_inst_t w;
|
||||
hal_pin_inst_t pos;
|
||||
hal_pin_inst_t polecount;
|
||||
hal_pin_inst_t a;
|
||||
hal_pin_inst_t b;
|
||||
hal_pin_inst_t y;
|
||||
hal_pin_inst_t d;
|
||||
hal_pin_inst_t q;
|
||||
};
|
||||
@@ -261,7 +257,7 @@ extern const hal_comp_t sim_comp_struct; // found in shared/comps/sim.c
|
||||
extern const hal_comp_t term_comp_struct; // found in shared/comps/term.c
|
||||
extern const hal_comp_t curpid_comp_struct; // found in shared/comps/curpid.c
|
||||
extern const hal_comp_t svm_comp_struct; // found in shared/comps/svm.c
|
||||
extern const hal_comp_t dq_comp_struct; // found in shared/comps/dq.c
|
||||
extern const hal_comp_t dq_sp_comp_struct; // found in shared/comps/dq_sp.c
|
||||
extern const hal_comp_t idq_comp_struct; // found in shared/comps/idq.c
|
||||
extern const hal_comp_t pole_comp_struct; // found in shared/comps/pole.c
|
||||
extern const hal_comp_t map_comp_struct; // found in shared/comps/map.c
|
||||
|
||||
@@ -9,7 +9,7 @@ const hal_comp_t * comps[] = {
|
||||
&term_comp_struct, // found in shared/comps/term.c
|
||||
&curpid_comp_struct, // found in shared/comps/curpid.c
|
||||
&svm_comp_struct, // found in shared/comps/svm.c
|
||||
&dq_comp_struct, // found in shared/comps/dq.c
|
||||
&dq_sp_comp_struct, // found in shared/comps/dq_sp.c
|
||||
&idq_comp_struct, // found in shared/comps/idq.c
|
||||
&pole_comp_struct, // found in shared/comps/pole.c
|
||||
&map_comp_struct, // found in shared/comps/map.c
|
||||
@@ -148,18 +148,14 @@ const pin_t pins[] = {
|
||||
"enu",
|
||||
"env",
|
||||
"enw",
|
||||
// pins for comp dq found in shared/comps/dq.c
|
||||
// pins for comp dq_sp found in shared/comps/dq_sp.c
|
||||
"rt_prio",
|
||||
"frt_prio",
|
||||
"mode",
|
||||
"u",
|
||||
"v",
|
||||
"w",
|
||||
"pos",
|
||||
"polecount",
|
||||
"a",
|
||||
"b",
|
||||
"y",
|
||||
"d",
|
||||
"q",
|
||||
// pins for comp idq found in shared/comps/idq.c
|
||||
|
||||
@@ -191,7 +191,7 @@ void hal_setup(){
|
||||
hal_parse("load curpid");
|
||||
|
||||
hal_parse("io0.rt_prio = 1.0");
|
||||
hal_parse("sim0.rt_prio = 2.0");
|
||||
hal_parse("sim0.rt_prio = 10.0");
|
||||
hal_parse("tle0.rt_prio = 2.0");
|
||||
hal_parse("map0.rt_prio = 3.0");
|
||||
hal_parse("vel0.rt_prio = 4.0");
|
||||
@@ -206,7 +206,6 @@ void hal_setup(){
|
||||
hal_parse("hv0.rt_prio = 9.0");
|
||||
|
||||
hal_parse("term0.rt_prio = 10");
|
||||
// hal_parse("sim0.rt_prio = 10.0");
|
||||
|
||||
hal_parse("term0.send_step = 10.0");
|
||||
hal_parse("term0.gain0 = 20.0");
|
||||
@@ -235,15 +234,15 @@ void hal_setup(){
|
||||
hal_parse("curpid0.ld = 0.0038");
|
||||
hal_parse("curpid0.lq = 0.0038");
|
||||
hal_parse("curpid0.psi = 0.005");
|
||||
hal_parse("curpid0.kp = 1.0");
|
||||
hal_parse("curpid0.ki = 0.0005");
|
||||
hal_parse("curpid0.kp = 0.5");
|
||||
hal_parse("curpid0.ki = 0.001");
|
||||
hal_parse("curpid0.ff = 1");
|
||||
hal_parse("curpid0.kind = 0");
|
||||
hal_parse("curpid0.max_cur = 3.1");
|
||||
hal_parse("curpid0.pwm_volt = io0.dc_link");
|
||||
|
||||
hal_parse("pole0.p = 50.0");
|
||||
// hal_parse("io0.led = term0.con");
|
||||
hal_parse("io0.led = term0.con");
|
||||
|
||||
hal_parse("dq_sp0.pos = pole0.cpos");
|
||||
hal_parse("idq0.pos = pole0.cpos");
|
||||
|
||||
Reference in New Issue
Block a user