paparazzi-devel
[Top][All Lists]
Advanced

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

[Paparazzi-devel] nav_catapult module problem


From: hendrixgr .
Subject: [Paparazzi-devel] nav_catapult module problem
Date: Thu, 24 Mar 2016 01:37:47 +0200

Hi.
I use a modified version of the nav_catapult module because if i use the one included in
V5.8 stable the throttle get stack at 100% no matter what block i select later on, not to mention that that it does not return FALSE like it should (i may be wrong about that)
which in turn requires an exception like this one:

    <block name="Holding point">
      <exception cond="GetPosAlt() > ground_alt+50" deroute="standby"/>
      <set value="0" var="kill_throttle"/>
      <call fun="nav_catapult_setup()"/>
      <call fun="nav_catapult_run(WP_HOME, WP_BASELEG)"/>
      <deroute block="standby"/>
    </block>

Here are the modifications i did in order to make it work (flight tested), i first commented out those 3 lines
    //NavVerticalAltitudeMode(alt, 0);  // vertical mode (follow glideslope)
    //NavVerticalAutoThrottleMode(0);   // throttle mode
    //NavGotoWaypoint(_climb);        // horizontal mode (stay on localiser)

and then added the below 2 lines:

    nav_catapult_armed = 0;
    return FALSE;

Here is the complete function code:

bool_t nav_catapult_run(uint8_t _to, uint8_t _climb)
{
  //float alt = WaypointAlt(_climb);

  nav_catapult_armed = 1;

  // No Roll, Climb Pitch, No motor Phase
  if (nav_catapult_launch <= nav_catapult_motor_delay * NAV_CATAPULT_HIGHRATE_MODULE_FREQ) {
    NavAttitude(RadOfDeg(0));
    NavVerticalAutoThrottleMode(nav_catapult_initial_pitch);
    NavVerticalThrottleMode(9600 * (0));


    nav_catapult_x = stateGetPositionEnu_f()->x;
    nav_catapult_y = stateGetPositionEnu_f()->y;

    // Store take-off waypoint
    WaypointX(_to) = nav_catapult_x;
    WaypointY(_to) = nav_catapult_y;
    WaypointAlt(_to) = stateGetPositionUtm_f()->alt;

  }
  // No Roll, Climb Pitch, Full Power
  else if (nav_catapult_launch < nav_catapult_heading_delay * NAV_CATAPULT_HIGHRATE_MODULE_FREQ) {
    NavAttitude(RadOfDeg(0));
    NavVerticalAutoThrottleMode(nav_catapult_initial_pitch);
    NavVerticalThrottleMode(9600 * (nav_catapult_initial_throttle));
  }
  // Normal Climb: Heading Locked by Waypoint Target
  else if (nav_catapult_launch == 0xffff) {
    //NavVerticalAltitudeMode(alt, 0);  // vertical mode (follow glideslope)
    //NavVerticalAutoThrottleMode(0);   // throttle mode
    //NavGotoWaypoint(_climb);        // horizontal mode (stay on localiser)
    nav_catapult_armed = 0;
    return FALSE;

  } else {
    // Store Heading, move Climb
    nav_catapult_launch = 0xffff;

    float dir_x = stateGetPositionEnu_f()->x - nav_catapult_x;
    float dir_y = stateGetPositionEnu_f()->y - nav_catapult_y;

    float dir_L = sqrt(dir_x * dir_x + dir_y * dir_y);

    WaypointX(_climb) = nav_catapult_x + (dir_x / dir_L) * 300;
    WaypointY(_climb) = nav_catapult_y + (dir_y / dir_L) * 300;

    DownlinkSendWp(&(DefaultChannel).trans_tx, &(DefaultDevice).device, _climb);
  }


  return TRUE;

}


reply via email to

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