00001 /* -*- mode: C++ -*- 00002 * 00003 * Navigator safety controller 00004 * 00005 * Copyright (C) 2007, 2010, Austin Robot Technology 00006 * 00007 * License: Modified BSD Software License Agreement 00008 * 00009 * $Id: safety.h 479 2010-08-27 01:16:11Z jack.oquin $ 00010 */ 00011 00012 #ifndef __SAFETY_HH__ 00013 #define __SAFETY_HH__ 00014 00015 #include "Controller.h" 00016 00017 // Safety control runs at the end of the Navigator cycle. Its job is 00018 // to avoid any obstacle in the vehicle's immediate path, regardless 00019 // of states or lanes. If we are about to hit something, either halt 00020 // or swerve. 00021 00022 class Safety_Distance; 00023 00024 class Safety: public Controller 00025 { 00026 public: 00027 00028 Safety(Navigator *navptr, int _verbose, int mode=0); 00029 ~Safety(); 00030 00031 // null configuration method 00032 void configure(); 00033 00034 // safety controller 00035 result_t control(pilot_command_t &pcmd); 00036 00037 // reset all subordinate controllers 00038 void reset(void) 00039 { 00040 // TODO: implement this 00041 } 00042 00043 private: 00044 int _mode; 00045 00046 float far_safety_time; 00047 float near_safety_time; 00048 float collision_safety_time; 00049 00050 float far_slow_ratio; 00051 float near_slow_ratio; 00052 float safety_speed; 00053 00054 Safety_Distance *safety; 00055 00056 Controller::result_t halt_immediately(pilot_command_t &pcmd); 00057 }; 00058 00059 #endif // __SAFETY_HH__