ardupilot/ArduPlane/WP_activity.pde

57 lines
1.5 KiB
Plaintext
Raw Normal View History

2011-09-08 22:45:13 -03:00
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#if CAMERA == ENABLED
2011-09-08 22:45:13 -03:00
void waypoint_check()
{
if(g.waypoint_index > 1 && g.waypoint_index <=18){ // Between these waypoints it will do what you want
if(wp_distance < g.camera.wp_distance_min){ // Get as close as it can for you
g.camera.trigger_pic();
2011-09-08 22:45:13 -03:00
} // DO SOMETHIMNG
}
if(g.waypoint_index == 20){ // When here do whats underneath
g.camera.trigger_pic();
2011-09-08 22:45:13 -03:00
}
}
void picture_time_check()
{
if (g.camera.picture_time == 1){
if (wp_distance < g.camera.wp_distance_min){
g.camera.trigger_pic(); // or any camera activation command
2011-09-08 22:45:13 -03:00
}
}
}
#endif
2011-09-08 22:45:13 -03:00
void egg_waypoint()
{
if (g_rc_function[RC_Channel_aux::k_egg_drop])
{
float temp = (float)(current_loc.alt - home.alt) * .01;
float egg_dist = sqrt(temp / 4.903) * (float)g_gps->ground_speed *.01;
2011-09-08 22:45:13 -03:00
if(g.waypoint_index == 3){
if(wp_distance < egg_dist){
g_rc_function[RC_Channel_aux::k_egg_drop]->servo_out = 1500 + (-45*10.31);
}
}else{
g_rc_function[RC_Channel_aux::k_egg_drop]->servo_out = 1500 + (45*10.31);
2011-09-08 22:45:13 -03:00
}
}
}
#if CAMERA == ENABLED
2011-09-08 22:45:13 -03:00
void johann_check() // if you aren't Johann it doesn't really matter :D
{
APM_RC.OutputCh(CH_7,1500 + (350));
if(g.waypoint_index > 1 && g.waypoint_index <=18){ // Between these waypoints it will do what you want
if(wp_distance < g.camera.wp_distance_min){ // Get as close as it can for you
g.camera.trigger_pic();
2011-09-08 22:45:13 -03:00
}
}
if(g.waypoint_index == 20){ // When here do whats underneath
g.camera.trigger_pic();
2011-09-08 22:45:13 -03:00
}
}
#endif