Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
motosat
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
motosat
Commits
099a66d6
Commit
099a66d6
authored
Sep 09, 2019
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tested both directions
parent
7379a2c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
23 deletions
+35
-23
test_01.php
test_01.php
+35
-23
No files found.
test_01.php
View file @
099a66d6
...
...
@@ -25,7 +25,12 @@ $LATE_STOP_AZ = 30; // steps
// Rescan azimuth after noticed a satellite during area scan
$AZ_PLAY
=
1.0
;
// Hysteresis caused by mechanical play (degrees)
$AZ_RESCAN
=
8
;
// (degrees) around expected center
$AZ_RESCAN_STEP
=
0.25
;
// (degrees)
$AZ_RESCAN_STEP
=
0.5
;
// (degrees)
$EL_PLAY
=
1.0
;
// Hysteresis caused by mechanical play (degrees)
$EL_RESCAN
=
8
;
// (degrees) around expected center
$EL_RESCAN_STEP
=
0.5
;
// (degrees)
$USABLE_FRACT
=
0.6
;
// use ony samples not less than this fraction of maximal
$USABLE_POW
=
1.0
;
// transform (maxstrengh - strengh) by applying pow - 1.2 ...1.3 may have marginal improvements
$ARGMAX_OURSIDE
=
0.2
;
// Allow argmax outside of the measured range by this fraction
...
...
@@ -98,8 +103,12 @@ if ($scan_mode){
$Success
=
$xml_state
->
Success
;
if
(
intval
(
$Success
)){
peakAzimuth
(
$xml_state
,
$AZ_PLAY
,
$AZ_RESCAN
,
$AZ_RESCAN_STEP
,
$USABLE_FRACT
,
$USABLE_POW
,
$ARGMAX_OURSIDE
);
$Success
=
peakAzimuthOrElevation
(
$xml_state
,
0
,
$AZ_PLAY
,
$AZ_RESCAN
,
$AZ_RESCAN_STEP
,
$USABLE_FRACT
,
$USABLE_POW
,
$ARGMAX_OURSIDE
);
$xml_state
=
simplexml_load_file
(
$motosat_url
);
if
(
intval
(
$Success
)){
$Success
=
peakAzimuthOrElevation
(
$xml_state
,
1
,
$EL_PLAY
,
$EL_RESCAN
,
$EL_RESCAN_STEP
,
$USABLE_FRACT
,
$USABLE_POW
,
$ARGMAX_OURSIDE
);
$xml_state
=
simplexml_load_file
(
$motosat_url
);
}
}
$xml
=
new
SimpleXMLElement
(
"<?xml version='1.0'?><motosat/>"
);
...
...
@@ -147,61 +156,64 @@ header('Access-Control-Allow-Origin: *');
printf
(
$rslt
);
exit
(
0
);
function
peakAzimuth
(
$xml_state
,
$az_play
,
$az_range
,
$az
_step
,
$fract
,
$pow
=
1.0
,
$argmax_outside
=
0.2
){
global
$motosat_url
,
$dbg_file
;
function
peakAzimuth
OrElevation
(
$xml_state
,
$el_not_az
,
$azel_play
,
$azel_range
,
$azel
_step
,
$fract
,
$pow
=
1.0
,
$argmax_outside
=
0.2
){
global
$motosat_url
,
$dbg_file
;
if
(
$xml_state
===
null
){
$xml_state
=
simplexml_load_file
(
$motosat_url
);
}
$DishAngle
=
getDishAngles
(
$xml_state
);
$az_start_center
=
$DishAngle
[
0
];
$motor
=
$el_not_az
?
1
:
0
;
$direction
=
$el_not_az
?
"ELEVATION"
:
"AZIMUTH"
;
$azel_start_center
=
$DishAngle
[
$motor
];
//move to sart rescan azimuth minus mechanical play
$DishAngle
[
0
]
=
$az_start_center
-
$az_play
-
$az
_range
/
2
;
$DishAngle
[
$motor
]
=
$azel_start_center
-
$azel_play
-
$azel
_range
/
2
;
moveElAzSk_degrees
(
$DishAngle
);
$scan_strengths
=
Array
();
for
(
$az
=
$az_start_center
-
$az
_range
/
2
;
$az
<
(
$az_start_center
+
$az_range
/
2
+
$az
_step
);
$az
+=
$az
_step
){
$DishAngle
[
0
]
=
$az
;
for
(
$az
el
=
$azel_start_center
-
$azel
_range
/
2
;
$az
el
<
(
$azel_start_center
+
$azel_range
/
2
+
$azel
_step
);
$az
el
+=
$azel
_step
){
$DishAngle
[
$motor
]
=
$azel
;
moveElAzSk_degrees
(
$DishAngle
);
// to be on the safe side re-read xml
$modem_strength
=
getModemStrength
();
$scan_strengths
[]
=
$modem_strength
;
}
if
(
$dbg_file
!==
null
)
{
fprintf
(
$dbg_file
,
"====
Azimuth
scan strengths: ====
\n
"
);
fprintf
(
$dbg_file
,
"====
$direction
scan strengths: ====
\n
"
);
fprintf
(
$dbg_file
,
print_r
(
$scan_strengths
,
1
));
}
$rel_argmax
=
findMax1d
(
$scan_strengths
,
$fract
,
$pow
,
$argmax_outside
);
if
(
$rel_argmax
!==
null
)
{
$az
_argmax
=
$az_start_center
-
$az_range
/
2
+
$az
_step
*
$rel_argmax
;
$az
el_argmax
=
$azel_start_center
-
$azel_range
/
2
+
$azel
_step
*
$rel_argmax
;
if
(
$dbg_file
!==
null
)
{
fprintf
(
$dbg_file
,
"reltive argmax = %f
\n
"
,
$rel_argmax
);
fprintf
(
$dbg_file
,
"
azimuth argmax = %f (was %f)
\n
"
,
$az_argmax
,
$az
_start_center
);
fprintf
(
$dbg_file
,
"
$direction
argmax = %f (was %f)
\n
"
,
$azel_argmax
,
$azel
_start_center
);
}
$DishAngle
[
0
]
=
$az_argmax
-
$az
_play
;
$DishAngle
[
$motor
]
=
$azel_argmax
-
$azel
_play
;
if
(
$dbg_file
!==
null
)
{
fprintf
(
$dbg_file
,
"====== Moving
azimuth to compensate motor play to = %f
\n
"
,
$DishAngle
[
0
]);
fprintf
(
$dbg_file
,
"====== Moving
$direction
to compensate motor play to = %f
\n
"
,
$DishAngle
[
$motor
]);
}
moveElAzSk_degrees
(
$DishAngle
);
$DishAngle
[
0
]
=
$az
_argmax
;
$DishAngle
[
$motor
]
=
$azel
_argmax
;
if
(
$dbg_file
!==
null
)
{
fprintf
(
$dbg_file
,
"====== Moving
azimuth to argmax position = %f
\n
"
,
$DishAngle
[
0
]);
fprintf
(
$dbg_file
,
"====== Moving
$direction
to argmax position = %f
\n
"
,
$DishAngle
[
$motor
]);
}
moveElAzSk_degrees
(
$DishAngle
);
return
1
;
// success
}
else
{
// for now - move back
if
(
$dbg_file
!==
null
)
{
fprintf
(
$dbg_file
,
"****** Failed to find maximum, going to known position.
\n
"
);
fprintf
(
$dbg_file
,
"****** Failed to find maximum
for
$direction
, going to known position.
\n
"
);
}
$DishAngle
[
0
]
=
$az
_start_center
;
$DishAngle
[
$motor
]
=
$azel
_start_center
;
moveElAzSk_degrees
(
$DishAngle
);
return
0
;
// failed
}
return
;
}
function
findMax1d
(
$data
,
$fract
,
$pow
,
$frac_outside
=
0.2
){
global
$dbg_file
;
$min
=
$data
[
0
];
...
...
Write
Preview
Markdown
is supported
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