Commit 1328d82c authored by Andrey Filippov's avatar Andrey Filippov

corrected movements

parent 791b5509
......@@ -40,6 +40,12 @@ $USABLE_FRACT = 0.6; // use ony samples not less than this fraction of maxima
$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
$ARGMAX_OURSIDE_2D = 0.0; // Allow argmax outside of the measured range by this fraction during 2D peaking
// Modem never allows wrong satellite to have signal strength above 29, and tries to maintain 30 for the correct one when the signal falls below.
// So these values can not be used for peaking(maybe only remove 30 if the signal is going down?)
$HUGHES_BAD_STRENGTHS = array(29,30);
/*
http://192.168.1.250/motor.xml?Action=ElUp&Distance=0.5&Units=1 0.5 degree up
......@@ -173,18 +179,9 @@ if ($scan_mode){
exit (0);
}
// Just move where requested
$total_cycles = 0;
if ($multi) {
while (true) {
$cycles = moveElAzSk_degrees($DishAngle);
if (!isset ($cycles)) {
break;
}
$total_cycles += $cycles;
}
} else {
$total_cycles = moveElAzSk_degrees($DishAngle);
}
$total_cycles = moveElAzSk_degrees($DishAngle, $multi);
$xml = new SimpleXMLElement("<?xml version='1.0'?><motosat/>");
$xml->addChild ('cycles',(string) $total_cycles );
$rslt=$xml->asXML();
......@@ -329,7 +326,7 @@ function peakAzimuthOrElevation($xml_state, $el_not_az, $azel_play, $azel_range,
}
function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet used
global $dbg_file;
global $HUGHES_BAD_STRENGTHS, $dbg_file;
$min= $data[0][0];
$max = $data[0][0];
$rows = sizeof($data);
......@@ -358,12 +355,17 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us
$xy = $argmax; // x,y pair
// put a cell into a queue, in $poly_data and mark a cell as used
$queue[] = $xy;
$poly_data[] = array(
array(0.0,0.0), // $xy,
array(
$data[$xy[1]][$xy[0]]
)
);
if (! in_array($data[$xy[1]][$xy[0]], $HUGHES_BAD_STRENGTHS)) {
$poly_data[] = array(
array(
0.0,
0.0
), // $xy,
array(
$data[$xy[1]][$xy[0]]
)
);
}
$cluster[$xy[1]][$xy[0]] = true;
while (sizeof($queue) > 0) {
......@@ -407,13 +409,18 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us
if ($data[$xy[1]][$xy[0]] < $threshold) // signal too weak
continue; // already used
$queue[] = $xy;
$poly_data[] = array(
array($xy[0]-$argmax[0], $xy[1]-$argmax[1]),
array(
$data[$xy[1]][$xy[0]]
)
);
$cluster[$xy[1]][$xy[0]] = true;
if (! in_array($data[$xy[1]][$xy[0]], $HUGHES_BAD_STRENGTHS)) { // use for the wave, but do not use for polynimial maximum
$poly_data[] = array(
array(
$xy[0] - $argmax[0],
$xy[1] - $argmax[1]
),
array(
$data[$xy[1]][$xy[0]]
)
);
}
}
}
if ($dbg_file !== null) {
......@@ -495,7 +502,7 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us
function findMax1d($data, $fract, $pow, $frac_outside = 0.2){
global $dbg_file;
global $HUGHES_BAD_STRENGTHS, $dbg_file;
$min= $data[0];
$max = $data[0];
$argmax = 0;
......@@ -522,7 +529,12 @@ function findMax1d($data, $fract, $pow, $frac_outside = 0.2){
$poly_data = Array();
for ($k = $k_min; $k <= $k_max; $k++){
$poly_data[] = Array($k-$argmax, $datap[$k]);
if (! in_array($datap[$k], $HUGHES_BAD_STRENGTHS)) { // skip samples with "bad" strengths (see explanation in the $HUGHES_BAD_STRENGTHS declaration
$poly_data[] = Array(
$k - $argmax,
$datap[$k]
);
}
}
$pa = new PolynomialApproximation();
......@@ -852,22 +864,34 @@ function waitMotorsReady($modem_threshold = 0.0){ //
return $try;
}
function moveElAzSk_counts($new_azelsk_count) {
$xml_state = moveElAzSk_start_counts($new_azelsk_count);
if (isset ($xml_state)){
$cycles = waitMotorsReady();
return $cycles; // $xml_state;
function moveElAzSk_counts($new_azelsk_count, $multi = true)
{
$total_cycles = 0;
while (true) {
$xml_state = moveElAzSk_start_counts($new_azelsk_count);
if (isset($xml_state)) {
$cycles = waitMotorsReady();
$total_cycles += $cycles;
if (!$multi)
return $total_cycles;
} else
return $total_cycles; // did not move last time
}
return;
}
function moveElAzSk_degrees($new_azelsk_degree) {
$xml_state = moveElAzSk_start_degrees($new_azelsk_degree);
if (isset ($xml_state)){
$cycles = waitMotorsReady();
return $cycles; // $xml_state;
function moveElAzSk_degrees($new_azelsk_degree, $multi = true)
{
$total_cycles = 0;
while (true) {
$xml_state = moveElAzSk_start_degrees($new_azelsk_degree);
if (isset($xml_state)) {
$cycles = waitMotorsReady();
$total_cycles += $cycles;
if (!$multi)
return $total_cycles;
} else
return $total_cycles; // did not move last time
}
return;
}
function myval ($s) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment