nav_catapult module problem

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

nav_catapult module problem

Chris Efstathiou
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;

}


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel
Reply | Threaded
Open this post in threaded view
|

Re: nav_catapult module problem

Gautier Hattenberger-3
Hi,

Thanks for reporting this. I don't think this code is used a lot since not everybody have a catapult...
Could you make an issue or even a pull request for this on github ?

Thanks

Gautier

Le 24/03/2016 00:37, hendrixgr . a écrit :
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;

}



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel
Reply | Threaded
Open this post in threaded view
|

Re: nav_catapult module problem

flixr
Administrator
Hi,

it looks to me like the catapult was always meant to be used with an exception...
@dewagter who wrote the catapult module can probably comment on this.

Cheers, Felix

On Fri, Mar 25, 2016 at 3:37 PM, Gautier Hattenberger <[hidden email]> wrote:
Hi,

Thanks for reporting this. I don't think this code is used a lot since not everybody have a catapult...
Could you make an issue or even a pull request for this on github ?

Thanks

Gautier


Le 24/03/2016 00:37, hendrixgr . a écrit :
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;

}



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel
Reply | Threaded
Open this post in threaded view
|

Re: nav_catapult module problem

Chris Efstathiou
Hi.
I will look in to that more deeply and make a pull request.
I will make some more tests this week just to be sure that the code works fine and improve it a bit.
I first noticed the problem in simulation because the throttle would stay constant at 100% no matter what block
the flight plan was in after the launch so i tried my older catapult launch code that is flight proven and then i converted the newer
version.
The problem with catapult launch is that there is not much time to react if something goes wrong so it is
of paramount importance that everything goes fine every time.
Btw the airplane i use is the X8 wing with 20AH battery pack, AUW is 4,5 Kg and a real strong catapult with 20kg of min pull is needed.
Chris


On Fri, Mar 25, 2016 at 5:05 PM, Felix Ruess <[hidden email]> wrote:
Hi,

it looks to me like the catapult was always meant to be used with an exception...
@dewagter who wrote the catapult module can probably comment on this.

Cheers, Felix

On Fri, Mar 25, 2016 at 3:37 PM, Gautier Hattenberger <[hidden email]> wrote:
Hi,

Thanks for reporting this. I don't think this code is used a lot since not everybody have a catapult...
Could you make an issue or even a pull request for this on github ?

Thanks

Gautier


Le 24/03/2016 00:37, hendrixgr . a écrit :
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;

}



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel
Reply | Threaded
Open this post in threaded view
|

Re: nav_catapult module problem

Gautier Hattenberger-3
I think it should not be difficult to make it work without exception in the flight plan. You should have a look to the nav_bungee as well.
The changes you have made so far are skipping the last part of the procedure: climbing full throttle until reaching the climb point which is placed in from of the plane when the launch is detected. You could use the nav_approaching function to detect the end of this phase and end the procedure.

Gautier

Le 25/03/2016 21:39, hendrixgr . a écrit :
Hi.
I will look in to that more deeply and make a pull request.
I will make some more tests this week just to be sure that the code works fine and improve it a bit.
I first noticed the problem in simulation because the throttle would stay constant at 100% no matter what block
the flight plan was in after the launch so i tried my older catapult launch code that is flight proven and then i converted the newer
version.
The problem with catapult launch is that there is not much time to react if something goes wrong so it is
of paramount importance that everything goes fine every time.
Btw the airplane i use is the X8 wing with 20AH battery pack, AUW is 4,5 Kg and a real strong catapult with 20kg of min pull is needed.
Chris


On Fri, Mar 25, 2016 at 5:05 PM, Felix Ruess <[hidden email]> wrote:
Hi,

it looks to me like the catapult was always meant to be used with an exception...
@dewagter who wrote the catapult module can probably comment on this.

Cheers, Felix

On Fri, Mar 25, 2016 at 3:37 PM, Gautier Hattenberger <[hidden email]> wrote:
Hi,

Thanks for reporting this. I don't think this code is used a lot since not everybody have a catapult...
Could you make an issue or even a pull request for this on github ?

Thanks

Gautier


Le 24/03/2016 00:37, hendrixgr . a écrit :
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;

}



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel




_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel
Reply | Threaded
Open this post in threaded view
|

Re: nav_catapult module problem

Chris Efstathiou
Hi Gautier i just did this and it works fine in the simulator.
The way the function works now allows two modes.
If you give the 2 waypoints needed for the function it works like the original intended and exits.
If you specify any waypoint as 0 then the airplane goes up for the time specified (usually 3,5 seconds) and then
the function exits.
I also added a waypoin altitude safety check near the end of the function.
Here is the new function:

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));

    if (_to != 0 && _climb != 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) {
          if (_to != 0 && _climb != 0){
             if (NavApproachingFrom(_climb,_to,CARROT)){
                nav_catapult_armed = 0;
                return FALSE;

             }else{
                       NavSegment(_to, _climb);
                       NavVerticalAutoThrottleMode(RadOfDeg(0.000000));
                       NavVerticalAltitudeMode(alt, 0.);
                   }

          }else{ nav_catapult_armed = 0;  return FALSE; }

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

    if (_to != 0 && _climb != 0){
       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) * 200; // was 300
       WaypointY(_climb) = nav_catapult_y + (dir_y / dir_L) * 200; // was 300
       if (alt < (ground_alt+30)){  alt = (ground_alt+30); } // for added safety

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


  return TRUE;

}
 

On Sat, Mar 26, 2016 at 12:07 AM, Gautier Hattenberger <[hidden email]> wrote:
I think it should not be difficult to make it work without exception in the flight plan. You should have a look to the nav_bungee as well.
The changes you have made so far are skipping the last part of the procedure: climbing full throttle until reaching the climb point which is placed in from of the plane when the launch is detected. You could use the nav_approaching function to detect the end of this phase and end the procedure.

Gautier


Le 25/03/2016 21:39, hendrixgr . a écrit :
Hi.
I will look in to that more deeply and make a pull request.
I will make some more tests this week just to be sure that the code works fine and improve it a bit.
I first noticed the problem in simulation because the throttle would stay constant at 100% no matter what block
the flight plan was in after the launch so i tried my older catapult launch code that is flight proven and then i converted the newer
version.
The problem with catapult launch is that there is not much time to react if something goes wrong so it is
of paramount importance that everything goes fine every time.
Btw the airplane i use is the X8 wing with 20AH battery pack, AUW is 4,5 Kg and a real strong catapult with 20kg of min pull is needed.
Chris


On Fri, Mar 25, 2016 at 5:05 PM, Felix Ruess <[hidden email]> wrote:
Hi,

it looks to me like the catapult was always meant to be used with an exception...
@dewagter who wrote the catapult module can probably comment on this.

Cheers, Felix

On Fri, Mar 25, 2016 at 3:37 PM, Gautier Hattenberger <[hidden email][hidden email]> wrote:
Hi,

Thanks for reporting this. I don't think this code is used a lot since not everybody have a catapult...
Could you make an issue or even a pull request for this on github ?

Thanks

Gautier


Le 24/03/2016 00:37, hendrixgr . a écrit :
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;

}



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel




_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel
Reply | Threaded
Open this post in threaded view
|

Re: nav_catapult module problem

Gautier Hattenberger-3
Nice!

Le 25/03/2016 23:17, hendrixgr . a écrit :
Hi Gautier i just did this and it works fine in the simulator.
The way the function works now allows two modes.
If you give the 2 waypoints needed for the function it works like the original intended and exits.
If you specify any waypoint as 0 then the airplane goes up for the time specified (usually 3,5 seconds) and then
the function exits.
I also added a waypoin altitude safety check near the end of the function.
Here is the new function:

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));

    if (_to != 0 && _climb != 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) {
          if (_to != 0 && _climb != 0){
             if (NavApproachingFrom(_climb,_to,CARROT)){
                nav_catapult_armed = 0;
                return FALSE;

             }else{
                       NavSegment(_to, _climb);
                       NavVerticalAutoThrottleMode(RadOfDeg(0.000000));
                       NavVerticalAltitudeMode(alt, 0.);
                   }

          }else{ nav_catapult_armed = 0;  return FALSE; }

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

    if (_to != 0 && _climb != 0){
       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) * 200; // was 300
       WaypointY(_climb) = nav_catapult_y + (dir_y / dir_L) * 200; // was 300
       if (alt < (ground_alt+30)){  alt = (ground_alt+30); } // for added safety

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


  return TRUE;

}
 

On Sat, Mar 26, 2016 at 12:07 AM, Gautier Hattenberger <[hidden email]> wrote:
I think it should not be difficult to make it work without exception in the flight plan. You should have a look to the nav_bungee as well.
The changes you have made so far are skipping the last part of the procedure: climbing full throttle until reaching the climb point which is placed in from of the plane when the launch is detected. You could use the nav_approaching function to detect the end of this phase and end the procedure.

Gautier


Le 25/03/2016 21:39, hendrixgr . a écrit :
Hi.
I will look in to that more deeply and make a pull request.
I will make some more tests this week just to be sure that the code works fine and improve it a bit.
I first noticed the problem in simulation because the throttle would stay constant at 100% no matter what block
the flight plan was in after the launch so i tried my older catapult launch code that is flight proven and then i converted the newer
version.
The problem with catapult launch is that there is not much time to react if something goes wrong so it is
of paramount importance that everything goes fine every time.
Btw the airplane i use is the X8 wing with 20AH battery pack, AUW is 4,5 Kg and a real strong catapult with 20kg of min pull is needed.
Chris


On Fri, Mar 25, 2016 at 5:05 PM, Felix Ruess <[hidden email]> wrote:
Hi,

it looks to me like the catapult was always meant to be used with an exception...
@dewagter who wrote the catapult module can probably comment on this.

Cheers, Felix

On Fri, Mar 25, 2016 at 3:37 PM, Gautier Hattenberger <[hidden email]> wrote:
Hi,

Thanks for reporting this. I don't think this code is used a lot since not everybody have a catapult...
Could you make an issue or even a pull request for this on github ?

Thanks

Gautier


Le 24/03/2016 00:37, hendrixgr . a écrit :
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;

}



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel




_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel




_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel


_______________________________________________
Paparazzi-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel