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
1da7ba1a
Commit
1da7ba1a
authored
Oct 01, 2018
by
Jeroen Vreeken
Browse files
Merge branch 'jeroen' of
ssh://gitlab.camras.nl:777/dijkema/dt_ctrl
into jeroen
parents
c54185dd
4523cfcd
Pipeline
#1
failed with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
1da7ba1a
...
...
@@ -4,9 +4,12 @@
# ```
# git clone gitlab.camras.nl/dijkema/dt_ctrl
# ```
# Copy the Dockerfile to the empty directory: `cp dt_ctrl/Dockerfile .`
# Tar the source code with `tar czf dt_ctrl.tgz dt_ctrl`
# Create the docker file with `docker build --tag consoledemo .`
# This Dockerfile is hardcoded to run the websockets server at
# port 8000.
# Start the docker container with
# docker run -it -p 8081:80 -p 8000:8000 -p 11031:11031 -p 11030:11030 -p 11040:11040 -p 11041:11041 -p 11042:11042 -p 11011:11011 consoledemo
# Then visit the consoledemo from the host machine at http://localhost:8081 (NOT at port 8000, which will show a non-working HTML page)
FROM
ubuntu:16.04
RUN
apt-get
-y
update
...
...
@@ -18,8 +21,7 @@ RUN cd /root/libnova-libnova && libtoolize && autoreconf -i && ./configure && ma
RUN
cd
/root
&&
git clone https://github.com/warmcat/libwebsockets.git
RUN
cd
/root/libwebsockets
&&
mkdir
build
&&
cd
build
&&
cmake ..
&&
make
&&
make
install
ADD
dt_ctrl.tgz /root
RUN
cd
/root
tar
xf dt_ctrl.tgz
RUN
cd
/root
&&
git clone https://gitlab.camras.nl/dijkema/dt_ctrl
RUN
cd
/root/dt_ctrl
&&
autoconf
&&
./configure
--with-libwebsockets
=
/usr/local
&&
make
RUN
cd
/root/dt_ctrl
&&
make console/console/console_httpd
...
...
@@ -33,6 +35,45 @@ RUN cp -r /root/dt_ctrl/console/htdocs /var/www/
RUN
cp
-r
/root/dt_ctrl/console/js /var/www/
RUN
mkdir
-p
/var/www/htdocs/tle
&&
touch
/var/www/htdocs/tle/amateur.txt
&&
touch
/var/www/htdocs/tle/gps-ops.txt
&&
touch
/var/www/htdocs/tle/tle-new.txt
CMD
screen -d -m /root/dt_ctrl/controller/dt_ctrl /root/dt_ctrl/controller/dt_ctrl.ctrl && screen -d -m bash -c 'cd /root/dt_ctrl/console/console && ./start_console.sh' && /bin/bash
RUN
apt-get
-y
install
apache2 net-tools
RUN
mkdir
-p
/var/www/console/
&&
cp
-r
/root/dt_ctrl/console/htdocs /var/www/console
&&
cp
-r
/root/dt_ctrl/console/js /var/www/console
# Configure apache to serve the console htdocs
RUN
echo
'
\
<VirtualHost *:80>\n
\
\t
ServerAdmin webmaster@localhost\n
\
\t
DocumentRoot /var/www/console/htdocs\n
\
\t
<Directory "/var/www/console/htdocs">\n
\
\t\t
Order allow,deny\n
\
\t\t
Allow from all\n
\
\t\t
AllowOverride None\n
\
\t\t
AddHandler cgi-script .cgi\n
\
\t\t
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch\n
\
\t
</Directory>\n
\
\n\
ErrorLog ${APACHE_LOG_DIR}/error.log\n
\
CustomLog ${APACHE_LOG_DIR}/access.log combined\n
\
</VirtualHost>\n
\
'
>
/etc/apache2/sites-enabled/000-default.conf
# Configure ports for the console and controller
RUN
mkdir
/etc/dt
&&
echo
'
\
[console]\n
\
host=localhost\n
\
\n\
[controller]\n
\
host=localhost\n
\
\n\
[htdocs]\n
\
path=/var/www/console/htdocs\n
\
port=8000\n
\
'
>
/etc/dt/dt_host.ini
# Patch the console software to point the websockets port
RUN
sed
-i
-e
's/window.location.host/window.location.hostname+":8000"/'
/var/www/console/htdocs/index.html
&&
\
sed
-i
-e
's/window.location.host/window.location.hostname+":8000"/'
/var/www/console/htdocs/mech.html
CMD
screen -d -m /root/dt_ctrl/controller/dt_ctrl /root/dt_ctrl/controller/dt_ctrl.ctrl && screen -d -m bash -c 'cd /root/dt_ctrl/console/console && ./start_console.sh' && /bin/bash -c 'service apache2 start' && bash
EXPOSE
80
console/console/console_j2000tracker.c
View file @
1da7ba1a
...
...
@@ -136,7 +136,11 @@ void a2coord(char *ara, char *adec, struct ln_hms *ra, struct ln_dms *dec)
i
=
1
;
}
else
{
dec
->
neg
=
0
;
i
=
0
;
if
(
strlen
(
adec
)
&&
adec
[
0
]
==
'+'
)
{
i
=
1
;
}
else
{
i
=
0
;
}
}
dec
->
degrees
=
0
;
dec
->
minutes
=
0
;
...
...
console/console/start_console.sh
View file @
1da7ba1a
...
...
@@ -24,6 +24,7 @@ screen -S console -X screen -t console_sattracker console_sattracker
screen
-S
console
-X
screen
-t
console_weather console_weather
screen
-S
console
-X
screen
-t
console_httpd console_httpd
screen
-S
console
-X
screen
-t
console_trace2port ../../common/trace/trace2port
-d
localhost Azimuth_Position Elevation_Position azimuth_setpoint_error.difference elevation_setpoint_error.difference Azimuth_Speed Elevation_Speed_Right Focusbox_Position
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Azimuth_Position /var/log/dt/traces/Azimuth_Position.trace 15000 100000 5
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Elevation_Position /var/log/dt/traces/Elevation_Position.trace 15000 100000 5
...
...
console/js/dt_status.js
View file @
1da7ba1a
...
...
@@ -289,19 +289,23 @@ function dt_status(element_name) {
this
.
fb_plus_command
=
new
controller_command
(
"
focusbox_plus
"
,
"
bool
"
);
this
.
fb_min_command
=
new
controller_command
(
"
focusbox_min
"
,
"
bool
"
);
this
.
button_fb_p
.
on
mousedown
=
function
()
{
this
.
button_fb_p
.
element
.
addEventListener
(
"
mousedown
"
,
function
()
{
dt_status_this
.
fb_plus_command
.
send
(
1
);
}
this
.
button_fb_p
.
onmouseup
=
function
()
{
dt_status_this
.
fb_plus_command
.
send
(
0
);
}
});
function
fb_p_disable
(
e
)
{
dt_status_this
.
fb_plus_command
.
send
(
0
);
}
this
.
button_fb_p
.
element
.
addEventListener
(
"
mouseup
"
,
fb_p_disable
);
this
.
button_fb_p
.
element
.
addEventListener
(
"
mouseout
"
,
fb_p_disable
);
this
.
button_fb_m
.
on
mousedown
=
function
()
{
this
.
button_fb_m
.
element
.
addEventListener
(
"
mousedown
"
,
function
()
{
dt_status_this
.
fb_min_command
.
send
(
1
);
}
this
.
button_fb_m
.
onmouseup
=
function
()
{
dt_status_this
.
fb_min_command
.
send
(
0
);
}
});
function
fb_m_disable
(
e
)
{
dt_status_this
.
fb_min_command
.
send
(
0
);
}
this
.
button_fb_m
.
element
.
addEventListener
(
"
mouseup
"
,
fb_m_disable
);
this
.
button_fb_m
.
element
.
addEventListener
(
"
mouseout
"
,
fb_m_disable
);
}
...
...
console/js/offset.js
View file @
1da7ba1a
...
...
@@ -142,17 +142,31 @@ function offset(element_name) {
*/
this
.
highlight_title
=
function
(
az
,
el
)
{
if
(
az
!=
0
||
el
!=
0
)
{
this
.
window
.
title
.
element
.
style
.
background
=
'
yellow
'
;
}
else
{
this
.
window
.
title
.
element
.
style
.
background
=
'
silver
'
;
}
}
this
.
set_offset
=
function
(
az
,
el
)
{
this
.
val_az
.
value_set
(
decimals
(
rad2deg
(
az
),
4
));
this
.
val_el
.
value_set
(
decimals
(
rad2deg
(
el
),
4
));
this
.
highlight_title
(
az
,
el
);
}
this
.
send
=
function
(
az
,
el
)
{
az
=
deg2rad
(
floatval
(
az
));
el
=
deg2rad
(
floatval
(
el
));
this
.
highlight_title
(
az
,
el
);
dt_websocket_send
(
"
command offset
"
+
"
"
+
az
+
"
"
+
el
);
}
...
...
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