Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ RTKBase use several RTKLIB `str2str` instances started with `run_cast.sh` as sys
+ `str2str_tcp.service` is the main instance. It is connected to the gnss receiver and broadcast the raw data on TCP for all the others services.
+ `str2str_ntrip_A.service` get the data from the main instance, convert the data to rtcm and stream them to a Ntrip caster.
+ `str2str_ntrip_B.service` get the data from the main instance, convert the data to rtcm and stream them to another Ntrip caster.
+ `str2str_ntrip_C.service` get the data from the main instance, convert the data to rtcm and stream them to another Ntrip caster.
+ `str2str_ntrip_D.service` get the data from the main instance, convert the data to rtcm and stream them to another Ntrip caster.
+ `str2str_local_ntrip_caster.service` get the data from the main instance, convert the data to rtcm, and act as a local Ntrip caster.
+ `str2str_rtcm_svr.service` get the data from the main instance, convert the data to rtcm and stream them to clients
+ `str2str_rtcm_serial.service` get the data from the main instance, convert the data to rtcm and stream them to a serial port (radio link, or other peripherals)
Expand Down
16 changes: 16 additions & 0 deletions run_cast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ out_caster_B="-msg ${rtcm_msg_b} -out ntrips://:${svr_pwd_b}@${svr_addr_b}:${svr
#add receiver options if it exists
[[ ! -z "${ntrip_b_receiver_options}" ]] && out_caster_B=""${out_caster_B}" -opt "${ntrip_b_receiver_options}""

out_caster_C="-msg ${rtcm_msg_c} -out ntrips://:${svr_pwd_c}@${svr_addr_c}:${svr_port_c}/${mnt_name_c}#rtcm3 -p ${position}"
#add receiver options if it exists
[[ ! -z "${ntrip_c_receiver_options}" ]] && out_caster_C=""${out_caster_C}" -opt "${ntrip_c_receiver_options}""

out_caster_D="-msg ${rtcm_msg_d} -out ntrips://:${svr_pwd_d}@${svr_addr_d}:${svr_port_d}/${mnt_name_d}#rtcm3 -p ${position}"
#add receiver options if it exists
[[ ! -z "${ntrip_d_receiver_options}" ]] && out_caster_D=""${out_caster_D}" -opt "${ntrip_d_receiver_options}""

array_pos=(${position})
if [[ ${local_ntripc_user} == '' ]] && [[ ${local_ntripc_pwd} == '' ]]
then
Expand Down Expand Up @@ -71,6 +79,14 @@ mkdir -p ${logdir}
${cast} -in ${!1} ${out_caster_B} -i "${receiver_info}" -a "${antenna_info}" -t ${level} -fl ${logdir}/str2str_ntrip_B.log
;;

out_caster_C)
${cast} -in ${!1} ${out_caster_C} -i "${receiver_info}" -a "${antenna_info}" -t ${level} -fl ${logdir}/str2str_ntrip_C.log
;;

out_caster_D)
${cast} -in ${!1} ${out_caster_D} -i "${receiver_info}" -a "${antenna_info}" -t ${level} -fl ${logdir}/str2str_ntrip_D.log
;;

out_local_caster)
#echo ${cast} -in ${!1} -out "${out_local_caster}"
${cast} -in ${!1} ${out_local_caster} -i "${receiver_info}" -a "${antenna_info}" -t ${level} -fl ${logdir}/str2str_ntrip.log
Expand Down
36 changes: 34 additions & 2 deletions settings.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ min_free_space='500'
# NTRIP A caster options

#ntrip A caster url
svr_addr_a='caster.centipede.fr'
svr_addr_a='crtk.net'
#ntrip A caster port
svr_port_a='2101'
#ntrip A caster password
Expand All @@ -99,7 +99,7 @@ ntrip_a_receiver_options=''
# NTRIP B caster options

#ntrip B caster url
svr_addr_b='caster.centipede.fr'
svr_addr_b='crtk.net'
#ntrip B caster port
svr_port_b='2101'
#ntrip B caster password
Expand All @@ -110,6 +110,38 @@ rtcm_msg_b='1004,1005(10),1006,1008(10),1012,1019,1020,1033(10),1042,1045,1046,1
#Receiver dependent options
ntrip_b_receiver_options=''

[ntrip_C]

# NTRIP C caster options

#ntrip C caster url
svr_addr_c='crtk.net'
#ntrip C caster port
svr_port_c='2101'
#ntrip C caster password
svr_pwd_c=''
#Mount name
mnt_name_c='Your_mount_name'
rtcm_msg_c='1004,1005(10),1006,1008(10),1012,1019,1020,1033(10),1042,1045,1046,1077,1087,1097,1107,1127,1230'
#Receiver dependent options
ntrip_c_receiver_options=''

[ntrip_D]

# NTRIP D caster options

#ntrip D caster url
svr_addr_d='crtk.net'
#ntrip D caster port
svr_port_d='2101'
#ntrip D caster password
svr_pwd_d=''
#Mount name
mnt_name_d='Your_mount_name'
rtcm_msg_d='1004,1005(10),1006,1008(10),1012,1019,1020,1033(10),1042,1045,1046,1077,1087,1097,1107,1127,1230'
#Receiver dependent options
ntrip_d_receiver_options=''

[local_ntrip_caster]

# local NTRIP caster options
Expand Down
6 changes: 5 additions & 1 deletion tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ configure_gnss(){
#cleaning receiver options
sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_a_receiver_options=.*/ntrip_a_receiver_options=/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_b_receiver_options=.*/ntrip_b_receiver_options=/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_c_receiver_options=.*/ntrip_c_receiver_options=/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_d_receiver_options=.*/ntrip_d_receiver_options=/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^local_ntripc_receiver_options=.*/local_ntripc_receiver_options=/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^rtcm_receiver_options=.*/rtcm_receiver_options=/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^rtcm_client_receiver_options=.*/rtcm_client_receiver_options=/ "${rtkbase_path}"/settings.conf && \
Expand All @@ -560,9 +562,11 @@ configure_gnss(){
sudo -u "${RTKBASE_USER}" sed -i s/^com_port_settings=.*/com_port_settings=\'115200:8:n:1\'/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^receiver=.*/receiver=\'U-blox_ZED-F9P\'/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^receiver_format=.*/receiver_format=\'ubx\'/ "${rtkbase_path}"/settings.conf && \
#add option -TADJ=1 on rtcm/ntrip_a/ntrip_b/serial outputs
#add option -TADJ=1 on rtcm/ntrip_a/ntrip_b/ntrip_c/ntrip_d serial outputs
sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_a_receiver_options=.*/ntrip_a_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_b_receiver_options=.*/ntrip_b_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_c_receiver_options=.*/ntrip_c_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_d_receiver_options=.*/ntrip_d_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^local_ntripc_receiver_options=.*/local_ntripc_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^rtcm_receiver_options=.*/rtcm_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \
sudo -u "${RTKBASE_USER}" sed -i s/^rtcm_client_receiver_options=.*/rtcm_client_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \
Expand Down
10 changes: 8 additions & 2 deletions tools/rtkbase_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ checking=$6
str2str_active=$(systemctl is-active str2str_tcp)
str2str_ntrip_A_active=$(systemctl is-active str2str_ntrip_A)
str2str_ntrip_B_active=$(systemctl is-active str2str_ntrip_B)
str2str_ntrip_C_active=$(systemctl is-active str2str_ntrip_C)
str2str_ntrip_D_active=$(systemctl is-active str2str_ntrip_D)
str2str_local_caster=$(systemctl is-active str2str_local_ntrip_caster)
str2str_rtcm=$(systemctl is-active str2str_rtcm_svr)
str2str_serial=$(systemctl is-active str2str_rtcm_serial)
Expand Down Expand Up @@ -170,7 +172,9 @@ upd_2.4.2() {
[ $str2str_active = 'active' ] && systemctl start str2str_tcp
# restart previously running services
[ $str2str_ntrip_A_active = 'active' ] && systemctl start str2str_ntrip_A
[ $str2str_ntrip_B_active = 'active' ] && systemctl start str2str_ntrip_B
[ $str2str_ntrip_B_active = 'active' ] && systemctl start str2str_ntrip_B
[ $str2str_ntrip_C_active = 'active' ] && systemctl start str2str_ntrip_C
[ $str2str_ntrip_D_active = 'active' ] && systemctl start str2str_ntrip_D
[ $str2str_local_caster = 'active' ] && systemctl start str2str_local_ntrip_caster
[ $str2str_rtcm = 'active' ] && systemctl start str2str_rtcm_svr
[ $str2str_serial = 'active' ] && systemctl start str2str_rtcm_serial
Expand Down Expand Up @@ -319,7 +323,9 @@ chown -R ${standard_user}:${standard_user} ${destination_directory}
# restart previously running services
# restart needed with all update to propagate the release number in the rtcm stream
[ $str2str_ntrip_A_active = 'active' ] && systemctl restart str2str_ntrip_A
[ $str2str_ntrip_B_active = 'active' ] && systemctl restart str2str_ntrip_B
[ $str2str_ntrip_B_active = 'active' ] && systemctl restart str2str_ntrip_B
[ $str2str_ntrip_C_active = 'active' ] && systemctl restart str2str_ntrip_C
[ $str2str_ntrip_D_active = 'active' ] && systemctl restart str2str_ntrip_D
[ $str2str_local_caster = 'active' ] && systemctl restart str2str_local_ntrip_caster
[ $str2str_rtcm = 'active' ] && systemctl restart str2str_rtcm_svr
[ $str2str_serial = 'active' ] && systemctl restart str2str_rtcm_serial
Expand Down
2 changes: 2 additions & 0 deletions tools/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ BASEDIR=$(dirname "$0")
for service_name in str2str_tcp.service \
str2str_ntrip_A.service \
str2str_ntrip_B.service \
str2str_ntrip_C.service \
str2str_ntrip_D.service \
str2str_local_ntrip_caster \
str2str_rtcm_svr.service \
str2str_rtcm_client.service \
Expand Down
23 changes: 23 additions & 0 deletions unit/str2str_ntrip_C.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Unit]
Description=RTKBase Ntrip C
#After=network-online.target
#Wants=network-online.target
Requires=str2str_tcp.service
After=str2str_tcp.service

[Service]
Type=simple
SyslogIdentifier=str2str_ntrip_C
User={user}
ExecStart={script_path}/run_cast.sh in_tcp out_caster_C
Restart=on-failure
RestartSec=30
#Limiting log to 1 msg per minute
LogRateLimitIntervalSec=1 minute
LogRateLimitBurst=1
ProtectHome=read-only
ProtectSystem=strict
ReadWritePaths={script_path}

[Install]
WantedBy=multi-user.target
23 changes: 23 additions & 0 deletions unit/str2str_ntrip_D.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[Unit]
Description=RTKBase Ntrip D
#After=network-online.target
#Wants=network-online.target
Requires=str2str_tcp.service
After=str2str_tcp.service

[Service]
Type=simple
SyslogIdentifier=str2str_ntrip_D
User={user}
ExecStart={script_path}/run_cast.sh in_tcp out_caster_D
Restart=on-failure
RestartSec=30
#Limiting log to 1 msg per minute
LogRateLimitIntervalSec=1 minute
LogRateLimitBurst=1
ProtectHome=read-only
ProtectSystem=strict
ReadWritePaths={script_path}

[Install]
WantedBy=multi-user.target
24 changes: 24 additions & 0 deletions web_app/RTKBaseConfigManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,28 @@ def get_ntrip_B_settings(self):
ordered_ntrip.append({key : self.config.get('ntrip_B', key).strip("'")})
return ordered_ntrip

def get_ntrip_C_settings(self):
"""
Get a subset of the settings from the ntrip C section in an ordered object
and remove the single quotes.
"""
#TODO need refactoring with get_ntrip_A_settings
ordered_ntrip = [{"source_section" : "ntrip_C"}]
for key in ("svr_addr_C", "svr_port_C", "svr_pwd_C", "mnt_name_C", "rtcm_msg_C", "ntrip_C_receiver_options"):
ordered_ntrip.append({key : self.config.get('ntrip_C', key).strip("'")})
return ordered_ntrip

def get_ntrip_D_settings(self):
"""
Get a subset of the settings from the ntrip D section in an ordered object
and remove the single quotes.
"""
#TODO need refactoring with get_ntrip_A_settings
ordered_ntrip = [{"source_section" : "ntrip_D"}]
for key in ("svr_addr_D", "svr_port_D", "svr_pwd_D", "mnt_name_D", "rtcm_msg_D", "ntrip_D_receiver_options"):
ordered_ntrip.append({key : self.config.get('ntrip_D', key).strip("'")})
return ordered_ntrip

def get_local_ntripc_settings(self):
"""
Get a subset of the settings from the local ntrip section in an ordered object
Expand Down Expand Up @@ -214,6 +236,8 @@ def get_ordered_settings(self):
ordered_settings['main'] = self.get_main_settings()
ordered_settings['ntrip_A'] = self.get_ntrip_A_settings()
ordered_settings['ntrip_B'] = self.get_ntrip_B_settings()
ordered_settings['ntrip_C'] = self.get_ntrip_C_settings()
ordered_settings['ntrip_D'] = self.get_ntrip_D_settings()
ordered_settings['local_ntripc'] = self.get_local_ntripc_settings()
ordered_settings['file'] = self.get_file_settings()
ordered_settings['rtcm_svr'] = self.get_rtcm_svr_settings()
Expand Down
12 changes: 11 additions & 1 deletion web_app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
services_list = [{"service_unit" : "str2str_tcp.service", "name" : "main"},
{"service_unit" : "str2str_ntrip_A.service", "name" : "ntrip_A"},
{"service_unit" : "str2str_ntrip_B.service", "name" : "ntrip_B"},
{"service_unit" : "str2str_ntrip_C.service", "name" : "ntrip_C"},
{"service_unit" : "str2str_ntrip_D.service", "name" : "ntrip_D"},
{"service_unit" : "str2str_local_ntrip_caster.service", "name" : "local_ntrip_caster"},
{"service_unit" : "str2str_rtcm_svr.service", "name" : "rtcm_svr"},
{'service_unit' : 'str2str_rtcm_serial.service', "name" : "rtcm_serial"},
Expand Down Expand Up @@ -458,6 +460,8 @@ def settings_page():
main_settings.append(gnss_rcv_url.geturl())
ntrip_A_settings = rtkbaseconfig.get_ntrip_A_settings()
ntrip_B_settings = rtkbaseconfig.get_ntrip_B_settings()
ntrip_C_settings = rtkbaseconfig.get_ntrip_C_settings()
ntrip_D_settings = rtkbaseconfig.get_ntrip_D_settings()
local_ntripc_settings = rtkbaseconfig.get_local_ntripc_settings()
rtcm_svr_settings = rtkbaseconfig.get_rtcm_svr_settings()
rtcm_client_settings = rtkbaseconfig.get_rtcm_client_settings()
Expand All @@ -469,6 +473,8 @@ def settings_page():
return render_template("settings.html", main_settings = main_settings,
ntrip_A_settings = ntrip_A_settings,
ntrip_B_settings = ntrip_B_settings,
ntrip_C_settings = ntrip_C_settings,
ntrip_D_settings = ntrip_D_settings,
local_ntripc_settings = local_ntripc_settings,
rtcm_svr_settings = rtcm_svr_settings,
rtcm_client_settings = rtcm_client_settings,
Expand Down Expand Up @@ -984,11 +990,15 @@ def update_settings(json_msg):

#Restart service if needed
if source_section == "main":
restartServices(("main", "ntrip_A", "ntrip_B", "local_ntrip_caster", "rtcm_svr", "rtcm_client", "rtcm_udp_svr", "rtcm_udp_client", "file", "rtcm_serial", "raw2nmea"))
restartServices(("main", "ntrip_A", "ntrip_B", "ntrip_C", "ntrip_D", "local_ntrip_caster", "rtcm_svr", "rtcm_client", "rtcm_udp_svr", "rtcm_udp_client", "file", "rtcm_serial", "raw2nmea"))
elif source_section == "ntrip_A":
restartServices(("ntrip_A",))
elif source_section == "ntrip_B":
restartServices(("ntrip_B",))
elif source_section == "ntrip_C":
restartServices(("ntrip_C",))
elif source_section == "ntrip_D":
restartServices(("ntrip_D",))
elif source_section == "local_ntrip_caster":
restartServices(("local_ntrip_caster",))
elif source_section == "rtcm_svr":
Expand Down
56 changes: 56 additions & 0 deletions web_app/static/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,62 @@ $(document).ready(function () {
socket.emit("services switch", {"name" : "ntrip_B", "active" : switchStatus});
})

// #################### NTRIP C service Switch #########################
var ntrip_C_Switch = $('#ntrip_C-switch');
// set the switch to on/off depending of the service status
if (servicesStatus[1].active === true) {
//document.querySelector("#main-switch").bootstrapToggle('on');
ntrip_C_Switch.bootstrapToggle('on', true);
} else {
//document.querySelector("#main-switch").bootstrapToggle('off');
ntrip_C_Switch.bootstrapToggle('off', true);
}
//console.log(servicesStatus[1]);
if (servicesStatus[1].btn_color) {
ntrip_C_Switch.bootstrapToggle('setOnStyle', servicesStatus[1].btn_color);
}
if (servicesStatus[1].btn_off_color) {
ntrip_C_Switch.bootstrapToggle('setOffStyle', servicesStatus[1].btn_off_color);
}

// event for switching on/off service on user mouse click
//TODO When the switch changes its position, this event seems attached before
//the switch finish its transition, then fire another event.
$( "#ntrip_C-switch" ).one("change", function(e) {
var switchStatus = $(this).prop('checked');
//console.log(" e : " + e);
//console.log("Ntrip SwitchStatus : " + switchStatus);
socket.emit("services switch", {"name" : "ntrip_C", "active" : switchStatus});
})

// #################### NTRIP D service Switch #########################
var ntrip_D_Switch = $('#ntrip_D-switch');
// set the switch to on/off depending of the service status
if (servicesStatus[1].active === true) {
//document.querySelector("#main-switch").bootstrapToggle('on');
ntrip_D_Switch.bootstrapToggle('on', true);
} else {
//document.querySelector("#main-switch").bootstrapToggle('off');
ntrip_D_Switch.bootstrapToggle('off', true);
}
//console.log(servicesStatus[1]);
if (servicesStatus[1].btn_color) {
ntrip_D_Switch.bootstrapToggle('setOnStyle', servicesStatus[1].btn_color);
}
if (servicesStatus[1].btn_off_color) {
ntrip_D_Switch.bootstrapToggle('setOffStyle', servicesStatus[1].btn_off_color);
}

// event for switching on/off service on user mouse click
//TODO When the switch changes its position, this event seems attached before
//the switch finish its transition, then fire another event.
$( "#ntrip_D-switch" ).one("change", function(e) {
var switchStatus = $(this).prop('checked');
//console.log(" e : " + e);
//console.log("Ntrip SwitchStatus : " + switchStatus);
socket.emit("services switch", {"name" : "ntrip_D", "active" : switchStatus});
})

// ################ Local NTRIP Caster service Switch #####################

var ntripcSwitch = $('#ntripc-switch');
Expand Down
Loading