Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
e1199f99
Commit
e1199f99
authored
Nov 28, 2013
by
Jeroen Vreeken
Browse files
Small improvements in sine block
Removal off old stuff from simulator Make our clock explicit instead of magic number.
parent
d0273cc4
Changes
3
Hide whitespace changes
Inline
Side-by-side
controller/block/block_sine.c
View file @
e1199f99
...
...
@@ -54,6 +54,8 @@ static void sine_calculate(struct controller_block *sine)
float
current
=
priv
->
current
;
current
+=
priv
->
step
;
if
(
current
>
M_PI
*
2
)
current
-=
M_PI
*
2
;
priv
->
value
=
sinf
(
current
);
priv
->
current
=
current
;
...
...
controller/controller/controller_sample.c
View file @
e1199f99
...
...
@@ -157,7 +157,7 @@ static void *sample_thread(void *arg)
}
#ifndef __FreeBSD__
clock
=
0
;
clock
=
CLOCK_REALTIME
;
#else
clock
=
CLOCK_MONOTONIC_PRECISE
;
pthread_condattr_init
(
&
attr
);
...
...
@@ -189,7 +189,7 @@ static void *sample_thread(void *arg)
/* Wait for the right moment...
(Internal timer or external interrupt) */
#ifndef __FreeBSD__
clock_nanosleep
(
0
,
TIMER_ABSTIME
,
&
t
,
NULL
);
clock_nanosleep
(
clock
,
TIMER_ABSTIME
,
&
t
,
NULL
);
#else
pthread_cond_timedwait
(
&
cv
,
&
lock
,
&
t
);
#endif
...
...
controller/dt_ctrl_az_sim.ctrl
View file @
e1199f99
...
...
@@ -4,11 +4,6 @@ blocks {
{ "subtract", "dt_az_speed_fb" }
{ "pid", "dt_az_driver" }
{ "limit_dyn", "dt_az_torque_limit" }
{ "random", "dt_az_torque_noise_rnd" }
{ "gain", "dt_az_torque_noise_gain" }
{ "value", "dt_az_torque_noise_0" }
{ "sine", "dt_az_torque_noise_sine" }
{ "add", "dt_az_torque_noise_add" }
{ "friction", "dt_az_friction" }
{ "pid", "dt_az_accelerate" }
{ "pid", "dt_az_speed2pos" }
...
...
@@ -31,10 +26,7 @@ links {
{ "dt_az_speed_quantize", "out", "dt_az_speed_fb", "positive", true }
{ "dt_az_speed_fb", "difference", "dt_az_driver", "in", true }
{ "dt_az_driver", "out", "dt_az_torque_limit", "in", true }
{ "dt_az_torque_limit", "out", "dt_az_torque_noise_add", "in0", true }
{ "dt_az_torque_noise_0", "value", "dt_az_torque_noise_gain", "in", true }
{ "dt_az_torque_noise_gain", "out", "dt_az_torque_noise_add", "in1", true }
{ "dt_az_torque_noise_add", "out", "dt_az_friction", "in", true }
{ "dt_az_torque_limit", "out", "dt_az_friction", "in", true }
{ "dt_az_friction", "out", "dt_az_accelerate", "in", true }
{ "dt_az_accelerate", "out", "dt_az_speed2pos", "in", true }
{ "dt_az_accelerate", "out", "dt_az_speed_fb", "negative", false }
...
...
@@ -70,9 +62,6 @@ params {
{ "dt_az_speed2pos", "kd", (float)0.0 }
{ "dt_az_speed2pos", "t", (float)0.004 }
{ "dt_az_pos_quantize", "quantum", (float)2.0 * pi / 16384.0 }
{ "dt_az_torque_noise_gain", "gain", (float)0.0 }
{ "dt_az_torque_noise_0", "value", (float)0.0 }
{ "dt_az_torque_noise_sine", "f", (float)0.0 }
{ "dt_az_focusbox", "value", (float)5.0 }
{ "dt_az_offset", "value", (float)-21730.3997815 }
{ "dt_az_bex", "value", (int)0 }
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment