*** empty log message ***

This commit is contained in:
Antoine Drouin
2005-08-27 02:58:40 +00:00
parent 22c180d3a8
commit 701e715fae
12 changed files with 193 additions and 237 deletions
+2 -2
View File
@@ -27,8 +27,8 @@
name="Thon1"
ac_id="1"
airframe="airframes/twinstar1.xml"
radio="radios/cockpitMM.xml"
flight_plan="flight_plans/muret_mini.xml"
radio="radios/mc3030.xml"
flight_plan="flight_plans/muret4.xml"
/>
<aircraft
+1 -1
View File
@@ -97,7 +97,7 @@
<program name="receive"/>
<program name="http server"/>
<program name="sim"><arg flag="-a" constant="Thon1"/></program>
<program name="cockpit"><arg flag="-render" constant="0"/></program>
<program name="cockpit"><arg flag="-render" constant="1"/></program>
<program name="map 2d ml"/>
<program name="messages"><arg flag="-c" constant="telemetry_ap:*"/><arg flag="-c" constant="ground:ground"/></program>
</session>
@@ -1,4 +1,4 @@
package Paparazzi::APPage;
package Paparazzi::AutopilotPage;
use Paparazzi::NDPage;
@ISA = ("Paparazzi::NDPage");
use strict;
@@ -36,14 +36,14 @@ sub build_gui {
my ($self) = @_;
$self->SUPER::build_gui();
my $zinc = $self->get('-zinc');
my $dy = $self->get('-height')/10;
my $y=10;
my $x=10;
my ($y, $dy) = (10, $self->get('-height')/10);
my ($x, $dx) = (10, 100);
foreach my $field (@fields) {
$zinc->add('text', $self->{main_group},
-position => [$x, $y+$self->{vmargin}],
-color => 'white',
-anchor => 'w',
-font => $self->{big_font},
-text => $field);
$self->{'text_'.$field} = $zinc->add('text', $self->{main_group},
-position => [$x + 100, $y+$self->{vmargin}],
+3 -13
View File
@@ -15,7 +15,6 @@ sub populate {
$self->SUPER::populate($args);
$self->configspec(
-svsinfo => [S_NOINIT, S_METHOD, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
-fix => [S_NOINIT, S_METHOD, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
);
}
@@ -33,7 +32,6 @@ sub svsinfo {
my $sat_obj = $self->{satellites}->[$i];
unless ($new_val->{svid}->[$i] == 0) {
my $pos = $self->get_pos($new_val->{elev}->[$i], $new_val->{azim}->[$i]);
# print "in SatPage::sats $i $new_val->{svid}->[$i] $new_val->{elev}->[$i], $new_val->{azim}->[$i] @{$pos}\n";
$zinc->coords($sat_obj->{-group}, $pos);
$zinc->itemconfigure ($sat_obj->{-group}, -visible => 1 );
$zinc->itemconfigure ($sat_obj->{-arc},
@@ -48,15 +46,6 @@ sub svsinfo {
}
}
sub fix {
my ($self, $old_val, $new_val) = @_;
# print "in fix\n";
return unless defined $new_val and defined $self->{rg};
# print "in fix2\n";
}
sub get_pos {
my ($self, $elev, $azim) = @_;
my $sky_radius = $self->{sky_radius};
@@ -88,6 +77,7 @@ sub build_gui {
[-$rad, -$rad, $rad, $rad],
-visible => 1,
-linecolor => 'white',
-linewidth => 1,
-filled => 0,
);
$zinc->add('text', $self->{sky_group},
@@ -95,10 +85,10 @@ sub build_gui {
-text => sprintf("%.0f", $elev),
-color => 'white',
-anchor => 'c',
-font => $self->{small_font},
);
}
# azimut scale
my $tick_font = '-adobe-helvetica-bold-o-normal--24-240-100-100-p-182-iso8859-1';
my $ticks = [["S", [0, $sky_radius]], ["E", [ $sky_radius, 0]],
["N", [0, -$sky_radius]], ["W", [-$sky_radius, 0]]];
foreach my $tick (@{$ticks}) {
@@ -107,7 +97,7 @@ sub build_gui {
-position => $pos,
-text => $txt,
-color => 'white',
-font => $tick_font,
-font => $self->{big_font},
-anchor => 'c',
);
}
@@ -1,152 +0,0 @@
package Paparazzi::IRPage;
use Paparazzi::NDPage;
@ISA = ("Paparazzi::NDPage");
use strict;
use Subject;
use DigiKit::Button;
use Paparazzi::HistoryView;
use constant TITLE => "Infrared";
use constant UPDATE_REPEAT => 2000;
sub populate {
my ($self, $args) = @_;
$args->{-title} = TITLE;
$self->SUPER::populate($args);
$self->configspec(
-wind => [S_NOINIT, S_METHOD, S_RDWR, S_OVRWRT, S_NOPRPG, {}],
-lls => [S_NOINIT, S_METHOD, S_RDWR, S_OVRWRT, S_NOPRPG, 0.0015],
);
}
sub completeinit {
my $self = shift;
$self->{wind_running} = 0;
$self->SUPER::completeinit();
# $self->build_gui();
$self->configure('-pubevts' => 'WIND_COMMAND');
$self->{timer_id} = $self->get('-zinc')->repeat(UPDATE_REPEAT, [\&onTimer, $self]);
}
sub onTimer {
my ( $self) = @_;
$self->{history}->put_value(scalar $self->get('-lls'));
}
sub wind {
my ($self, $old_val, $new_val) = @_;
foreach my $field (keys %{$new_val}) {
$self->get('-zinc')->itemconfigure ($self->{'text_'.$field},
-text => sprintf("%s : %.4f", $field, $new_val->{$field})) if defined $self->{'text_'.$field};
}
}
sub lls {
my ($self, $old_val, $new_val) = @_;
return unless defined $new_val and defined $self->{history};
# $self->{history}->put_value($new_val);
$self->get('-zinc')->itemconfigure ($self->{'text_auto gain'},
-text => sprintf("auto gain : %.5f", $new_val));
}
#sub put_lls {
# my ($self, $value) = @_;
## $self->{history}->put_value($value);
#}
sub build_gui {
my ($self) = @_;
$self->SUPER::build_gui();
my $zinc = $self->get('-zinc');
my $parent_grp = $self->get('-parent_grp');
my $main_group = $self->{main_group};
my $fields = ["contrast", "gain","auto gain"];
my ($y, $dy) = ( 35, 20);
foreach my $field (@{$fields}) {
$self->{'text_'.$field} = $zinc->add('text', $main_group,
-position => [20, $y],
-color => 'white',
-anchor => 'w',
-text => "$field");
$y+=$dy;
}
my $nb_bars = 125;
$self->{history} =
Paparazzi::HistoryView->new(-zinc => $zinc,
-width => 250,
-height => 50,
-origin => [20, 90],
-parent_grp => $self->{main_group},
-nb_bars => $nb_bars,
-initial_range => 0.003,
);
$zinc->add('text', $main_group,
-position => [20, 145],
-color => 'white',
-anchor => 'w',
-text => sprintf("%d seconds", UPDATE_REPEAT * $nb_bars / 1000),
);
$zinc->add('text', $main_group,
-position => [10, 170],
-color => 'white',
-anchor => 'w',
-text => "Wind");
$fields = ['dir', 'speed','mean_aspeed', 'stddev'];
($y, $dy) = ( 190, 20);
foreach my $field (@{$fields}) {
$self->{'text_'.$field} = $zinc->add('text', $main_group,
-position => [20, $y],
-color => 'white',
-anchor => 'w',
-text => "$field");
$y+=$dy;
}
$self->{button_clear_wind} = DigiKit::Button->new(-widget => $zinc,
-parentgroup => $main_group,
-style => ['Aqualike',
-width => 60,
-height => 20,
-color => 'green',
-text => 'clear',
-trunc => 'right',
],
-position => [10, 262],
);
$self->{button_toggle_wind} = DigiKit::Button->new(-widget => $zinc,
-parentgroup => $main_group,
-style => ['Aqualike',
-width => 60,
-height => 20,
-color => 'green',
-text => 'start',
-trunc => 'left',
],
-position => [70, 262],
);
$self->{button_clear_wind}->configure(-releasecommand => sub {
$self->notify('WIND_COMMAND', 'clear');
}
);
$self->{button_toggle_wind}->configure(-releasecommand => sub {
if ($self->{wind_running}) {
$self->{button_toggle_wind}->value('start');
$self->notify('WIND_COMMAND', 'stop');
$self->{wind_running} = 0;
}
else {
$self->{button_toggle_wind}->value('stop');
$self->notify('WIND_COMMAND', 'start');
$self->{wind_running} = 1;
}
}
);
}
@@ -0,0 +1,100 @@
package Paparazzi::InfraredPage;
use Paparazzi::NDPage;
@ISA = ("Paparazzi::NDPage");
use strict;
use Subject;
use DigiKit::Button;
use Paparazzi::HistoryView;
use constant TITLE => "Infrared";
use constant UPDATE_REPEAT => 2000;
my @fields = ('contrast_status', 'contrast_value', 'gps_hybrid_mode', 'gps_hybrid_factor');
sub populate {
my ($self, $args) = @_;
$args->{-title} = TITLE;
$self->SUPER::populate($args);
$self->configspec(
-lls => [S_NOINIT, S_METHOD, S_RDWR, S_OVRWRT, S_NOPRPG, 0.0015],
);
}
sub completeinit {
my $self = shift;
$self->SUPER::completeinit();
# $self->build_gui();
$self->{timer_id} = $self->get('-zinc')->repeat(UPDATE_REPEAT, [\&onTimer, $self]);
}
sub set_aircraft {
my ($self, $prev_ac, $new_ac) = @_;
foreach my $field (@fields) {
$prev_ac->detach($self, $field, [\&update_field]) if ($prev_ac);
$new_ac->attach($self, $field, [\&update_field]) if ($new_ac);
}
}
sub update_field {
my ($self, $aircraft, $field, $new_value) = @_;
my $text = $new_value;
$self->get('-zinc')->itemconfigure($self->{'value_'.$field}, -text => $text);
}
sub onTimer {
my ( $self) = @_;
$self->{history}->put_value(scalar $self->get('-lls'));
}
sub lls {
my ($self, $old_val, $new_val) = @_;
return unless defined $new_val and defined $self->{history};
$self->get('-zinc')->itemconfigure ($self->{'text_auto gain'},
-text => sprintf("auto gain : %.5f", $new_val));
}
sub build_gui {
my ($self) = @_;
$self->SUPER::build_gui();
my $zinc = $self->get('-zinc');
my $parent_grp = $self->get('-parent_grp');
my $main_group = $self->{main_group};
my ($y, $dy) = ( 35, 20);
my ($x, $dx) = (10, 150);
foreach my $field (@fields) {
$self->{'label_'.$field} = $zinc->add('text', $main_group,
-position => [$x, $y],
-color => 'white',
-anchor => 'w',
-text => "$field");
$self->{'value_'.$field} = $zinc->add('text', $main_group,
-position => [$x+$dx, $y],
-color => 'white',
-anchor => 'w',
-text => "N/A");
$y+=$dy;
}
my $nb_bars = 125;
$dy = 50;
$self->{history} =
Paparazzi::HistoryView->new(-zinc => $zinc,
-width => 250,
-height => $dy,
-origin => [20, $y],
-parent_grp => $self->{main_group},
-nb_bars => $nb_bars,
-initial_range => 0.003,
);
$y += $dy+10;
$zinc->add('text', $main_group,
-position => [20, $y ],
-color => 'white',
-anchor => 'w',
-text => sprintf("%d seconds", UPDATE_REPEAT * $nb_bars / 1000),
-font => $self->{small_font},
);
}
+5 -24
View File
@@ -9,8 +9,8 @@ use Tk;
use Tk::Zinc;
use Paparazzi::SatPage;
use Paparazzi::EnginePage;
use Paparazzi::APPage;
use Paparazzi::IRPage;
use Paparazzi::AutopilotPage;
use Paparazzi::InfraredPage;
sub populate {
my ($self, $args) = @_;
@@ -52,8 +52,9 @@ sub selected_ac {
$previous_ac->detach($self, $attr, [\&foo_cbk, $attr]) if ($previous_ac);
$new_ac->attach($self, $attr, [\&foo_cbk, $attr]);
}
$self->{AP}->set_aircraft($previous_ac, $new_ac);
$self->{Autopilot}->set_aircraft($previous_ac, $new_ac);
$self->{Settings}->set_aircraft($previous_ac, $new_ac);
$self->{Infrared}->set_aircraft($previous_ac, $new_ac);
}
sub foo_cbk {
@@ -79,7 +80,7 @@ sub build_gui() {
my $real_width = $page_width - 2*$margin;
my ($page_per_row, $row, $col) = (2, 0, 0);
my @pages = ('Gps', 'AP', 'Settings', 'Engine', 'IR');
my @pages = ('Infrared', 'Gps', 'Autopilot', 'Settings', 'Engine');
foreach my $page (@pages) {
$self->{$page} = $self->component('Paparazzi::'.$page.'Page',
-zinc => $zinc,
@@ -96,26 +97,6 @@ sub build_gui() {
$col++;
unless ($col lt $page_per_row) { $col=0; $row++ };
}
# my $engine_h = { -nb_engine => 2,
# -engine => [{throttle => 50, -rpm => 3500, -temp => 39},
# {throttle => 50, -rpm => 3400, -temp => 37}],
# -bat => 11.5,
# -energy => 25.2
# };
# my $ap_h = {
# -mode => 1,
# -h_mode => 2,
# -v_mode => 0,
# -target_climb => 1.,
# -target_alt => 200.,
# -target_heading => 36.,
# };
# $self->{AP}->configure( -ap_status => $ap_h);
}
1;
@@ -24,6 +24,7 @@ sub populate {
sub completeinit {
my $self = shift;
$self->SUPER::completeinit;
$self->{big_font} = "bleriot-radar-m16c";
$self->{normal_font} = "bleriot-radar-m12c";
$self->{small_font} = "bleriot-radar-m8c";
$self->build_gui();
@@ -27,7 +27,7 @@ sub completeinit {
my $self = shift;
$self->SUPER::completeinit();
$self->{pages} = ['Gps', 'AP', 'Settings', 'Engine', 'IR'];
$self->{pages} = ['Infrared', 'Gps', 'Autopilot', 'Settings', 'Engine'];
$self->build_gui();
$self->configure('-pubevts' => 'CLICKED');
}
@@ -7,18 +7,21 @@ use Data::Dumper;
use constant TITLE => "Settings";
my @fields = ('if_mode', 'ap_mode');
my @fields = ('if_mode', 'if_value1', 'if_value2', 'ap_mode');
my @ap_modes = ('AUTO1', 'AUTO2');
my @if_modes = ('UP', 'DOWN');
my @sliders = ('gain_1', 'gain_2');
sub populate {
my ($self, $args) = @_;
$args->{-title} = TITLE;
$self->SUPER::populate($args);
$self->configspec(
ap_mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 'MANUAL'],
if_mode => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, 'OFF'],
);
}
sub set_aircraft {
my ($self, $prev_ac, $new_ac) = @_;
foreach my $field (@fields) {
@@ -26,15 +29,15 @@ sub set_aircraft {
$new_ac->attach($self, $field, [\&update_field]) if ($new_ac);
}
my $fligh_plan = $new_ac->get('flight_plan');
# use Data::Dumper;
# print "#####".Dumper(scalar $fligh_plan->get('-rc_control'));
my $zinc = $self->get('-zinc');
my $rc_controls = $fligh_plan->get('-rc_control');
foreach my $mode (keys %{$rc_controls}) {
foreach my $dir (keys %{$rc_controls->{$mode}}) {
foreach my $slider (keys %{$rc_controls->{$mode}->{$dir}}) {
my $zinc = $self->get('-zinc');
foreach my $mode (@ap_modes) {
foreach my $dir (@if_modes) {
foreach my $slider (@sliders) {
my $label = $self->{'label_'.$mode."_".$dir."_".$slider};
$zinc->itemconfigure($label, -text => $rc_controls->{$mode}->{$dir}->{$slider}->[0]);
my $text = defined $rc_controls->{$mode}->{$dir}->{$slider} ?
$rc_controls->{$mode}->{$dir}->{$slider}->[0] : 'N/A';
$zinc->itemconfigure($label, -text => $text);
}
}
}
@@ -42,24 +45,32 @@ sub set_aircraft {
sub update_field {
my ($self, $aircraft, $field, $new_value) = @_;
if ($field eq 'ap_mode' or $field eq 'if_mode') {
$self->get('-zinc')->itemconfigure($self->{'text_'.$field}, -text => $new_value);
}
# else {
my $zinc = $self->get('-zinc');
my $ap_mode = $aircraft->get('ap_mode');
my $if_mode = $aircraft->get('if_mode');
foreach my $slider ('gain_1', 'gain_2') {
my $label = $self->{'label_'.$ap_mode."_".$if_mode."_".$slider};
$zinc->itemconfigure($label, -color => 'green');
print "$ap_mode $if_mode $slider $label\n";
if ($field eq 'ap_mode' or $field eq 'if_mode') {
$zinc->itemconfigure($self->{'text_'.$field}, -text => $new_value);
my $old_ap_mode = $self->get('ap_mode');
my $old_if_mode = $self->get('if_mode');
foreach my $slider (@sliders) {
my $label = $self->{'label_'.$old_ap_mode."_".$old_if_mode."_".$slider};
$zinc->itemconfigure($label, -color => 'white') if defined $label;
$label = $self->{'value_'.$old_ap_mode."_".$old_if_mode."_".$slider};
$zinc->itemconfigure($label, -color => 'white') if defined $label;
$label = $self->{'label_'.$ap_mode."_".$if_mode."_".$slider};
$zinc->itemconfigure($label, -color => 'green') if defined $label;
$label = $self->{'value_'.$ap_mode."_".$if_mode."_".$slider};
$zinc->itemconfigure($label, -color => 'green') if defined $label;
$self->configure( 'ap_mode' => $ap_mode, 'if_mode' => $if_mode);
# print "$ap_mode $if_mode $slider $label\n";
}
}
else {
$field =~ /if_value(\S)/;
my $slider = "gain_".$1;
my $label = $self->{'value_'.$ap_mode."_".$if_mode."_".$slider};
$zinc->itemconfigure($label, -text => $new_value) if defined $label;
}
# $field =~ /if_value(\S)/;
# my $slider = "GAIN_".$1;
# my $label = $self->{'label_'.$ap_mode."_".$if_mode."_".$slider};
# print "$ap_mode $if_mode $slider $label\n";
# }
}
sub build_gui {
@@ -69,23 +80,29 @@ sub build_gui {
my $dy = $self->get('-height')/10;
my $y=10;
my $x=10;
foreach my $field (@fields) {
my $dx = 70;
foreach my $field ('ap_mode', 'if_mode') {
$zinc->add('text', $self->{main_group},
-position => [$x, $y+$self->{vmargin}],
-color => 'white',
-anchor => 'w',
-text => $field);
-text => $field,
-font => $self->{normal_font},
);
$x += $dx;
$self->{'text_'.$field} = $zinc->add('text', $self->{main_group},
-position => [$x + 100, $y+$self->{vmargin}],
-position => [$x, $y+$self->{vmargin}],
-color => 'white',
-anchor => 'w',
-text => 'NA');
$y+=$dy;
$x += $dx;
}
my @ap_modes = ('AUTO1', 'AUTO2');
my @if_modes = ('UP', 'DOWN');
my @sliders = ('gain_1', 'gain_2');
$x = 10;
$y+=$dy;
$dx = 100;
$dy = 35;
foreach my $ap_mode (@ap_modes) {
$x = 10;
$zinc->add('text', $self->{main_group},
@@ -94,7 +111,7 @@ sub build_gui {
-anchor => 'w',
-text => $ap_mode);
foreach my $slider (@sliders) {
$x += 100;
$x += $dx;
$zinc->add('text', $self->{main_group},
-position => [$x, $y+$self->{vmargin}],
-color => 'white',
@@ -103,25 +120,34 @@ sub build_gui {
}
foreach my $if_mode (@if_modes) {
$x = 10;
$y += 35;
$y += $dy;
$zinc->add('text', $self->{main_group},
-position => [$x, $y+$self->{vmargin}],
-color => 'white',
-anchor => 'w',
-text => $if_mode);
foreach my $slider (@sliders) {
$x += 100;
$x += $dx;
$self->{'label_'.$ap_mode."_".$if_mode."_".$slider} =
$zinc->add('text', $self->{main_group},
-position => [$x, $y+$self->{vmargin}],
-position => [$x, $y+$self->{vmargin} - 7],
-color => 'white',
-anchor => 'w',
-text => "N/A",
-font => $self->{small_font},
);
$self->{'value_'.$ap_mode."_".$if_mode."_".$slider} =
$zinc->add('text', $self->{main_group},
-position => [$x, $y+$self->{vmargin} + 7],
-color => 'white',
-anchor => 'w',
-text => "N/A",
-font => $self->{small_font},
);
}
}
$y += 35;
$y += $dy;
}
}
+13 -3
View File
@@ -318,7 +318,7 @@ sub set_item {
# print "in Strip::set_item $item_name $string $color ($self->{prefix})\n";
my $zinc = $self->get('-zinc');
my $item = $zinc->find('withtag', $self->{prefix}.$item_name."_value");
print "in Strip::set_item $item_name $string color $color\n";
# print "in Strip::set_item $item_name $string color $color\n";
$zinc->itemconfigure($item, -text => $string, -color => $color);
}
@@ -371,6 +371,17 @@ sub attach_to_aircraft {
}
sub get_color {
my ($self, $mode, $value) = @_;
if (defined $self->{new_modes}->{$mode}->{$value}) {
return $self->{new_modes}->{$mode}->{$value};
}
else {
return 'black';
}
}
sub aircraft_config_changed {
my ($self, $aircraft, $event, $new_value) = @_;
# print "in strip aircraft_config_changed $event $new_value\n";
@@ -382,8 +393,7 @@ sub aircraft_config_changed {
$self->get('-zinc')->itemconfigure($self->{ident}, -text => scalar $new_value->get('-name')) if defined $new_value;
}
elsif ($event eq 'rc_status' or $event eq 'rc_mode' or $event eq 'contrast_status' or $event eq 'ap_mode' or $event eq 'gps_mode') {
my $color = $self->{new_modes}->{$event}->{$new_value};
$self->set_item($event, $new_value, $color);
$self->set_item($event, $new_value, $self->get_color($event, $new_value));
}
elsif ($event eq 'flight_time') {
$self->set_item("flight_time",$self->string_of_time($new_value), $self->{options}->{value_color});
+1 -1
View File
@@ -147,7 +147,7 @@ sub parse_rc_control {
$s->getAttribute('range'),
$s->getAttribute('type'));
$rc =~ /(gain_.+)_(\S+)/;
my ($slider, $direction) = ($1, $2);
my ($slider, $direction) = ($1, uc $2);
$rc_control->{$mode_name}->{$direction}->{$slider} = [$var, $range, $type];
}
}