Purpose of MutliWiiConf settings PosR NavR and Pos ?

Post Reply
psuedoman
Posts: 17
Joined: Sun Jan 27, 2013 3:40 pm

Purpose of MutliWiiConf settings PosR NavR and Pos ?

Post by psuedoman »

Can someone explain the difference between the Pos, PosR, and NavR settings in MultiWiiConf. I have read this: http://i2c-gps-nav.googlecode.com/files ... tation.pdf but NavR isn't covered and the difference between Pos and PosR is a little blurry to me.

I am guessing the Pos control loop has GPS position as the process variable, and desired position as the setpoint, the output of this loop controls pitch and roll ? and secondarily controls yaw as per the defines NAV_CONTROLS_HEADING, NAV_TAIL_FIRST and NAV_SET_TAKEOFF_HEADING

And I guess PosR (Position Hold Rate ?) attenuates the roll and pitch PID loops when the copter is at it's required destination ?? But which PID values are under the effect of the rate ACRO, HORIZON, ANGLE ? I presume it's the mode in effect at the time ? And given this rate has a PID loop of it's own what the the inputs and output of this PID loop ? Or do these PID values replace the ACRO, HORIZON, or ANGLE values, if so why call it a rate ?

NavR (Navigation Rate ?) attenuates roll and pitch PID loops when the copter is navigating ?

I dunno it's very confusing !

Also does the MAG setting in MultiWiiConf control the effect the compass sensor has in MAG mode ?

I'm using r1311.

Thanks.

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Purpose of MutliWiiConf settings PosR NavR and Pos ?

Post by Alexinparis »

psuedoman wrote:Can someone explain the difference between the Pos, PosR, and NavR settings in MultiWiiConf. I have read this: http://i2c-gps-nav.googlecode.com/files ... tation.pdf but NavR isn't covered and the difference between Pos and PosR is a little blurry to me.

I am guessing the Pos control loop has GPS position as the process variable, and desired position as the setpoint, the output of this loop controls pitch and roll ? and secondarily controls yaw as per the defines NAV_CONTROLS_HEADING, NAV_TAIL_FIRST and NAV_SET_TAKEOFF_HEADING

And I guess PosR (Position Hold Rate ?) attenuates the roll and pitch PID loops when the copter is at it's required destination ?? But which PID values are under the effect of the rate ACRO, HORIZON, ANGLE ? I presume it's the mode in effect at the time ? And given this rate has a PID loop of it's own what the the inputs and output of this PID loop ? Or do these PID values replace the ACRO, HORIZON, or ANGLE values, if so why call it a rate ?

NavR (Navigation Rate ?) attenuates roll and pitch PID loops when the copter is navigating ?

I dunno it's very confusing !

Also does the MAG setting in MultiWiiConf control the effect the compass sensor has in MAG mode ?

I'm using r1311.

Thanks.


ok, some more replies ;)
Pos, PosR, and NavR are used only in GPS control loop.
to summarize, there are 2 kinds of situation in the GPS control loop:
- the navigation mode:
in this mode, you are outside the targe radius defined via #define GPS_WP_RADIUS
the purpose is to control the translation speed. NavR PID are used.
the speed decreases proportionality to the target distance.
- the pos hold mode:
once the target is near enough (inside GPS_WP_RADIUS), another control loop is used to constrain the position.
it is based on position Pos PID (typically P is used to calculate a distance error) and speed movement PosR PID a little bit different from NarR PID

Imagine you are playing golf: you need first to cover a wide distance for the first shoot (nav), and then refine your movement in the last shoot (pos). Different strategies.

All the GPS control loops, coupling with heading indication output 2 inclination angles.
The 2 angles are used as virtual angle inputs in the main control loop (used for ANGLE/HORIZON)

NAV_CONTROLS_HEADING, NAV_TAIL_FIRST and NAV_SET_TAKEOFF_HEADING is something fun EOSBandi implemented some time ago:
viewtopic.php?f=8&t=649&p=14217&hilit=NAV_SET_TAKEOFF_HEADING#p14217
It's not mandatory, but it's interesting to see the copter pointing its front automatically towards the destination. And once inside the GPS_WP_RADIUS, rotating again like it was before the navigation process.

MAG PID setting (just P) is a different thing: It's a PID to constrain the heading input from the MAG. It acts on the yaw control. It is used indirectly by NAV_CONTROLS_HEADING, NAV_TAIL_FIRST and NAV_SET_TAKEOFF_HEADING to control the heading target.

psuedoman
Posts: 17
Joined: Sun Jan 27, 2013 3:40 pm

Re: Purpose of MutliWiiConf settings PosR NavR and Pos ?

Post by psuedoman »

ok, some more replies

I do so look forward to them :) You are the eliminator of grey areas in my knowledge ! I can't thank you enough for the thorough and exhaustive replies.

Navigation mode understood and #define GPS_WP_RADIUS also understood.

once the target is near enough (inside GPS_WP_RADIUS), another control loop is used to constrain the position.
it is based on position Pos PID (typically P is used to calculate a distance error) and speed movement PosR PID a little bit different from NarR PID


This may be beyond me, but why two loops ? Doesn't the Pos loop output a speed and direction essentially ? (which is translated to roll and pitch). Why the need to further refine the speed with the PosR loop ? That is what is happening yes ?

All the GPS control loops, coupling with heading indication output 2 inclination angles.
The 2 angles are used as virtual angle inputs in the main control loop (used for ANGLE/HORIZON)

As covered previously only ANGLE and HORIZON modes can be used with GPS modes ? This means that primary flight mode does effect GPS flight characteristics ?

Also are the virtual inputs treated exactly like stick inputs or are there some differences ?

Also if #define NAV_CONTROLS_HEADING disabled, then who is controlling the yaw ? Or does it just stay fixed at the position it was when you engaged the GPS mode ? and the yaw stick does nothing ?

MAG PID setting (just P) is a different thing: It's a PID to constrain the heading input from the MAG. It acts on the yaw control. It is used indirectly by NAV_CONTROLS_HEADING, NAV_TAIL_FIRST and NAV_SET_TAKEOFF_HEADING to control the heading target.


OK, so it's used to fine balance the sensor fusion between mag sensor and accel sensor ? And every other bit of code that uses the MAG sensor uses it via the MAG P setting ?

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Purpose of MutliWiiConf settings PosR NavR and Pos ?

Post by Alexinparis »

psuedoman wrote:
once the target is near enough (inside GPS_WP_RADIUS), another control loop is used to constrain the position.
it is based on position Pos PID (typically P is used to calculate a distance error) and speed movement PosR PID a little bit different from NarR PID


This may be beyond me, but why two loops ? Doesn't the Pos loop output a speed and direction essentially ? (which is translated to roll and pitch). Why the need to further refine the speed with the PosR loop ? That is what is happening yes ?

Code: Select all

    target_speed = get_P(error[axis], &posholdPID_PARAM); // calculate desired speed from lat/lon error
=> one PID to estimate the target speed. one other to adapt the speed.

All the GPS control loops, coupling with heading indication output 2 inclination angles.
The 2 angles are used as virtual angle inputs in the main control loop (used for ANGLE/HORIZON)

As covered previously only ANGLE and HORIZON modes can be used with GPS modes ? This means that primary flight mode does effect GPS flight characteristics ?

Also are the virtual inputs treated exactly like stick inputs or are there some differences ?

GPS MODE just acts as a superposition of HORIZON or ANGLE mode. angles are just added

Code: Select all

      errorAngle = constrain(2*rcCommand[axis] + GPS_angle[axis],-500,+500) - angle[axis] + conf.angleTrim[axis]; //16 bits is ok here

without GPS: GPS_angle[axis] is just 0, that's all

Also if #define NAV_CONTROLS_HEADING disabled, then who is controlling the yaw ? Or does it just stay fixed at the position it was when you engaged the GPS mode ? and the yaw stick does nothing ?

yaw is not a mandatory axis for GPS control. The inclination toward the right target in GPS mode is independent of the YAW direction.
YAW control is more "for fun" is this mode. It's visually nice to see the multi pointing automatically toward the dest.

MAG PID setting (just P) is a different thing: It's a PID to constrain the heading input from the MAG. It acts on the yaw control. It is used indirectly by NAV_CONTROLS_HEADING, NAV_TAIL_FIRST and NAV_SET_TAKEOFF_HEADING to control the heading target.


OK, so it's used to fine balance the sensor fusion between mag sensor and accel sensor ? And every other bit of code that uses the MAG sensor uses it via the MAG P setting ?

No, it has no dependencies with sensor fusion.
MAG PID computation is based on a reference heading and the real heading. And the result is just a superposition on yaw stick control.

Code: Select all

      int16_t dif = heading - magHold;
      if (dif <= - 180) dif += 360;
      if (dif >= + 180) dif -= 360;
      if ( f.SMALL_ANGLES_25 ) rcCommand[YAW] -= dif*conf.P8[PIDMAG]/30;

psuedoman
Posts: 17
Joined: Sun Jan 27, 2013 3:40 pm

Re: Purpose of MutliWiiConf settings PosR NavR and Pos ?

Post by psuedoman »

Alexinparis wrote:

Code: Select all

    target_speed = get_P(error[axis], &posholdPID_PARAM); // calculate desired speed from lat/lon error
=> one PID to estimate the target speed. one other to adapt the speed.


Ah so the Pos loop sets the return to home speed and regulates it against distance from home, and the PosR loop regulates this speed against head/tail winds, roll/pitch angle etc. ?

Alexinparis wrote:GPS MODE just acts as a superposition of HORIZON or ANGLE mode. angles are just added

Code: Select all

      errorAngle = constrain(2*rcCommand[axis] + GPS_angle[axis],-500,+500) - angle[axis] + conf.angleTrim[axis]; //16 bits is ok here

without GPS: GPS_angle[axis] is just 0, that's all


If they are summed with the stick inputs then they are treated as indistinguishable from them ?

Alexinparis wrote:No, it has no dependencies with sensor fusion.
MAG PID computation is based on a reference heading and the real heading. And the result is just a superposition on yaw stick control.

Code: Select all

      int16_t dif = heading - magHold;
      if (dif <= - 180) dif += 360;
      if (dif >= + 180) dif -= 360;
      if ( f.SMALL_ANGLES_25 ) rcCommand[YAW] -= dif*conf.P8[PIDMAG]/30;


OK, it's simpler than I thought, it's very similar to the way the GPS roll/pitch commands are treat, they are just mixed back in with the stick commands ?

Marcelo Tito
Posts: 2
Joined: Tue May 05, 2015 8:59 pm

Re: Purpose of MutliWiiConf settings PosR NavR and Pos ?

Post by Marcelo Tito »

Hi... I have a problem with these setting. It goes back in circles or It´s not keeping the position, and every time it tries to return to Hold position it oscilates more and more, in circles.
Can I know how to setup and some tips, like what happens if P I D´s are too high or too low...
Thanks a lot.

edsimmons3
Posts: 100
Joined: Thu Sep 10, 2015 11:29 am

Re: Purpose of MutliWiiConf settings PosR NavR and Pos ?

Post by edsimmons3 »

I know this thread is old but there's some good info here... Does anyone mind me adding the info from Alex to the wiki? Judging from the forum questions it would help to lay this info out clearly for all to find.

Thanks,
Ed

Post Reply