Skip to content

Commit

Permalink
add a new message comming from the generic_com module and parsed by the
Browse files Browse the repository at this point in the history
server
  • Loading branch information
gautierhattenberger committed Jun 2, 2011
1 parent ee8d663 commit 3cdebeb
Show file tree
Hide file tree
Showing 6 changed files with 761 additions and 462 deletions.
18 changes: 13 additions & 5 deletions conf/messages.xml
Expand Up @@ -528,11 +528,19 @@
<field name="cte_int" type="float"/>
</message>

<message name="ESTIMATOR_COMP_FILTER" id="81">
<field name="gyro_hp_last_out" type="float"/>
<field name="gyro_int" type="float"/>
<field name="gps_lp_last_out" type="float"/>
<field name="ir_lp_last_out" type="float"/>
<message name="GENERIC_COM" id="81">
<field name="lat" type="int32" unit="1e7deg"/>
<field name="lon" type="int32" unit="1e7deg"/>
<field name="alt" type="int16" unit="m"/>
<field name="gspeed" type="uint16" unit="cm/s" alt_unit="m/s"/>
<field name="course" type="int16" unit="decideg" alt_unit="deg"/>
<field name="airspeed" type="uint16" unit="cm/s" alt_unit="m/s"/>
<field name="vsupply" type="uint8" unit="decivolt"/>
<field name="energy" type="uint8" unit="deciAh"/>
<field name="throttle" type="uint8" unit="%"/>
<field name="ap_mode" type="uint8"/>
<field name="nav_block" type="uint8"/>
<field name="flight_time" type="uint16" unit="s"/>
</message>

<message name="FORMATION_SLOT_TM" id="82">
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/modules/com/generic_com.c
Expand Up @@ -76,8 +76,8 @@ void generic_com_periodic( void ) {
FillBufWith16bit(com_trans.buf, 11, gps_gspeed); // ground speed
FillBufWith16bit(com_trans.buf, 13, gps_course); // course
FillBufWith16bit(com_trans.buf, 15, (uint16_t)(estimator_airspeed*100)); // TAS (cm/s)
com_trans.buf[17] = electrical.vsupply;
com_trans.buf[18] = (uint8_t)(energy*10);
com_trans.buf[17] = electrical.vsupply; // decivolts
com_trans.buf[18] = (uint8_t)(energy/100); // deciAh
com_trans.buf[19] = (uint8_t)(ap_state->commands[COMMAND_THROTTLE]*100/MAX_PPRZ);
com_trans.buf[20] = pprz_mode;
com_trans.buf[21] = nav_block;
Expand Down
20 changes: 20 additions & 0 deletions sw/ground_segment/tmtc/fw_server.ml
Expand Up @@ -276,6 +276,26 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values ->
and alt = ivalue "alt" in
let geo = make_geo_deg (float lat /. 1e7) (float lon /. 1e7) in
update_waypoint a (ivalue "wp_id") geo (float alt /. 100.)
| "GENERIC_COM" ->
let flight_time = ivalue "flight_time" in
if flight_time >= a.flight_time then begin
a.flight_time <- flight_time;
let lat = fvalue "lat"
and lon = fvalue "lon" in
let geo = make_geo_deg (lat /. 1e7) (lon /. 1e7) in
a.pos <- geo;
a.alt <- fvalue "alt";
a.gspeed <- fvalue "gspeed" /. 100.;
a.course <- norm_course ((Deg>>Rad)(fvalue "course" /. 10.));
if !heading_from_course then
a.heading <- a.course;
a.agl <- a.alt -. float (try Srtm.of_wgs84 a.pos with _ -> 0);
a.bat <- fvalue "vsupply" /. 10.;
a.energy <- ivalue "energy" * 100;
a.throttle <- fvalue "throttle";
a.ap_mode <- check_index (ivalue "ap_mode") fixedwing_ap_modes "AP_MODE";
a.cur_block <- ivalue "nav_block";
end
| "FORMATION_SLOT_TM" ->
Dl_Pprz.message_send "ground_dl" "FORMATION_SLOT" values
| "FORMATION_STATUS_TM" ->
Expand Down
2 changes: 2 additions & 0 deletions sw/in_progress/satcom/Makefile
Expand Up @@ -6,6 +6,8 @@ udp2tcp: udp2tcp.c
gcc -g -O2 -Wall -o $@ $^
tcp2ivy: tcp2ivy.c
gcc -g -O2 -Wall `pkg-config glib-2.0 --cflags` -o $@ $^ `pkg-config glib-2.0 --libs` -lglibivy -lm
tcp2ivy_generic: tcp2ivy_generic.c
gcc -g -O2 -Wall `pkg-config glib-2.0 --cflags` -I../../../var/${AIRCRAFT} -o $@ $^ `pkg-config glib-2.0 --libs` -lglibivy -lm

clean:
rm email2udp udp2tcp tcp2ivy

0 comments on commit 3cdebeb

Please sign in to comment.