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
d14ba627
Commit
d14ba627
authored
Mar 05, 2015
by
Jeroen Vreeken
Browse files
Remove elevation safety from network.
parent
536fa6b7
Changes
6
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
d14ba627
...
...
@@ -12,21 +12,21 @@ AC_ARG_ENABLE([console],
#######################################################################
#
# Check for libwebsocket
# Check for libwebsocket
s
#
AC_ARG_WITH([libwebsocket],
[AS_HELP_STRING([--with-libwebsocket],
[
build
websocket
base httpd deamon
@<:@default=check@:>@])],
AC_ARG_WITH([libwebsocket
s
],
[AS_HELP_STRING([--with-libwebsocket
s
],
[
use lib
websocket
s
@<:@default=check@:>@])],
[],
[with_libwebsocket=check])
AS_CASE(["$with_libwebsocket"],
AS_CASE(["$with_libwebsocket
s
"],
[yes],
[AC_CHECK_LIB(websockets,libwebsocket_create_context,[HAVE_LIBWEBSOCKET=1])]
[AC_CHECK_LIB(websockets,libwebsocket_create_context,[HAVE_LIBWEBSOCKET
S
=1])]
[AC_CHECK_HEADERS([libwebsockets.h])],
[no],
[],
[AC_CHECK_LIB(websockets,libwebsocket_create_context,[HAVE_LIBWEBSOCKET=1],[HAVE_LIBWEBSOCKET=0])]
[AC_CHECK_LIB(websockets,libwebsocket_create_context,[HAVE_LIBWEBSOCKET
S
=1],[HAVE_LIBWEBSOCKET
S
=0])]
[AC_CHECK_HEADERS([libwebsockets.h])]
)
AS_IF([test "$ac_cv_header_libwebsockets_h" != yes],[HAVE_LIBWEBSOCKETS=0],[])
...
...
@@ -39,7 +39,7 @@ AS_IF([test "$ac_cv_header_libwebsockets_h" != yes],[HAVE_LIBWEBSOCKETS=0],[])
AC_ARG_WITH([libindi],
[AS_HELP_STRING([--with-libindi],
[
hav
e indi library @<:@default=check@:>@])],
[
us
e indi library @<:@default=check@:>@])],
[],
[with_libindi=check])
AS_CASE(["$with_libindi"],
...
...
@@ -64,7 +64,7 @@ AS_IF([test "$enable_console" = "yes"],
[AC_SUBST(BUILD_CONSOLE,["yes"])],
[AC_SUBST(BUILD_CONSOLE,[""])])
AS_IF([test "$BUILD_CONSOLE" == "yes" && test "$HAVE_LIBWEBSOCKET" == "1"],
AS_IF([test "$BUILD_CONSOLE" == "yes" && test "$HAVE_LIBWEBSOCKET
S
" == "1"],
[AC_SUBST(BUILD_CONSOLE_HTTPD,["yes"])],
[AC_SUBST(BUILD_CONSOLE_HTTPD,[""])])
...
...
console/htdocs/mech.html
View file @
d14ba627
...
...
@@ -223,6 +223,17 @@ var elevation_software = new dt_ui_window_trace("elevation_software", "Elevation
decimals
:
4
,
highlight
:
true
,
},
{
name
:
"
Elevation_Torsion
"
,
frequency
:
4
,
label
:
"
Torsion
"
,
func
:
rad2deg
,
suffix
:
"
deg
"
,
is_bool
:
false
,
is_number
:
true
,
decimals
:
4
,
highlight
:
true
,
},
]);
var
azimuth_mechanics
=
new
dt_ui_window_trace
(
"
azimuth_mechanics
"
,
"
Azimuth Mechanics
"
,
[
...
...
controller/block/block_and.c
View file @
d14ba627
...
...
@@ -40,21 +40,35 @@
struct
controller_block_private
{
bool
q
;
bool
i
[
0
];
bool
*
i
[
0
];
};
void
calculate_2
(
struct
controller_block
*
block
)
{
struct
controller_block_private
*
priv
=
block
->
private
;
priv
->
q
=
priv
->
i
[
0
]
&
priv
->
i
[
1
];
priv
->
q
=
*
priv
->
i
[
0
]
&
*
priv
->
i
[
1
];
}
void
calculate_3
(
struct
controller_block
*
block
)
{
struct
controller_block_private
*
priv
=
block
->
private
;
priv
->
q
=
*
priv
->
i
[
0
]
&
*
priv
->
i
[
1
]
&
*
priv
->
i
[
2
];
}
void
calculate_4
(
struct
controller_block
*
block
)
{
struct
controller_block_private
*
priv
=
block
->
private
;
priv
->
q
=
priv
->
i
[
0
]
&
priv
->
i
[
1
]
&
priv
->
i
[
2
]
&
priv
->
i
[
3
];
priv
->
q
=
*
priv
->
i
[
0
]
&
*
priv
->
i
[
1
]
&
*
priv
->
i
[
2
]
&
*
priv
->
i
[
3
];
}
void
calculate_5
(
struct
controller_block
*
block
)
{
struct
controller_block_private
*
priv
=
block
->
private
;
priv
->
q
=
*
priv
->
i
[
0
]
&
*
priv
->
i
[
1
]
&
*
priv
->
i
[
2
]
&
*
priv
->
i
[
3
]
&
*
priv
->
i
[
4
];
}
static
struct
controller_block_interm_list
interms_2
[]
=
{
...
...
@@ -63,6 +77,13 @@ static struct controller_block_interm_list interms_2[] = {
{
NULL
}
};
static
struct
controller_block_interm_list
interms_3
[]
=
{
{
"a"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
0
])
},
{
"b"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
1
])
},
{
"c"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
2
])
},
{
NULL
}
};
static
struct
controller_block_interm_list
interms_4
[]
=
{
{
"a"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
0
])
},
{
"b"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
1
])
},
...
...
@@ -71,6 +92,15 @@ static struct controller_block_interm_list interms_4[] = {
{
NULL
}
};
static
struct
controller_block_interm_list
interms_5
[]
=
{
{
"a"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
0
])
},
{
"b"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
1
])
},
{
"c"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
2
])
},
{
"d"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
3
])
},
{
"e"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
i
[
4
])
},
{
NULL
}
};
static
struct
controller_block_outterm_list
outterms
[]
=
{
{
"q"
,
CONTROLLER_BLOCK_TERM_BOOL
,
offsetof
(
struct
controller_block_private
,
q
)
},
{
NULL
}
...
...
@@ -104,7 +134,7 @@ static struct controller_block * block_and2_create(char *name, int argc, va_list
{
struct
controller_block
*
block
;
if
(
!
(
block
=
controller_block_alloc
(
"and2"
,
name
,
sizeof
(
struct
controller_block_private
)
+
sizeof
(
bool
)
*
2
)))
if
(
!
(
block
=
controller_block_alloc
(
"and2"
,
name
,
sizeof
(
struct
controller_block_private
)
+
sizeof
(
bool
*
)
*
2
)))
return
NULL
;
if
(
controller_block_interm_list_init
(
block
,
interms_2
))
...
...
@@ -120,11 +150,32 @@ BLOCK_CREATE(and2) = {
.
args
=
{
NULL
},
};
static
struct
controller_block
*
block_and3_create
(
char
*
name
,
int
argc
,
va_list
val
)
{
struct
controller_block
*
block
;
if
(
!
(
block
=
controller_block_alloc
(
"and3"
,
name
,
sizeof
(
struct
controller_block_private
)
+
sizeof
(
bool
*
)
*
3
)))
return
NULL
;
if
(
controller_block_interm_list_init
(
block
,
interms_3
))
return
block_err
(
block
);
block
->
calculate
=
calculate_3
;
return
block_and
(
block
);
}
BLOCK_CREATE
(
and3
)
=
{
.
create
=
block_and3_create
,
.
args
=
{
NULL
},
};
static
struct
controller_block
*
block_and4_create
(
char
*
name
,
int
argc
,
va_list
val
)
{
struct
controller_block
*
block
;
if
(
!
(
block
=
controller_block_alloc
(
"and4"
,
name
,
sizeof
(
struct
controller_block_private
)
+
sizeof
(
bool
)
*
4
)))
if
(
!
(
block
=
controller_block_alloc
(
"and4"
,
name
,
sizeof
(
struct
controller_block_private
)
+
sizeof
(
bool
*
)
*
4
)))
return
NULL
;
if
(
controller_block_interm_list_init
(
block
,
interms_4
))
...
...
@@ -139,3 +190,23 @@ BLOCK_CREATE(and4) = {
.
create
=
block_and4_create
,
.
args
=
{
NULL
},
};
static
struct
controller_block
*
block_and5_create
(
char
*
name
,
int
argc
,
va_list
val
)
{
struct
controller_block
*
block
;
if
(
!
(
block
=
controller_block_alloc
(
"and5"
,
name
,
sizeof
(
struct
controller_block_private
)
+
sizeof
(
bool
*
)
*
5
)))
return
NULL
;
if
(
controller_block_interm_list_init
(
block
,
interms_5
))
return
block_err
(
block
);
block
->
calculate
=
calculate_5
;
return
block_and
(
block
);
}
BLOCK_CREATE
(
and5
)
=
{
.
create
=
block_and5_create
,
.
args
=
{
NULL
},
};
controller/block/build.mk
View file @
d14ba627
...
...
@@ -59,7 +59,10 @@ BLOCKS_IL := \
BLOCKS_NO_C
:=
\
and2
\
and4
and3
\
and4
\
and5
\
value_float
ifneq
($(OS), FreeBSD)
BLOCKS
+=
\
...
...
controller/dt_ctrl.ctrl
View file @
d14ba627
...
...
@@ -64,7 +64,7 @@ blocks ($(frequency), $(delay)) {
{ "matrix_2x2", "elevation_input_matrix" }
{ "setpoint_generator_3d", "elevation_spg", "Elevation_Setpoint", "rad" }
{ "servo_state", "elevation_servo_state" }
{ "and
2
", "elevation_safe_and" }
{ "and
5
", "elevation_safe_and" }
{ "setpoint_generator_1d", "elevation_torsion_spg", "Elevation_Torsion_Setpoint", "rad" }
{ "subtract", "elevation_setpoint_error" }
{ "subtract", "elevation_error" }
...
...
@@ -78,8 +78,9 @@ blocks ($(frequency), $(delay)) {
{ "switch", "elevation_position_switch" }
{ "limit", "elevation_torsion_speed_limit" }
{ "limit", "elevation_speed_limit" }
{ "limit_switch", "elevation_range_limit_r" }
{ "limit_switch", "elevation_range_limit_l" }
{ "limit_2nd", "elevation_jerk_limit" }
{ "dt_el_safety", "elevation_safety" }
{ "matrix_2x2", "elevation_output_matrix" }
{ "value", "elevation_torque_r" }
{ "value", "elevation_torque_l" }
...
...
@@ -90,7 +91,15 @@ blocks ($(frequency), $(delay)) {
{ "log", "elevation_safety_hw_top" }
{ "log", "elevation_safety_hw_bottom" }
{ "rangecheck", "elevation_speed_range_negative" }
{ "rangecheck", "elevation_speed_range_positive" }
{ "rangecheck", "elevation_torsion_range" }
{ "or2", "elevation_position_range" }
{ "command_bool", "elevation_recover" }
{ "and2", "elevation_position_safe" }
{ "log", "elevation_position_range_log" }
{ "log", "elevation_position_safe_log" }
{ "command_bool", "focusbox_plus" }
{ "command_bool", "focusbox_min" }
...
...
@@ -102,6 +111,7 @@ alias {
{ "Azimuth_Drive_Safety_p270", "dt_az", "be4" }
{ "Azimuth_Drive_Safety_m270", "dt_az", "be2" }
{ "Elevation_Position", "elevation_input_matrix", "out0" }
{ "Elevation_Torsion", "elevation_input_matrix", "out1" }
{ "Elevation_Top_Safe", "dt_el_l", "be4" }
{ "Elevation_Bottom_Safe", "dt_el_l", "be2" }
}
...
...
@@ -161,10 +171,15 @@ links {
{ "elevation_spg", "x", "elevation_servo_state", "spg_x" , true }
{ "elevation_spg", "v", "elevation_servo_state", "spg_v" , true }
{ "elevation_spg", "a", "elevation_servo_state", "spg_a" , true }
{ "elevation_
safety
",
"safe_out",
"elevation_safe_and", "a" ,
fals
e }
{ "elevation_
position_range
",
"q",
"elevation_safe_and", "a" ,
tru
e }
{ "ethercat", "operational","elevation_safe_and", "b" , true }
{ $<Elevation_Top_Safe>, "elevation_safe_and", "c", true }
{ $<Elevation_Bottom_Safe>, "elevation_safe_and", "d", true }
{ "elevation_torsion_range", "valid", "elevation_safe_and", "e", true }
{ "elevation_safe_and", "q", "elevation_servo_state", "safe" , true }
{ "elevation_safety", "recover", "elevation_servo_state", "override" , false }
{ "elevation_recover", "value", "elevation_servo_state", "override" , true }
{ "elevation_recover", "value", "elevation_range_limit_r", "enable", true }
{ "elevation_recover", "value", "elevation_range_limit_l", "enable", true }
{ "elevation_servo_state", "out_x", "elevation_error", "positive" , true }
{ "elevation_servo_state", "out_v", "elevation_speed_ff", "in0" , true }
{ "dt_el_r", "position", "elevation_position_offset_r_sum", "in0" , true }
...
...
@@ -188,21 +203,12 @@ links {
{ "dt_el_r", "torque", "elevation_torsion_torque", "positive" , true }
{ "dt_el_l", "torque", "elevation_torsion_torque", "negative" , true }
{ "elevation_torsion_torque", "difference", "elevation_torsion_torque_lp", "in" , true }
{ "elevation_position_offset_r_sum","out", "elevation_safety", "position_in_r" , true }
{ "elevation_position_offset_l_sum","out", "elevation_safety", "position_in_l" , true }
{ "elevation_input_matrix", "out1", "elevation_safety", "torsion_in" , true }
{ "elevation_output_matrix", "out0", "elevation_safety", "speed_in_r" , true }
{ "elevation_output_matrix", "out1", "elevation_safety", "speed_in_l" , true }
{ "elevation_torsion_torque_lp", "out", "elevation_safety", "torque_in" , true }
{ "elevation_torque_r", "value", "elevation_safety", "torque_in_r" , true }
{ "elevation_torque_l", "value", "elevation_safety", "torque_in_l" , true }
{ $<Elevation_Top_Safe>, "elevation_safety", "safety_in_top", true }
{ $<Elevation_Bottom_Safe>, "elevation_safety", "safety_in_bottom", true }
{ "elevation_servo_state", "enable", "elevation_safety", "enable" , true }
{ "elevation_safety", "speed_out_r", "dt_el_r", "speed" , true }
{ "elevation_safety", "speed_out_l", "dt_el_l", "speed" , true }
{ "elevation_safety", "torque_out_r","dt_el_r", "torque" , true }
{ "elevation_safety", "torque_out_l","dt_el_l", "torque" , true }
{ "elevation_output_matrix", "out0", "elevation_range_limit_r", "in" , true }
{ "elevation_output_matrix", "out1", "elevation_range_limit_l", "in" , true }
{ "elevation_range_limit_r", "out", "dt_el_r", "speed" , true }
{ "elevation_range_limit_l", "out", "dt_el_l", "speed" , true }
{ "elevation_torque_r", "value", "dt_el_r", "torque" , true }
{ "elevation_torque_l", "value", "dt_el_l", "torque" , true }
{ "elevation_servo_state", "enable", "dt_el_r", "enable" , true }
{ "elevation_servo_state", "enable", "dt_el_l", "enable" , true }
{ "focusbox_plus", "value", "dt_el_r", "ba1" , true }
...
...
@@ -211,11 +217,11 @@ links {
{ "false", "value", "dt_el_l", "ba2" , true }
{ "elevation_servo_state", "reset", "elevation_torsion_spg", "reset" , false }
{
"e
levation_
input_matrix", "out1",
"elevation_torsion_spg", "reset_x" , true }
{
$<E
levation_
Torsion>,
"elevation_torsion_spg", "reset_x" , true }
{ "elevation_torsion_spg", "x", "elevation_torsion_error", "positive" , true }
{ "elevation_input_matrix", "out1", "elevation_torsion_error", "negative" , true }
{ "elevation_torsion_spg", "setpoint", "elevation_torsion_setpoint_error", "positive" , true }
{
"e
levation_
input_matrix", "out1",
"elevation_torsion_setpoint_error", "negative" , true }
{
$<E
levation_
Torsion>,
"elevation_torsion_setpoint_error", "negative" , true }
{ "elevation_torsion_error", "difference", "elevation_torsion_pid", "in" , true }
{ "elevation_servo_state", "enable", "elevation_torsion_pid", "enable" , true }
{ "elevation_torsion_pid", "out", "elevation_torsion_speed_limit", "in" , true }
...
...
@@ -223,6 +229,20 @@ links {
{ $<Elevation_Top_Safe>, "elevation_safety_hw_top", "condition", true }
{ $<Elevation_Bottom_Safe>, "elevation_safety_hw_bottom", "condition", true }
{ $<Elevation_Torsion>, "elevation_torsion_range", "in", true }
{ $<Elevation_Position>, "elevation_speed_range_negative", "in", true }
{ $<Elevation_Position>, "elevation_speed_range_positive", "in", true }
{ "elevation_speed_range_positive", "valid", "elevation_position_range", "a", true }
{ "elevation_speed_range_negative", "valid", "elevation_position_range", "b", true }
{ "elevation_position_range", "q", "elevation_position_range_log", "condition", true }
{ "elevation_speed_range_positive", "valid", "elevation_position_safe", "a", true }
{ "elevation_speed_range_negative", "valid", "elevation_position_safe", "b", true }
{ "elevation_position_safe", "q", "elevation_position_safe_log", "condition", true }
{ "elevation_speed_range_positive", "valid", "elevation_range_limit_r", "enable_pos", true }
{ "elevation_speed_range_negative", "valid", "elevation_range_limit_r", "enable_neg", true }
{ "elevation_speed_range_positive", "valid", "elevation_range_limit_l", "enable_pos", true }
{ "elevation_speed_range_negative", "valid", "elevation_range_limit_l", "enable_neg", true }
}
traces {
...
...
@@ -267,7 +287,7 @@ traces {
{ "Elevation_Torque_Right", "Nm", "dt_el_r", "torque" }
{ "Elevation_Torque_Left", "Nm", "dt_el_l", "torque" }
{ "Elevation_Torsion_Torque", "Nm", "elevation_torsion_torque_lp", "out" }
{ "Elevation_Safe", "Boolean", "elevation_
safety
",
"safe_out"
}
{ "Elevation_Safe", "Boolean", "elevation_
position_range
",
"q"
}
{ "Elevation_Enabled", "Boolean", "dt_el_l", "enabled" }
{ "Elevation_Drive_Safety_Right", "Boolean", "dt_el_r", "be1" }
{ "Elevation_Drive_Safety_Left", "Boolean", "dt_el_l", "be1" }
...
...
@@ -397,13 +417,8 @@ params {
{ "elevation_torsion_speed_limit", "max", (float) rpm2rads(0.001) }
{ "elevation_safety", "safe_zone_min_speed", (float)-30 }
{ "elevation_safety", "safe_zone_max_speed", (float) 30 }
{ "elevation_safety", "torsion_max", (float) 0.0002 }
{ "elevation_safety", "recover", (int) 0 }
{ "elevation_safety", "torque_max", (float) 20.0 }
{ "elevation_safety", "emergency_torque", (float) 3.0 }
{ "elevation_torsion_range", "max", (float) 0.0002 }
{ "elevation_torsion_range", "min", (float)-0.0002 }
{ "elevation_torque_r", "value", (float) 10.0 }
{ "elevation_torque_l", "value", (float) 10.0 }
...
...
@@ -411,11 +426,22 @@ params {
{ "elevation_position_offset_r","value", (float) 0.0 }
{ "elevation_position_offset_l","value", (float) 0.0 }
{ "elevation_safety", "position_min", (float) deg2rad(-0.1) * $(elevation_gear) }
{ "elevation_safety", "position_max", (float) deg2rad(90.5) * $(elevation_gear) }
{ "elevation_safety", "safe_zone_min", (float) deg2rad(-0.09) * $(elevation_gear) }
{ "elevation_safety", "safe_zone_max", (float) deg2rad(90.4) * $(elevation_gear) }
{ "elevation_safety", "torsion_recover_max", (float) deg2rad(1.0) }
# positions were we go into safe behavior
# these must be outside the normal operating range
# 'safe zone' is between the operating range and the absolute safety
# value above
{ "elevation_speed_range_negative", "max", deg2rad(90.5) * $(elevation_gear) }
{ "elevation_speed_range_negative", "min", deg2rad(-0.09) * $(elevation_gear) }
{ "elevation_speed_range_positive", "max", deg2rad(90.4) * $(elevation_gear) }
{ "elevation_speed_range_positive", "min", deg2rad(-0.1) * $(elevation_gear) }
{ "elevation_position_range_log", "msg_up", 1, "Elevation position inside allowed range" }
{ "elevation_position_range_log", "msg_down", 0, "Elevation position outside allowed range" }
{ "elevation_position_range_log", "init", true }
{ "elevation_position_safe_log", "msg_up", 1, "Elevation position left safe zone to normal operating range" }
{ "elevation_position_safe_log", "msg_down", 1, "Elevation position left normal operating range and is in safe zone" }
{ "elevation_position_safe_log", "init", true }
{ "elevation_safety_hw_top", "msg_up", 2, "Elevation HW top safety switch is closed" }
{ "elevation_safety_hw_top", "msg_down", 0, "Elevation HW top safety switch is open" }
...
...
controller/dt_ctrl_ec_sim.ctrl
View file @
d14ba627
blocks ($(frequency), $(delay)) {
{ "ec_sim", "ethercat" }
# { "ec", "ethercat", "eth0", 0, false }
}
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