How to see if the UAV has reached a waypoint

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

How to see if the UAV has reached a waypoint

daniel@asctec
Question:

The Waypoint struct has this field: time, which is described as "time to stay at a waypoint".
Could you please describe the behavior of the autopilot once this time is over?
Also, how do I know that the autopilot has reached the waypoint. do i do this by checking the gps
data myself, or does the autopilot send any packet?

Answer:

Once the vehicle is within a radius defined by the field pos_acc (desired position accuracy) a timer is started and counting, until the desired time to stay at the waypoint (field "time" in the waypoint struct) is over. A packet "current_way" can be polled to get feedback on

- if the waypoint has been reached within the desired position accuracy
- if the time to stay is over or not

Your software can use this feedback to know when it is time to send the next waypoint.

Here is the definition of the structure:

#define PD_CURRENTWAY   0x21
For polling the structure you need the flag 0x100.

struct CURRENT_WAY {
            unsigned char dummy1;
            unsigned char properties;
            unsigned short nr_of_wp; //don't care

            unsigned char current_wp; //don't care
            unsigned char current_wp_memlocation; //don't care

            unsigned char status;  //don't care
            unsigned char dummy2;

            unsigned short navigation_status;          //see WP_NAVSTAT_... defines
            unsigned short distance_to_wp;             //distance to WP in dm
};

struct CURRENT_WAY current_way;

 //Waypoint navigation status (unsigned short navigation_status in CURRENT_WAY struct)
#define WP_NAVSTAT_REACHED_POS   0x01      //vehicle has entered a radius of WAYPOINT.pos_acc
#define WP_NAVSTAT_REACHED_POS_TIME   0x02      //vehicle is within a radius of WAYPOINT.pos_acc and time to stay is over
#define WP_NAVSTAT_20M  0x04      //vehicle within a 20m radius of the waypoint

All you need is "navigation status" and "distance_to_wp". If navigation_status is 0x07 it is time for your software to send the next waypoint.



 
Reply | Threaded
Open this post in threaded view
|

Re: How to see if the UAV has reached a waypoint

Carter Schultz
There is one additional bit that may be of interest

#define WP_NAVSTAT_PILOT_ABORT                 0x08  //waypoint navigation aborted by safety pilot

This is inside the navigation_status short. This allows you to tell specifically if you waypoint has been interrupted by stick movement.