paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Paparazzi-devel] Re: Paparazzi UBX protocol parser


From: Hugo Vincent
Subject: [Paparazzi-devel] Re: Paparazzi UBX protocol parser
Date: Tue, 03 May 2005 19:46:04 +1200

Thanks Antoine,

Can I ask why you specify the protocol for UBX in an XML file? It surely the protocol can't change often enough to justify not putting it straight into the code troublesome?

Cheers,
Hugo.

On 2/05/2005, at 2:15 AM, Antoine wrote:

Hi Hugo

Hugo Vincent wrote:
Hi Antoine,
I don't have a machine set up and working at the moment with all the
Paparazzi dependencies,

Easyest way to do that is to install a debian sarge (testing), add the line
deb http://www.recherche.enac.fr/paparazzi/debian testing main
to you /etc/apt/sources.lst
and perform a
apt-get install paparazzi
everything sould be working then

another solution is to use the the paparazzix, a knoppix based live cd with everything installed. You can grab the iso from here :

http://www.recherche.enac.fr/paparazzi/paparazzix_0_1.iso

and am trying to use your U-Blox UBX parsing
code for my UAV project. If its not to much trouble, could you please
e-mail me a copy of the generated code for the UBX protocol and a
typical flight plane (i.e. ubx_protocol.h and flight_plan.h). Thanks in
anticipation.

here you go

A+

Antoine


Cheers,
Hugo Vincent.

/* Generated from conf/ubx.xml */
/* Please DO NOT EDIT */

#define UBX_SYNC1 0xB5
#define UBX_SYNC2 0x62

#define UBX_NAV_ID 0x01

#define UBX_NAV_POSLLH_ID 0x02
#define UBX_NAV_POSLLH_ITOW(_ubx_payload) (*((uint32_t*)(_ubx_payload+0))) #define UBX_NAV_POSLLH_LON(_ubx_payload) (*((int32_t*)(_ubx_payload+4))) #define UBX_NAV_POSLLH_LAT(_ubx_payload) (*((int32_t*)(_ubx_payload+8))) #define UBX_NAV_POSLLH_HEIGHT(_ubx_payload) (*((int32_t*)(_ubx_payload+12))) #define UBX_NAV_POSLLH_HMSL(_ubx_payload) (*((int32_t*)(_ubx_payload+16))) #define UBX_NAV_POSLLH_Hacc(_ubx_payload) (*((uint32_t*)(_ubx_payload+20))) #define UBX_NAV_POSLLH_Vacc(_ubx_payload) (*((uint32_t*)(_ubx_payload+24)))

#define UBX_NAV_POSUTM_ID 0x08
#define UBX_NAV_POSUTM_ITOW(_ubx_payload) (*((uint32_t*)(_ubx_payload+0))) #define UBX_NAV_POSUTM_EAST(_ubx_payload) (*((int32_t*)(_ubx_payload+4))) #define UBX_NAV_POSUTM_NORTH(_ubx_payload) (*((int32_t*)(_ubx_payload+8))) #define UBX_NAV_POSUTM_ALT(_ubx_payload) (*((int32_t*)(_ubx_payload+12))) #define UBX_NAV_POSUTM_ZONE(_ubx_payload) (*((int8_t*)(_ubx_payload+16))) #define UBX_NAV_POSUTM_HEM(_ubx_payload) (*((int8_t*)(_ubx_payload+17)))

#define UBX_NAV_STATUS_ID 0x03
#define UBX_NAV_STATUS_ITOW(_ubx_payload) (*((uint32_t*)(_ubx_payload+0))) #define UBX_NAV_STATUS_GPSfix(_ubx_payload) (*((uint8_t*)(_ubx_payload+4))) #define UBX_NAV_STATUS_Flags(_ubx_payload) (*((uint8_t*)(_ubx_payload+5))) #define UBX_NAV_STATUS_DiffS(_ubx_payload) (*((uint8_t*)(_ubx_payload+6))) #define UBX_NAV_STATUS_res(_ubx_payload) (*((uint8_t*)(_ubx_payload+7))) #define UBX_NAV_STATUS_TTFF(_ubx_payload) (*((uint32_t*)(_ubx_payload+8))) #define UBX_NAV_STATUS_MSSS(_ubx_payload) (*((uint32_t*)(_ubx_payload+12)))

#define UBX_NAV_VELNED_ID 0x12
#define UBX_NAV_VELNED_ITOW(_ubx_payload) (*((uint32_t*)(_ubx_payload+0))) #define UBX_NAV_VELNED_VEL_N(_ubx_payload) (*((int32_t*)(_ubx_payload+4))) #define UBX_NAV_VELNED_VEL_E(_ubx_payload) (*((int32_t*)(_ubx_payload+8))) #define UBX_NAV_VELNED_VEL_D(_ubx_payload) (*((int32_t*)(_ubx_payload+12))) #define UBX_NAV_VELNED_Speed(_ubx_payload) (*((uint32_t*)(_ubx_payload+16))) #define UBX_NAV_VELNED_GSpeed(_ubx_payload) (*((uint32_t*)(_ubx_payload+20))) #define UBX_NAV_VELNED_Heading(_ubx_payload) (*((int32_t*)(_ubx_payload+24))) #define UBX_NAV_VELNED_SAcc(_ubx_payload) (*((uint32_t*)(_ubx_payload+28))) #define UBX_NAV_VELNED_CAcc(_ubx_payload) (*((uint32_t*)(_ubx_payload+32)))

#define UBX_NAV_SVINFO_ID 0x30
#define UBX_NAV_SVINFO_ITOW(_ubx_payload) (*((uint32_t*)(_ubx_payload+0))) #define UBX_NAV_SVINFO_NCH(_ubx_payload) (*((uint8_t*)(_ubx_payload+4))) #define UBX_NAV_SVINFO_RES1(_ubx_payload) (*((uint8_t*)(_ubx_payload+5))) #define UBX_NAV_SVINFO_RES2(_ubx_payload) (*((uint8_t*)(_ubx_payload+6))) #define UBX_NAV_SVINFO_chn(_ubx_payload,_ubx_block) (*((uint8_t*)(_ubx_payload+7+12*_ubx_block))) #define UBX_NAV_SVINFO_SVID(_ubx_payload,_ubx_block) (*((uint8_t*)(_ubx_payload+8+12*_ubx_block))) #define UBX_NAV_SVINFO_Flags(_ubx_payload,_ubx_block) (*((uint8_t*)(_ubx_payload+9+12*_ubx_block))) #define UBX_NAV_SVINFO_QI(_ubx_payload,_ubx_block) (*((int8_t*)(_ubx_payload+10+12*_ubx_block))) #define UBX_NAV_SVINFO_CNO(_ubx_payload,_ubx_block) (*((uint8_t*)(_ubx_payload+11+12*_ubx_block))) #define UBX_NAV_SVINFO_Elev(_ubx_payload,_ubx_block) (*((int8_t*)(_ubx_payload+12+12*_ubx_block))) #define UBX_NAV_SVINFO_Azim(_ubx_payload,_ubx_block) (*((int16_t*)(_ubx_payload+13+12*_ubx_block))) #define UBX_NAV_SVINFO_PRRes(_ubx_payload,_ubx_block) (*((int32_t*)(_ubx_payload+15+12*_ubx_block)))

#define UBX_USR_ID 0x40

#define UBX_USR_IRSIM_ID 0x01
#define UBX_USR_IRSIM_ROLL(_ubx_payload) (*((int16_t*)(_ubx_payload+0))) #define UBX_USR_IRSIM_PITCH(_ubx_payload) (*((int16_t*)(_ubx_payload+2)))

#define UBX_USR_SERVOS_ID 0x02
#define UBX_USR_SERVOS_N(_ubx_payload) (*((int8_t*)(_ubx_payload+0)))
#define UBX_USR_SERVOS_WIDTH(_ubx_payload,_ubx_block) (*((uint16_t*)(_ubx_payload+1+2*_ubx_block)))

#define UBX_USR_PPM_ID 0x03
#define UBX_USR_PPM_N(_ubx_payload) (*((int8_t*)(_ubx_payload+0)))
#define UBX_USR_PPM_WIDTH(_ubx_payload,_ubx_block) (*((uint16_t*)(_ubx_payload+1+2*_ubx_block))) /* This file has been generated from conf/flight_plans/ricou_mic_madeleine.xml */
/* Please DO NOT EDIT */

#ifndef FLIGHT_PLAN_H
#define FLIGHT_PLAN_H

#define FLIGHT_PLAN_NAME "Ricou Mic"
#define NAV_UTM_EAST0 364222
#define NAV_UTM_NORTH0 4788551
#define QFU 85.0
#define WP_HOME 0
#define WAYPOINTS { \
 {238.6, -0.0, 390},\
 {128.2, 117.1, 390},\
 {387.4, 46.2, 390},\
 {369.7, -45.9, 390},\
 {71.8, 33.8, 390},\
 {117.0, -209.7, 390},\
 {246.4, 97.7, 390},\
};
#define NB_WAYPOINT 7
#define GROUND_ALT 340.
#define SECURITY_ALT 365.
#define MAX_DIST_FROM_HOME 500.
#ifdef NAV_C

static inline void auto_nav(void) {
  switch (nav_block) {
    Block(0) // takeoff
    if RcEvent1() { GotoBlock(1) }
    switch(nav_stage) {
      Label(while_1)
      Stage(0)
        if (! (!(launch))) Goto(endwhile_2) else NextStage();
        Stage(1)
          Goto(while_1)
        Label(endwhile_2)
      Stage(2)
        if ((estimator_flight_time>8)) NextStage() else {
          desired_course = RadOfDeg(QFU);
          nav_pitch = 0.0;
          vertical_mode = VERTICAL_MODE_AUTO_GAZ;
          nav_desired_gaz = TRIM_UPPRZ(0.800000*MAX_PPRZ);
        }
        return;
      Stage(3)
        if ((estimator_z>SECURITY_ALT)) NextStage() else {
          desired_course = RadOfDeg(QFU);
          nav_pitch = 0.100000;
          vertical_mode = VERTICAL_MODE_AUTO_CLIMB;
          desired_climb = 1.500000;
        }
        return;
      Stage(4)
        GotoBlock(2)
      Stage(5)
        NextBlock()
    }

    Block(1) // cata
    switch(nav_stage) {
      Label(while_3)
      Stage(0)
if (! (!((estimator_hspeed_mod>12)))) Goto(endwhile_4) else NextStage();
        Stage(1)
          Goto(while_3)
        Label(endwhile_4)
      Stage(2)
        if ((stage_time>2)) NextStage() else {
          desired_course = RadOfDeg(QFU);
          nav_pitch = 0.0;
          vertical_mode = VERTICAL_MODE_AUTO_GAZ;
          nav_desired_gaz = TRIM_UPPRZ(0.000000*MAX_PPRZ);
        }
        return;
      Stage(3)
        if ((estimator_z>SECURITY_ALT)) NextStage() else {
          desired_course = RadOfDeg(QFU);
          nav_pitch = 0.0;
          vertical_mode = VERTICAL_MODE_AUTO_CLIMB;
          desired_climb = 2.000000;
        }
        return;
      Stage(4)
        GotoBlock(2)
      Stage(5)
        NextBlock()
    }

    Block(2) // first_circle
    if RcEvent1() { GotoBlock(3) }
    if RcEvent2() { GotoBlock(4) }
    switch(nav_stage) {
      Stage(0)
        nav_pitch = 0.0;
        vertical_mode = VERTICAL_MODE_AUTO_ALT;
        desired_altitude = (GROUND_ALT+50);
        pre_climb = 0.;
        Circle(6, -(75));
        return;
      Stage(1)
        NextBlock()
    }

    Block(3) // home
    if RcEvent1() { GotoBlock(4) }
    if RcEvent2() { GotoBlock(6) }
    switch(nav_stage) {
      Stage(0)
        nav_pitch = 0.0;
        vertical_mode = VERTICAL_MODE_AUTO_ALT;
        desired_altitude = (GROUND_ALT+50);
        pre_climb = 0.;
        Circle(0, -(75));
        return;
      Stage(1)
        NextBlock()
    }

    Block(4) // huit
    if RcEvent1() { GotoBlock(5) }
    switch(nav_stage) {
      Stage(0)
        if (approaching(1)) NextStageFrom(1) else {
          fly_to(1);
          nav_pitch = 0.0;
          vertical_mode = VERTICAL_MODE_AUTO_ALT;
          desired_altitude = waypoints[1].a;
          pre_climb = 0.;
        }
        return;
      Label(while_5)
      Stage(1)
        if (! (TRUE)) Goto(endwhile_6) else NextStage();
        Stage(2)
          if (approaching(4)) NextStageFrom(4) else {
            fly_to(4);
            nav_pitch = 0.0;
            vertical_mode = VERTICAL_MODE_AUTO_ALT;
            desired_altitude = waypoints[4].a;
            pre_climb = 0.;
          }
          return;
        Stage(3)
          if (approaching(2)) NextStageFrom(2) else {
            route_to(4, 2);
            nav_pitch = 0.0;
            vertical_mode = VERTICAL_MODE_AUTO_ALT;
            desired_altitude = waypoints[2].a;
            pre_climb = 0.;
          }
          return;
        Stage(4)
          if (approaching(3)) NextStageFrom(3) else {
            fly_to(3);
            nav_pitch = 0.0;
            vertical_mode = VERTICAL_MODE_AUTO_ALT;
            desired_altitude = waypoints[3].a;
            pre_climb = 0.;
          }
          return;
        Stage(5)
          if (approaching(1)) NextStageFrom(1) else {
            route_to(3, 1);
            nav_pitch = 0.0;
            vertical_mode = VERTICAL_MODE_AUTO_ALT;
            desired_altitude = waypoints[1].a;
            pre_climb = 0.;
          }
          return;
        Stage(6)
          Goto(while_5)
        Label(endwhile_6)
      Stage(7)
        NextBlock()
    }

    Block(5) // 200
    if RcEvent1() { GotoBlock(3) }
    switch(nav_stage) {
      Stage(0)
        nav_pitch = 0.0;
        vertical_mode = VERTICAL_MODE_AUTO_ALT;
        desired_altitude = (GROUND_ALT+200);
        pre_climb = 0.;
        Circle(0, -(100));
        return;
      Stage(1)
        GotoBlock(3)
      Stage(2)
        NextBlock()
    }

    Block(6) // final
    if RcEvent1() { GotoBlock(4) }
    switch(nav_stage) {
      Stage(0)
        nav_pitch = 0.0;
        vertical_mode = VERTICAL_MODE_AUTO_ALT;
        desired_altitude = (GROUND_ALT+50);
        pre_climb = 0.;
        Circle(5, 75);
        return;
      Stage(1)
        NextBlock()
    }

  }
}
#endif // NAV_C

#endif // FLIGHT_PLAN_H





reply via email to

[Prev in Thread] Current Thread [Next in Thread]