/** main antenna tracking code, called at 50Hz */ void Tracker::update_tracking(void) { // update vehicle position estimate update_vehicle_pos_estimate(); // update antenna tracker position from GPS update_tracker_position(); // update bearing and distance to vehicle update_bearing_and_distance(); // do not perform any servo updates until startup delay has passed if (g.startup_delay > 0 && AP_HAL::millis() - start_time_ms < g.startup_delay*1000) { return; } // do not perform updates if safety switch is disarmed (i.e. servos can't be moved) if (hal.util->safety_switch_state() == AP_HAL::Util::SAFETY_DISARMED) { return; } switch (control_mode) { case AUTO: update_auto(); break; case MANUAL: update_manual(); break; case SCAN: update_scan(); break; case SERVO_TEST: case STOP: case INITIALISING: break; } }
void Sprite2DView::update(float delta, const Controller& controller) { if (ignore_delta) { ignore_delta = false; delta = 0.0f; } display_time += delta * 0.5f; switch(mode) { case SLIDESHOW: update_slideshow(delta, controller); break; case MANUAL: update_manual(delta, controller); break; } if (controller.button_was_pressed(PDA_BUTTON)) { if (shuffle) { std::vector<Pathname>::iterator i = std::find(directory.begin(), directory.end(), shuffle_directory[index]); if (i != directory.end()) { index = i - directory.begin() ; } } else { std::vector<Pathname>::iterator i = std::find(shuffle_directory.begin(), shuffle_directory.end(), directory[index]); if (i != shuffle_directory.end()) { index = i - shuffle_directory.begin(); } } shuffle = !shuffle; std::cout << shuffle << " " << index << std::endl; } // if (controller.button_was_pressed(INVENTORY_BUTTON)) //std::random_shuffle(shuffle_directory.begin(), shuffle_directory.end()); if (controller.button_was_pressed(TERTIARY_BUTTON)) show_thumbnail = !show_thumbnail; if (controller.button_was_pressed(AIM_BUTTON)) { if (mode == SLIDESHOW) mode = MANUAL; else if (mode == MANUAL) mode = SLIDESHOW; } if (new_sprite) { fadein += delta; if (fadein > 1.0f) { sprite = new_sprite; sprite.set_alpha(1.0f); new_sprite = Sprite(); offset = 0; display_time = 0; } else { new_sprite.set_alpha(fadein); } } }