GPS position updates in Loiter mode

Hi, 

I've been following this forum for a while and it has been helping me out a lot ! 

I am trying to get a better understanding of the pixhawk algorithms and was wondering if one of you could tell me "when" the pixhawk updates its GPS position lock in loiter mode. 

For example, if i'm switching from stabilize to loiter, will it try to maintain its position on the GPS coordinates it received at the very moment i switched the flight mode ? Or has it already an estimated position in memory ?

Also, when i use the roll and the pitch commands while being in Loiter, I know it changes the target point. What point will the drone try to maintain ? Is is the last received GPS coordinates after I release the roll/pitch command, or will it first stop and then cumpute a new GPS position ? 

I hope my question is clear enough.

Anyway, a great thanks to all of you. 

Have a nice day.

Thomas

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Thanks again ! 

    I'm going to see if it's somewhere in the telemetry message or if there is a way to put it there. 

    I really appreciated your help.

    Have a nice day.


    Stephen Dade said:

    Switching from stabilize to loiter the APM will query the GPS library for it's current position. The GPS library will return the position stored in it's memory. That current position will be between 0 to 20ms old. The APM won't "wait" at any point for a new GPS position.

    Changing the target point with the roll/pitch controls will tell stabilize mode to add/subtract a small value from the target point. The GPS library isn't involved in this part.

    There might be a telemetry message that sends the current target point to the ground station, but you'd have to look it up in the source code. It's not something I know offhand.

  • Switching from stabilize to loiter the APM will query the GPS library for it's current position. The GPS library will return the position stored in it's memory. That current position will be between 0 to 20ms old. The APM won't "wait" at any point for a new GPS position.

    Changing the target point with the roll/pitch controls will tell stabilize mode to add/subtract a small value from the target point. The GPS library isn't involved in this part.

    There might be a telemetry message that sends the current target point to the ground station, but you'd have to look it up in the source code. It's not something I know offhand.

  • Hi Stephen, 

    Thanks for your quick reply and for the link.

    From what I understand, if I switch from stabilize to loiter, the APM will wait between 0 and 20 ms for new GPS coordinates and then it will try to maintain its position around those coordinates... am I right ? 

    In the case I change the target point with roll and pitch, when you say that "it will compute the new GPS position" I understand that the new GPS coordinates the drone will try to maintain in loiter mode aren't the one received after I released the joysticks but rather an estimated GPS position based on current GPS coordinates and speed right ?

    Do you know if there is a way to know which coordinates the drone is targeting ? 

    Thanks again for your help.


    Stephen Dade said:

    For the APM software, the general architecture is that the different sensor collection and position/orientation functions are in separate libraries (Object Orientated and all that...) and their state is read by the high level navigation functions.

    Take a look at this - https://github.com/ArduPilot/ardupilot/blob/master/ArduCopter/ArduC.... It shows how often each of the APM functions is called.

    So, in answer to your question, the APM will query the GPS library for the latest read position (ie. the position in memory). Note that the GPS position is read/calculated at 50Hz (20ms), so it's a very fast update rate.

    For changing the target point in loiter mode, it will compute the new GPS position and then move to it. The calculation would take a tiny amount of time (less than 50ms) so it's not something a human will be able to notice.

  • For the APM software, the general architecture is that the different sensor collection and position/orientation functions are in separate libraries (Object Orientated and all that...) and their state is read by the high level navigation functions.

    Take a look at this - https://github.com/ArduPilot/ardupilot/blob/master/ArduCopter/ArduC.... It shows how often each of the APM functions is called.

    So, in answer to your question, the APM will query the GPS library for the latest read position (ie. the position in memory). Note that the GPS position is read/calculated at 50Hz (20ms), so it's a very fast update rate.

    For changing the target point in loiter mode, it will compute the new GPS position and then move to it. The calculation would take a tiny amount of time (less than 50ms) so it's not something a human will be able to notice.

    Edit:

    I should add that it's best to think of the APM as running all it's algorithms in parallel. Like a single-CPU computer, it will rapidly switch between tasks/functions to give the appearance of multi-tasking.

This reply was deleted.

Activity