possible error in nav_catapult code

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

possible error in nav_catapult code

Chris
I think there is a mistake inside the nav_catapult.c and .h files because i get an error about not proper use of a void function.
Since all functions in the flight plan should return something i think that the below function:
void nav_catapult_init(void)
{

  nav_catapult.status           = NAV_CATAPULT_UNINIT;
  nav_catapult.timer            = 0;
  nav_catapult.accel_threshold  = NAV_CATAPULT_ACCELERATION_THRESHOLD;
  nav_catapult.motor_delay      = NAV_CATAPULT_MOTOR_DELAY;
  nav_catapult.heading_delay    = NAV_CATAPULT_HEADING_DELAY;
  nav_catapult.initial_pitch    = NAV_CATAPULT_INITIAL_PITCH;
  nav_catapult.initial_throttle = NAV_CATAPULT_INITIAL_THROTTLE;

}

should be:

bool nav_catapult_init(void)
{

  nav_catapult.status           = NAV_CATAPULT_UNINIT;
  nav_catapult.timer            = 0;
  nav_catapult.accel_threshold  = NAV_CATAPULT_ACCELERATION_THRESHOLD;
  nav_catapult.motor_delay      = NAV_CATAPULT_MOTOR_DELAY;
  nav_catapult.heading_delay    = NAV_CATAPULT_HEADING_DELAY;
  nav_catapult.initial_pitch    = NAV_CATAPULT_INITIAL_PITCH;
  nav_catapult.initial_throttle = NAV_CATAPULT_INITIAL_THROTTLE;

return(FALSE);
}

Of course the function declaration in the header file should be corrected also.
BTW it works very well in simulation but i am about to find out if it works in real life also
this week.
Chris


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

Re: possible error in nav_catapult code

Gautier Hattenberger-3
Hi,

The init function is called at startup (see module xml file) so you don't have to call it from the flight plan (the 'call' instruction requires to return a boolean, that's why you have the error). If you still want to re-init the module from the flight plan, use the 'call_once' instruction instead.

Gautier


Le 12/06/2016 18:49, hendrixgr . a écrit :
I think there is a mistake inside the nav_catapult.c and .h files because i get an error about not proper use of a void function.
Since all functions in the flight plan should return something i think that the below function:
void nav_catapult_init(void)
{

  nav_catapult.status           = NAV_CATAPULT_UNINIT;
  nav_catapult.timer            = 0;
  nav_catapult.accel_threshold  = NAV_CATAPULT_ACCELERATION_THRESHOLD;
  nav_catapult.motor_delay      = NAV_CATAPULT_MOTOR_DELAY;
  nav_catapult.heading_delay    = NAV_CATAPULT_HEADING_DELAY;
  nav_catapult.initial_pitch    = NAV_CATAPULT_INITIAL_PITCH;
  nav_catapult.initial_throttle = NAV_CATAPULT_INITIAL_THROTTLE;

}

should be:

bool nav_catapult_init(void)
{

  nav_catapult.status           = NAV_CATAPULT_UNINIT;
  nav_catapult.timer            = 0;
  nav_catapult.accel_threshold  = NAV_CATAPULT_ACCELERATION_THRESHOLD;
  nav_catapult.motor_delay      = NAV_CATAPULT_MOTOR_DELAY;
  nav_catapult.heading_delay    = NAV_CATAPULT_HEADING_DELAY;
  nav_catapult.initial_pitch    = NAV_CATAPULT_INITIAL_PITCH;
  nav_catapult.initial_throttle = NAV_CATAPULT_INITIAL_THROTTLE;

return(FALSE);
}

Of course the function declaration in the header file should be corrected also.
BTW it works very well in simulation but i am about to find out if it works in real life also
this week.
Chris



_______________________________________________
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: possible error in nav_catapult code

Chris
Excellent answer, thank you Gautier.
That's what i thought also although i didn't knew about the "call_once"  and if the "init" function must be called from the flight plan.
Chris

On 06/12/2016 11:24 PM, Gautier Hattenberger wrote:
Hi,

The init function is called at startup (see module xml file) so you don't have to call it from the flight plan (the 'call' instruction requires to return a boolean, that's why you have the error). If you still want to re-init the module from the flight plan, use the 'call_once' instruction instead.

Gautier


Le 12/06/2016 18:49, hendrixgr . a écrit :
I think there is a mistake inside the nav_catapult.c and .h files because i get an error about not proper use of a void function.
Since all functions in the flight plan should return something i think that the below function:
void nav_catapult_init(void)
{

  nav_catapult.status           = NAV_CATAPULT_UNINIT;
  nav_catapult.timer            = 0;
  nav_catapult.accel_threshold  = NAV_CATAPULT_ACCELERATION_THRESHOLD;
  nav_catapult.motor_delay      = NAV_CATAPULT_MOTOR_DELAY;
  nav_catapult.heading_delay    = NAV_CATAPULT_HEADING_DELAY;
  nav_catapult.initial_pitch    = NAV_CATAPULT_INITIAL_PITCH;
  nav_catapult.initial_throttle = NAV_CATAPULT_INITIAL_THROTTLE;

}

should be:

bool nav_catapult_init(void)
{

  nav_catapult.status           = NAV_CATAPULT_UNINIT;
  nav_catapult.timer            = 0;
  nav_catapult.accel_threshold  = NAV_CATAPULT_ACCELERATION_THRESHOLD;
  nav_catapult.motor_delay      = NAV_CATAPULT_MOTOR_DELAY;
  nav_catapult.heading_delay    = NAV_CATAPULT_HEADING_DELAY;
  nav_catapult.initial_pitch    = NAV_CATAPULT_INITIAL_PITCH;
  nav_catapult.initial_throttle = NAV_CATAPULT_INITIAL_THROTTLE;

return(FALSE);
}

Of course the function declaration in the header file should be corrected also.
BTW it works very well in simulation but i am about to find out if it works in real life also
this week.
Chris



_______________________________________________
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