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
fb1d67f0
Commit
fb1d67f0
authored
Sep 02, 2013
by
Jeroen Vreeken
Browse files
Use the correct time when staring execution of a timed command
Do not override a brake.
parent
64fbd94c
Changes
1
Hide whitespace changes
Inline
Side-by-side
controller/controller/block_setpoint_generator.c
View file @
fb1d67f0
...
...
@@ -207,6 +207,7 @@ static void calculate(struct controller_block *spg)
{
struct
controller_block_private
*
priv
=
spg
->
private
;
bool
ignore_x
=
false
;
bool
must_brake
=
false
;
if
(
*
priv
->
reset
)
{
priv
->
cmd_x
=
*
priv
->
reset_x
;
...
...
@@ -251,7 +252,7 @@ static void calculate(struct controller_block *spg)
if
(
!
priv
->
current_command
.
start
)
{
t
=
(
double
)(
priv
->
current_command
.
time
-
controller_time_seconds
)
*
priv
->
freq
-
-
(
double
)
controller_time_samplenr
;
(
double
)
controller_time_samplenr
;
if
(
t
<
1
.
0
||
priv
->
current_command
.
time
<
controller_time_seconds
)
{
...
...
@@ -579,6 +580,7 @@ static void calculate(struct controller_block *spg)
/* once we are still, would we still be within limits? */
if
((
x
>
priv
->
max_x
||
x
<
priv
->
min_x
)
&&
priv
->
cur_j
!=
j
)
{
priv
->
cur_j
=
j
;
must_brake
=
true
;
}
}
}
...
...
@@ -609,19 +611,20 @@ static void calculate(struct controller_block *spg)
}
else
{
priv
->
cur_j
=
j
;
}
must_brake
=
true
;
}
}
/* Is the difference between spg and command small enough?
If so, make outputs equal to command */
if
(
fabs
(
priv
->
cmd_x
-
priv
->
cur_x
)
<
priv
->
precision_x
)
{
if
(
fabs
(
priv
->
cmd_
v
-
priv
->
cur_
v
)
<
priv
->
precision_
v
)
{
if
(
fabs
(
priv
->
cur_
a
)
<
priv
->
precision_
a
)
priv
->
cur_
j
=
0
.
0
;
priv
->
cur_
a
=
0
.
0
;
priv
->
cur_
v
=
priv
->
cmd_v
;
priv
->
cur_
x
=
priv
->
cmd_
x
;
}
if
(
!
must_brake
&&
fabs
(
priv
->
cmd_
x
-
priv
->
cur_
x
)
<
priv
->
precision_
x
&&
fabs
(
priv
->
cmd_v
-
priv
->
cur_
v
)
<
priv
->
precision_
v
&&
fabs
(
priv
->
cur_
a
)
<
priv
->
precision_a
)
{
priv
->
cur_
j
=
0
.
0
;
priv
->
cur_
a
=
0
.
0
;
priv
->
cur_
v
=
priv
->
cmd_
v
;
priv
->
cur_x
=
priv
->
cmd_x
;
}
priv
->
cur_a
+=
priv
->
cur_j
;
...
...
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