Difference between revisions of "DevGuide/Communications"

From PaparazziUAV
Jump to navigation Jump to search
m (In progress)
Line 5: Line 5:




describe your message in the telemetry section in conf/messages.xml
Describe your message in the telemetry section in <tt>conf/messages.xml</tt>


this should looks like this  
This should looks like this  
   
   
  <message name="MARK" id="32">
  <message name="MARK" id="32">
Line 15: Line 15:
  </message>
  </message>


the id has to be unique
The '''id''' has to be unique. The fields can have type '''int8''', '''int16''', '''int32''', '''uint8''', '''uint16''', '''uint32''', '''float''' and arrays of those. They must be aligned on a multiple of their size (c.f. examples with ''pad'' fields).
the fields can have type int8, int16, int32, uint8, uint16, uint32, float and arrays of those


they must be aligned in order to work on arm7 ( write more on that )
This enables all the ground system to deal with your message and generate sending code for the airborne system. The code is generated in <tt>var/include/messages.h</tt>.


this enable all the ground system to deal with your message and generate sending code for the airborne system
From the airborne code you can send the message by using this code, for example
the generated code is in var/include/messages.h


from the airborne code you can send the message by using this code, for example
  DOWNLINK_SEND_MARK(&mark_id, &mark_lat, &mark_long);
 
  DOWNLINK_SEND_MARK(&ant_v2x_data.xraw, &ant_v2x_data.yraw, \
                    &ant_v2x_data.xcal, &ant_v2x_data.ycal, \
                    &ant_v2x_data.heading, &ant_v2x_data.magnitude, \
                    &ant_v2x_data.temp, &ant_v2x_data.distor, \
                    &ant_v2x_data.cal_status);
   
   
you can also have the autopilot send the message periodically
You can also have the autopilot send the message periodically.
For doing that, in your telemetry file ( for example conf/telemetry/default.xml you can make your own it is referenced in the airframe file)
For doing that, in your telemetry file (for example <tt>conf/telemetry/default.xml</tt>,  you can make your own and reference it in the [[Conf.xml|<tt>conf/conf.xml</tt>]] file). You can add a line like
you can add a line like
   
   
  <message name="CALIB_START"   period="1"/>  
  <message name="MARK" period="1"/>


meaning that CALIB_START will be sent every second
meaning that '''MARK''' will be sent every second. You then need to specify the arguments to your message in <tt>the sw/airborne/ap_downlink.h</tt> header by providing a macro  
you then need to specify the arguments to your message in the sw/airborne/ap_downlink.h header by providing a macro  


  PERIODIC_SEND_DEBUG_CALIB_START()
  PERIODIC_SEND_MARK()


 
You can have different telemetry modes having different rates for each message. FOr example you might want a verbose mode and a stealth mode
you can have different telemetry modes having different rates for each message. FOr example you might want a verbose mode and a stealth mode


when sent by the aircraft the message will be available on the ground ivy bus
when sent by the aircraft the message will be available on the ground ivy bus
Line 51: Line 40:
the file sw/ground_segment/cockpit/ant_track.c shows how to receive a message in a C program
the file sw/ground_segment/cockpit/ant_track.c shows how to receive a message in a C program
for ocaml, we have a higher level library to receive messages
for ocaml, we have a higher level library to receive messages


== adding datalink (uplink) messages ==
== adding datalink (uplink) messages ==

Revision as of 03:18, 17 January 2008

This page describes the way the communications with the aircrafts are implemented in paparazzi

We'll start with high level stuff such as sending your own telemetry message or datalink (uplink) message. We'll then look at the lower layers

sending telemetry message

Describe your message in the telemetry section in conf/messages.xml

This should looks like this

<message name="MARK" id="32">
  <field name="ac_id" type="uint8"/>
  <field name="lat" type="float" unit="deg"/>
  <field name="long" type="float" unit="deg"/>
</message>

The id has to be unique. The fields can have type int8, int16, int32, uint8, uint16, uint32, float and arrays of those. They must be aligned on a multiple of their size (c.f. examples with pad fields).

This enables all the ground system to deal with your message and generate sending code for the airborne system. The code is generated in var/include/messages.h.

From the airborne code you can send the message by using this code, for example

DOWNLINK_SEND_MARK(&mark_id, &mark_lat, &mark_long);

You can also have the autopilot send the message periodically. For doing that, in your telemetry file (for example conf/telemetry/default.xml, you can make your own and reference it in the conf/conf.xml file). You can add a line like

<message name="MARK" period="1"/>

meaning that MARK will be sent every second. You then need to specify the arguments to your message in the sw/airborne/ap_downlink.h header by providing a macro

PERIODIC_SEND_MARK()

You can have different telemetry modes having different rates for each message. FOr example you might want a verbose mode and a stealth mode

when sent by the aircraft the message will be available on the ground ivy bus

you can watch it using the messages program or with ivyprobe

the file sw/ground_segment/cockpit/ant_track.c shows how to receive a message in a C program for ocaml, we have a higher level library to receive messages

adding datalink (uplink) messages

This is similar to the above. Add your message in the datalink section of messages.xml This will generate parsing code for the airborne program (var/include/dl_protocol.h).

You then can add your handler in the sw/airborne/datalink.c code (a way should be fined to include external code in that) or you can just rewrite your own dl_parse_msg() function, for example in a test program where you want to receive only your own messages.

The "transport" layer

Paparazzi can use the built-in transport layer of different hardware (currently only wavecards and xbee/xtends) and also provides his own layer for hardware lacking it (showing as remote serial ports). Files xbee.[ch] and pprz_transport.[ch].