You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
879 B
38 lines
879 B
13 years ago
|
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
||
|
|
||
|
//****************************************************************
|
||
|
// Function that will calculate the desired direction to fly and distance
|
||
|
//****************************************************************
|
||
10 years ago
|
void Rover::navigate()
|
||
13 years ago
|
{
|
||
|
// do not navigate with corrupt data
|
||
|
// ---------------------------------
|
||
12 years ago
|
if (!have_position) {
|
||
13 years ago
|
return;
|
||
|
}
|
||
|
|
||
11 years ago
|
if ((next_WP.lat == 0)||(home_is_set==false)){
|
||
13 years ago
|
return;
|
||
|
}
|
||
|
|
||
12 years ago
|
// waypoint distance from rover
|
||
13 years ago
|
// ----------------------------
|
||
11 years ago
|
wp_distance = get_distance(current_loc, next_WP);
|
||
13 years ago
|
|
||
|
if (wp_distance < 0){
|
||
|
gcs_send_text_P(SEVERITY_HIGH,PSTR("<navigate> WP error - distance < 0"));
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
// control mode specific updates to nav_bearing
|
||
|
// --------------------------------------------
|
||
|
update_navigation();
|
||
|
}
|
||
|
|
||
|
|
||
|
void reached_waypoint()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|