Commit fa0adf1e authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Add test network for pid_aw block

Cleanup libs
Add lib dependancies for console_httpd.
Add inf as double constant.
parent c70cb7e2
......@@ -32,12 +32,14 @@ help:
echo "golden repository (on eris.camras.nl)."
libnova/libnova.h: lib/libnova.la
libnova.la: lib/libnova.la
lib/libnova.la:
cd libnova-0.13.0 ; ./configure -enable-static -disable-shared --prefix=${CURDIR} $(CONF_HOST); make; make install
clean: subdirs_CLEAN
rm -rf lib/*
rm -rf include/libnova
cd libnova-0.13.0 ; make clean || true
# Rules for building a release
......@@ -131,6 +133,7 @@ endef
CFLAGS := -pthread -Icommon -Icommon/include -Icontroller -Iconsole/console -Iinclude
LDFLAGS := -pthread -Lcommon/lib -Lcontroller/lib -Lconsole/console/lib -Llib -Wl,--as-needed
VPATH += common/lib controller/lib console/console/lib lib
VPATH += include
TARGETS:=
......
......@@ -23,4 +23,4 @@ $(DIR)/command_list: $(COMMAND_LIST_OBJS)
SRCS += $(ARCHSRCS) $(COMMAND_LIST_SRCS)
TARGETS += $(COMMAND_TARGETS)
CLEAN += $(COMMAND_TARGETS) $(ARCHOBJS) $(COMMAND_LIST_OBJS)
CLEAN += $(COMMAND_TARGETS) $(ARCHOBJS) $(COMMAND_LIST_OBJS) $(LIBDIR)/libcommand.a
......@@ -12,4 +12,4 @@ $(LIBDIR)/liblog.la_LDFLAGS += -lutils
$(LIBDIR)/liblog.la: $(ARCHOBJS)
$(LIB_LINK)
CLEAN += $(TARGETS) $(ARCHOBJS)
CLEAN += $(TARGETS) $(ARCHOBJS) $(LIBDIR)/liblog.a
......@@ -53,7 +53,7 @@ SRCS += $(TRACE_DUMPDIFF_SRCS)
SRCS += $(TRACE_FFT_SRCS)
SRCS += $(TRACE_LIST_SRCS)
SRCS += $(TRACE_VIEW_SRCS)
CLEAN += $(TRACE_TARGETS) $(ARCHOBJS)
CLEAN += $(TRACE_TARGETS) $(ARCHOBJS) $(LIBDIR)/libtrace.a
CLEAN += $(TRACE_DUMP_OBJS)
CLEAN += $(TRACE_DUMPDIFF_OBJS)
CLEAN += $(TRACE_FFT_OBJS)
......
......@@ -36,6 +36,6 @@ $(LIBDIR)/libutils.la: $(ARCHOBJS)
CLEAN += $(LIBDIR)/libutils.la
CLEAN += $(DIR)/weather_test
CLEAN += $(WEATHER_OBJS) $(ARCHOBJS)
CLEAN += $(WEATHER_OBJS) $(ARCHOBJS) $(LIBDIR)/libutils.a
SRCS += $(ARCHSRCS) $(WEATHER_SRCS)
......@@ -51,24 +51,28 @@ $(DIR)/command_shell: $(DIR)/command_shell.o
CONSOLE_SRCS += $(DIR)/command_shell.c
$(DIR)/console_moontracker.o: CFLAGS += -Wall -O3
$(DIR)/console_moontracker.o: libnova/libnova.h
$(DIR)/console_moontracker_LDFLAGS += -lcommand -lm -laa
$(DIR)/console_moontracker: libcommand.la libaa.la
$(DIR)/console_moontracker: $(DIR)/console_moontracker.o
CONSOLE_SRCS += $(DIR)/console_moontracker.c
$(DIR)/console_j2000tracker.o: CFLAGS += -Wall -O3
$(DIR)/console_j2000tracker.o: libnova/libnova.h
$(DIR)/console_j2000tracker_LDFLAGS += -lcommand -lm -lnova -ltrace
$(DIR)/console_j2000tracker: libcommand.la libtrace.la libnova.la
$(DIR)/console_j2000tracker: $(DIR)/console_j2000tracker.o
CONSOLE_SRCS += $(DIR)/console_j2000tracker.c
$(DIR)/console_j2000tracer.o: CFLAGS += -Wall -O3
$(DIR)/console_j2000tracesr.o: libnova/libnova.h
$(DIR)/console_j2000tracer_LDFLAGS += -lm -lnova -lutils
$(DIR)/console_j2000tracer: libutils.la libnova.la
$(DIR)/console_j2000tracer: $(DIR)/console_j2000tracer.o
CONSOLE_SRCS += $(DIR)/console_j2000tracer.c
$(DIR)/console_j2000_indi.o: CFLAGS += -Wall -O3
$(DIR)/console_j2000_indi.o: libnova/libnova.h
$(DIR)/console_j2000_indi_LDFLAGS += -lm -lindi -lindidriver -lnova -lutils
$(DIR)/console_j2000_indi: libutils.la libnova.la
$(DIR)/console_j2000_indi: $(DIR)/console_j2000_indi.o
......@@ -135,6 +139,7 @@ $(DIR)/spg_auth: $(DIR)/spg_auth.o
CONSOLE_SRCS += $(DIR)/spg_auth.c
$(DIR)/console_sattracker.o: CFLAGS += -Wall -O3
$(DIR)/console_sattracker.o: libnova/libnova.h
$(DIR)/console_sattracker_LDFLAGS += -lcommand -lnova -lpredict
$(DIR)/console_sattracker: libcommand.la libpredict.la libnova.la
$(DIR)/console_sattracker: $(DIR)/console_sattracker.o
......@@ -142,7 +147,7 @@ CONSOLE_SRCS += $(DIR)/console_sattracker.c
$(DIR)/console_httpd.o: CFLAGS += -Wall -O0 -g
$(DIR)/console_httpd_LDFLAGS += -llog -ltrace -lcommand -lwebsockets -lmagic
$(DIR)/console_httpd: liblog.la
$(DIR)/console_httpd: liblog.la libtrace.la libcommand.la
$(DIR)/console_httpd: $(DIR)/console_httpd.o
CONSOLE_SRCS += $(DIR)/console_httpd.c
......
......@@ -22,6 +22,7 @@
#include <string.h>
#include <controller/controller_block.h>
#include <controller/controller_sample.h>
/*
inputs outputs
......@@ -72,7 +73,6 @@ struct controller_block_private {
float kp; /* K factors */
float ki;
float kd;
float t; /* sample period */
float ci; /* Factors used in calculate (K * T) */
float cd;
float previous;
......@@ -115,7 +115,7 @@ static struct controller_block_param_list params[] = {
{ "kp", true },
{ "ki", true },
{ "kd", true },
{ "t", true },
{ "t", true }, /* deprecated */
{ "maxw", false },
{ "minw", false },
{ "reset", true },
......@@ -135,7 +135,6 @@ static void param_get(struct controller_block *pid, int param, void *val)
*(float*)val = pid->private->kd;
break;
case 3:
*(float*)val = pid->private->t;
break;
case 4:
*(float*)val = pid->private->maxi;
......@@ -161,7 +160,6 @@ static void param_set(struct controller_block *pid, int param, va_list val)
pid->private->kd = va_arg(val, double);
break;
case 3:
pid->private->t = va_arg(val, double);
break;
case 4:
pid->private->maxi = va_arg(val, double);
......@@ -177,8 +175,8 @@ static void param_set(struct controller_block *pid, int param, va_list val)
pid->private->out = 0.0;
break;
}
pid->private->ci = pid->private->ki * pid->private->t;
pid->private->cd = pid->private->kd / pid->private->t;
pid->private->ci = pid->private->ki * controller_sample_period();
pid->private->cd = pid->private->kd / controller_sample_period();
}
......@@ -210,7 +208,6 @@ struct controller_block * block_pid_aw_create(char *name)
pid->private->kp = 0.0;
pid->private->ki = 0.0;
pid->private->kd = 0.0;
pid->private->t = 1.0;
pid->private->ci = 0.0;
pid->private->cd = 0.0;
pid->private->maxi = 0.0;
......
frequency 100
blocks {
{ "pid_aw", "pid" }
{ "test_input_float", "in" }
{ "test_input_bool", "enable" }
{ "test_output_float", "out" }
{ "test_output_float", "outp" }
{ "test_output_float", "outi" }
{ "test_output_float", "outd" }
}
links {
{ "in", "value", "pid", "in", true }
{ "enable", "value", "pid", "enable", true }
{ "pid", "out", "out", "value", true }
{ "pid", "outp", "outp", "value", true }
{ "pid", "outi", "outi", "value", true }
{ "pid", "outd", "outd", "value", true }
}
params {
{ "pid", "kp", (float) 10.0 }
{ "pid", "ki", (float) 2.0 }
{ "pid", "kd", (float) 0.5 }
{ "pid", "maxw", (float) 3.0 }
{ "pid", "minw", (float) -0.01 }
{ "enable", "value", 10,
(int) { false, true, true, true, true, true, true, true, true, false }
}
{ "in", "value", 10,
(float) { 0.0, 1.0, -1.0, -1.0, 10.0, 10.0, 100.0, 100.0, 10.0, 10.0 }
}
{ "out", "value", 10,
(float) { 0.0, 60.02, -10.0, -10.0, 100.0, 100.0, 1000.0, 1000.0, 100.0, 0.0},
(float) { 0.0, 0.0, inf, inf, inf, inf, inf, inf, inf, 0.0}
}
{ "outp", "value", 10,
(float) { 0.0, 10.0, -10.0, -10.0, 100.0, 100.0, 1000.0, 1000.0, 100.0, 0.0},
(float) { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
}
{ "outi", "value", 10,
(float) { 0.0, 0.02, 0.0, -0.01, 0.19, 0.39, 2.39, 3.0, 3.0, 0.0},
(float) { 0.0, 0.0, 0.0, 0.0, 1e-6, 1e-6, 1e-6, 0.0, 0.0, 0.0}
}
{ "outd", "value", 10,
(float) { 0.0, 50.0, -100.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
(float) { 0.0, 0.0, 0.0, 0.0, inf, inf, inf, inf, inf, 0.0}
}
}
......@@ -83,6 +83,7 @@ CTRL_TESTS += \
$(DIR)/block_limit.test.ctrl \
$(DIR)/block_matrix_2x2.test.ctrl \
$(DIR)/block_not.test.ctrl \
$(DIR)/block_pid_aw.test.ctrl \
$(DIR)/block_rangecheck.test.ctrl \
$(DIR)/block_setpoint_generator_1d.test.ctrl \
$(DIR)/block_setpoint_generator_3d.test.ctrl \
......
......@@ -90,6 +90,7 @@ boolcast "("[ \t]*"bool"[ \t]*")"
"deg2rad" { return FUNC_DEG2RAD_SYM; }
"rpm2rads" { return FUNC_RPM2RADS_SYM; }
"pi" { return CONST_PI_SYM; }
"inf" { return CONST_INF_SYM; }
{floatcast} { return FLOATCASTSYM; }
{doublecast} { return DOUBLECASTSYM; }
......
......@@ -72,6 +72,7 @@ void yyerror(yyscan_t *scanner, char const *s);
%token FUNC_RPM2RADS_SYM
%token <dbl> CONST_PI_SYM
%token <dbl> CONST_INF_SYM
%left DUMMY_DOUBLEVAR
%left DUMMY_INTVAR
......@@ -254,6 +255,8 @@ doublevar: DOUBLEVARIABLESYM
{ $$ = $1; }
| CONST_PI_SYM
{ $$ = M_PI; }
| CONST_INF_SYM
{ $$ = INFINITY; }
| MINSYM doublevar %prec UMINUS
{ $$ = - $2; }
;
......
......@@ -303,7 +303,7 @@ static void *sample_thread(void *arg)
uint64_t t_start;
uint64_t t_io;
uint64_t t_end;
param.sched_priority = 99;
param.sched_priority = 90;
sigset_t sigset;
struct sigaction sigact;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment