Commit 791b5509 authored by Andrey Filippov's avatar Andrey Filippov

deugging

parent edd3d613
...@@ -57,10 +57,10 @@ http://192.168.1.250/motor.xml?Action=Stop&Distance=100&Units=1 - stop ...@@ -57,10 +57,10 @@ http://192.168.1.250/motor.xml?Action=Stop&Distance=100&Units=1 - stop
//php > var_dump($DishAngle); //php > var_dump($DishAngle);
//array(3) {[0]=> float(9.97), [1]=> float(0), [2]=> float(0)} //array(3) {[0]=> float(9.97), [1]=> float(0), [2]=> float(0)}
$dbg_file = fopen("/home/eyesis/git/motosat/attic/logs/test04.log","w"); $dbg_file = fopen("/home/eyesis/git/motosat/attic/logs/test05.log","w");
fprintf($dbg_file,"test log\n"); fprintf($dbg_file,"test log\n");
if (true) { if (false) {
$arr = Array(5,6,7,9,9,10,11,11,12,12,11,11,10,10,10,36,40,45,47,51,51,51,49,48,43,38,30,30,30,10,10,10,10); $arr = Array(5,6,7,9,9,10,11,11,12,12,11,11,10,10,10,36,40,45,47,51,51,51,49,48,43,38,30,30,30,10,10,10,10);
$rslt = findMax1d($arr, $USABLE_FRACT, $USABLE_POW, $ARGMAX_OURSIDE); $rslt = findMax1d($arr, $USABLE_FRACT, $USABLE_POW, $ARGMAX_OURSIDE);
print_r($rslt); print_r($rslt);
...@@ -153,10 +153,10 @@ if ($scan_mode){ ...@@ -153,10 +153,10 @@ if ($scan_mode){
$xml->addChild ('Success',(string) $Success ); $xml->addChild ('Success',(string) $Success );
$xml->addChild ('SignalQuality',(string) $SignalQuality ); $xml->addChild ('SignalQuality',(string) $SignalQuality );
if (isset($DishAngle1D)){ if (isset($DishAngle1D)){
$xml->addChild ('DishAngle1D',$xml_state->$DishAngle1D ); $xml->addChild ('DishAngle1D',$DishAngle1D );
} }
if (isset($DishAngle2D)){ if (isset($DishAngle2D)){
$xml->addChild ('DishAngle2D',$xml_state->$DishAngle2D ); $xml->addChild ('DishAngle2D',$DishAngle2D );
} }
$xml->addChild ('DishAngle',$xml_state->DishAngle ); $xml->addChild ('DishAngle',$xml_state->DishAngle );
$xml->addChild ('DishCount',$xml_state->DishCountt ); $xml->addChild ('DishCount',$xml_state->DishCountt );
...@@ -212,6 +212,13 @@ function peak2D($xml_state, $az_play, $el_play, $az_range, $el_range, $az_step, ...@@ -212,6 +212,13 @@ function peak2D($xml_state, $az_play, $el_play, $az_range, $el_range, $az_step,
for ($el = $azel_start_center[1] - $el_range / 2; $el < ($azel_start_center[1] + $el_range / 2 + $el_step); $el += $el_step) { for ($el = $azel_start_center[1] - $el_range / 2; $el < ($azel_start_center[1] + $el_range / 2 + $el_step); $el += $el_step) {
$scan_strengths_line = Array(); $scan_strengths_line = Array();
$DishAngle[1] = $el; $DishAngle[1] = $el;
$DishAngle[0] = $azel_start_center[0] - $az_play - $az_range/2;
if ($dbg_file !== null) {
fprintf($dbg_file, "==== 2D scan line, elevation = %f ====\n",$el);
// fprintf($dbg_file, print_r($scan_strengths, 1));
}
moveElAzSk_degrees($DishAngle);
for ($az = $azel_start_center[0] - $az_range / 2; $az < ($azel_start_center[0] + $az_range / 2 + $az_step); $az += $az_step) { for ($az = $azel_start_center[0] - $az_range / 2; $az < ($azel_start_center[0] + $az_range / 2 + $az_step); $az += $az_step) {
$DishAngle[0] = $az; $DishAngle[0] = $az;
moveElAzSk_degrees($DishAngle); // to be on the safe side re-read xml moveElAzSk_degrees($DishAngle); // to be on the safe side re-read xml
...@@ -409,22 +416,26 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us ...@@ -409,22 +416,26 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us
$cluster[$xy[1]][$xy[0]] = true; $cluster[$xy[1]][$xy[0]] = true;
} }
} }
print ("*** sizeof(poly_data)=".sizeof($poly_data)."\n"); if ($dbg_file !== null) {
if (true) { fprintf($dbg_file, "*** sizeof(poly_data)=".sizeof($poly_data)."\n");
printf("argmax= (x=%d ,y=%d), max = %f, threshold = %f\n", }
// print ("*** sizeof(poly_data)=".sizeof($poly_data)."\n");
if ($dbg_file !== null) {
fprintf($dbg_file,"argmax= (x=%d ,y=%d), max = %f, threshold = %f\n",
$argmax[0], $argmax[1], $max, $threshold); $argmax[0], $argmax[1], $max, $threshold);
for ($i = 0; $i < $rows; $i ++) { for ($i = 0; $i < $rows; $i ++) {
for ($j = 0; $j < $cols; $j ++) { for ($j = 0; $j < $cols; $j ++) {
if (($i==$argmax[1]) && ($j==$argmax[0])) { if (($i==$argmax[1]) && ($j==$argmax[0])) {
printf("[%02d]", $data[$i][$j]); fprintf($dbg_file,"[%02d]", $data[$i][$j]);
} else if ($cluster[$i][$j] > 0) { } else if ($cluster[$i][$j] > 0) {
printf("<%02d>", $data[$i][$j]); fprintf($dbg_file,"<%02d>", $data[$i][$j]);
} else { } else {
printf(" %02d ", $data[$i][$j]); fprintf($dbg_file," %02d ", $data[$i][$j]);
} }
} }
printf("\n"); fprintf($dbg_file,"\n");
} }
} }
...@@ -437,13 +448,14 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us ...@@ -437,13 +448,14 @@ function findMax2d($data, $fract, $pow, $frac_outside = 0.2){ // $pow not yet us
if ($rslt == null){ if ($rslt == null){
return null; return null;
} }
$rslt_dbg =$rslt;
$rslt[0] += $argmax[0]; $rslt[0] += $argmax[0];
$rslt[1] += $argmax[1]; $rslt[1] += $argmax[1];
if ($dbg_file) { if ($dbg_file) {
fprintf($dbg_file, "argmax= (x=%d ,y=%d), max = %f, threshold = %f, rslt:\n", fprintf($dbg_file, "argmax= (x=%d ,y=%d), max = %f, threshold = %f, rslt_dbg=(x=%f, y=%f), rslt=(x=%f, y=%f)\n",
$argmax[0], $argmax[1], $max, $threshold); $argmax[0], $argmax[1], $max, $threshold,$rslt_dbg[0],$rslt_dbg[1],$rslt[0],$rslt[1]);
fprintf($dbg_file, print_r($rslt,1)); fprintf($dbg_file, print_r($rslt,1));
} }
...@@ -732,7 +744,7 @@ function moveElAzSk_start_counts($new_azelsk_count) { ...@@ -732,7 +744,7 @@ function moveElAzSk_start_counts($new_azelsk_count) {
} }
$dist = abs($dist); $dist = abs($dist);
$url = $motosat_url."?Action=".$mode.$dir.'&Distance='.$dist."&Units=0"; $url = $motosat_url."?Action=".$mode.$dir.'&Distance='.$dist."&Units=0";
if ($dbg_file) { if (false && $dbg_file) {
fprintf($dbg_file, "url = %s:\n",$url); fprintf($dbg_file, "url = %s:\n",$url);
fprintf($dbg_file, "new_azelsk_count:\n"); fprintf($dbg_file, "new_azelsk_count:\n");
fprintf($dbg_file, print_r($new_azelsk_count,1)); fprintf($dbg_file, print_r($new_azelsk_count,1));
...@@ -767,10 +779,10 @@ function moveElAzSk_start_degrees($new_azelsk_degree) { ...@@ -767,10 +779,10 @@ function moveElAzSk_start_degrees($new_azelsk_degree) {
($new_azelsk_degree[2] + $SK_0)*$SK_CPD); ($new_azelsk_degree[2] + $SK_0)*$SK_CPD);
fprintf($dbg_file, "new_azelsk_degree:\n"); fprintf($dbg_file, "new_azelsk_degree:\n");
fprintf($dbg_file, print_r($new_azelsk_degree,1)); fprintf($dbg_file, print_r($new_azelsk_degree,1));
fprintf($dbg_file, "new_azelsk_count_dbg:\n"); // fprintf($dbg_file, "new_azelsk_count_dbg:\n");
fprintf($dbg_file, print_r($new_azelsk_count_dbg,1)); // fprintf($dbg_file, print_r($new_azelsk_count_dbg,1));
fprintf($dbg_file, "new_azelsk_count:\n"); // fprintf($dbg_file, "new_azelsk_count:\n");
fprintf($dbg_file, print_r($new_azelsk_count,1)); // fprintf($dbg_file, print_r($new_azelsk_count,1));
} }
if ($dbg) { if ($dbg) {
$new_azelsk_count_dbg = Array ( $new_azelsk_count_dbg = Array (
......
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