This class provides safe speed limit for the vehicle based: -- on present behavior of the vehicle -- max speed for heading error -- max relative increase in speed for present heading error -- max relative increase in speed for present turning rate -- delay in path planner's path -- config track speed limit. More...
#include <safe_speed_advisor.H>
Classes | |
struct | interp_entry_t |
struct | speed_for_delay_t |
Public Member Functions | |
safe_speed_advisor_t (const conf_t &steering_conf) | |
double | max_speed_limit (double tstamp_, double speed_, double heading_, double path_delay, int goal_index, guide_data_t gd_) |
Retuns the max safe speed that system can try to achieve in present situation, the conditions checked are listed in class description. | |
void | set_safe_path_speeds (uniform_path_t &path, bool quick_acceleration_) |
double | path_timeout_for_pause () |
return timeout for path delay to pause the vehicle | |
Private Member Functions | |
bool | read_conf (const conf_t &steering_conf) |
double | speed_at_orientation_diff (double orient_diff) |
Returns safe speed for the vehicle when trying to cover up a orientation error. | |
double | suggested_speed_for_cbln_delay (double cbln_delay_) |
Returns safe speed when the path being followed is 'cbln_delay' older. This is will be useful when path planner is taking more time to compute the path, which means that reaction time of the system as increased hence better to go at lower speed. | |
double | interpolate_value (std::vector< interp_entry_t > &table_, double value_) |
double | relative_speed_at_heading_error (double h_error_) |
Returns max increase in the speed that the system can achieve when trying to clear up 'h_error_' heading error. | |
double | relative_speed_at_heading_rate (double tstamp_, double h_) |
Returns max increase in the speed that the system can achieve when turning at present rate. | |
double | safe_approach_speed (double waypoint_speed, double dis_between_points, double suggested_deceleration) |
void | set_consistent_speed_limits (uniform_path_t &path, bool quick_acceleration_) |
Make sure speed limits of adjacent wps of the path are consistent (reachable). | |
void | set_consistent_speed (uniform_path_t &path_, unsigned path_id_, unsigned ref_id_, double suggested_deceleration) |
double | orient_at_path (uniform_path_t &path, unsigned ind) |
returns orientation of the path at path[ind] | |
void | set_turn_path_speeds (uniform_path_t &path) |
Set turn speed at each point on the path based on the change in the orientation of path from that point to some distance infront of it along the path. | |
unsigned | LA_path_index (uniform_path_t &path, unsigned ind, double dis_) |
double | speed_limit_for_orient_change (double orient_diff) |
Private Attributes | |
std::vector< speed_for_delay_t > | m_speed_for_delay |
std::vector< interp_entry_t > | m_path_turn_speeds |
std::vector< interp_entry_t > | m_heading_error_speed_limit |
std::vector< interp_entry_t > | m_heading_rate_speed_limit |
std::vector< double > | m_turn_speed |
heading_data_t | m_heading [2] |
double | m_config_track_speed |
double | m_suggested_deceleration |
double | m_suggested_acceleration |
double | m_suggested_high_acceleration |
double | m_path_speed_LAD |
This class provides safe speed limit for the vehicle based: -- on present behavior of the vehicle -- max speed for heading error -- max relative increase in speed for present heading error -- max relative increase in speed for present turning rate -- delay in path planner's path -- config track speed limit.
TODO: Set the speed limit for the path based on its radius of curveture of the road Move the code for setting consistent speed limit between wp of the path here
safe_speed_advisor_t::safe_speed_advisor_t | ( | const conf_t & | steering_conf | ) |
References m_heading, and read_conf().
double cajun::safe_speed_advisor_t::interpolate_value | ( | std::vector< interp_entry_t > & | table_, | |
double | value_ | |||
) | [private] |
unsigned safe_speed_advisor_t::LA_path_index | ( | uniform_path_t & | path, | |
unsigned | ind, | |||
double | dis_ | |||
) | [private] |
Referenced by set_turn_path_speeds().
double safe_speed_advisor_t::max_speed_limit | ( | double | tstamp_, | |
double | speed_, | |||
double | heading_, | |||
double | path_delay, | |||
int | goal_index, | |||
guide_data_t | gd_ | |||
) |
Retuns the max safe speed that system can try to achieve in present situation, the conditions checked are listed in class description.
References m_config_track_speed, relative_speed_at_heading_error(), relative_speed_at_heading_rate(), speed_at_orientation_diff(), and suggested_speed_for_cbln_delay().
Referenced by cajun::drive_t::drive_the_bot().
double safe_speed_advisor_t::orient_at_path | ( | uniform_path_t & | path, | |
unsigned | ind | |||
) | [private] |
returns orientation of the path at path[ind]
Referenced by set_turn_path_speeds().
double safe_speed_advisor_t::path_timeout_for_pause | ( | ) |
return timeout for path delay to pause the vehicle
Returns the timeout so that vehicle can be paused if the last input path is older than this time.
References m_speed_for_delay.
Referenced by cajun::drive_t::drive_t().
bool safe_speed_advisor_t::read_conf | ( | const conf_t & | steering_conf | ) | [private] |
double safe_speed_advisor_t::relative_speed_at_heading_error | ( | double | h_error_ | ) | [private] |
Returns max increase in the speed that the system can achieve when trying to clear up 'h_error_' heading error.
References interpolate_value(), and m_heading_error_speed_limit.
Referenced by max_speed_limit().
double safe_speed_advisor_t::relative_speed_at_heading_rate | ( | double | tstamp_, | |
double | h_ | |||
) | [private] |
Returns max increase in the speed that the system can achieve when turning at present rate.
References interpolate_value(), m_heading, and m_heading_rate_speed_limit.
Referenced by max_speed_limit().
double safe_speed_advisor_t::safe_approach_speed | ( | double | waypoint_speed, | |
double | dis_between_points, | |||
double | suggested_deceleration | |||
) | [private] |
Referenced by set_consistent_speed().
void safe_speed_advisor_t::set_consistent_speed | ( | uniform_path_t & | path_, | |
unsigned | path_id_, | |||
unsigned | ref_id_, | |||
double | suggested_deceleration | |||
) | [private] |
References safe_approach_speed().
Referenced by set_consistent_speed_limits().
void safe_speed_advisor_t::set_consistent_speed_limits | ( | uniform_path_t & | path, | |
bool | quick_acceleration_ | |||
) | [private] |
Make sure speed limits of adjacent wps of the path are consistent (reachable).
References m_suggested_acceleration, m_suggested_deceleration, m_suggested_high_acceleration, and set_consistent_speed().
Referenced by set_safe_path_speeds().
void safe_speed_advisor_t::set_safe_path_speeds | ( | uniform_path_t & | path, | |
bool | quick_acceleration_ | |||
) |
References set_consistent_speed_limits(), and set_turn_path_speeds().
Referenced by cajun::drive_t::drive_the_bot().
void safe_speed_advisor_t::set_turn_path_speeds | ( | uniform_path_t & | path | ) | [private] |
Set turn speed at each point on the path based on the change in the orientation of path from that point to some distance infront of it along the path.
References LA_path_index(), m_path_speed_LAD, orient_at_path(), and speed_limit_for_orient_change().
Referenced by set_safe_path_speeds().
double safe_speed_advisor_t::speed_at_orientation_diff | ( | double | orient_diff | ) | [private] |
Returns safe speed for the vehicle when trying to cover up a orientation error.
References m_turn_speed.
Referenced by max_speed_limit().
double safe_speed_advisor_t::speed_limit_for_orient_change | ( | double | orient_diff | ) | [private] |
References interpolate_value(), and m_path_turn_speeds.
Referenced by set_turn_path_speeds().
double safe_speed_advisor_t::suggested_speed_for_cbln_delay | ( | double | cbln_delay_ | ) | [private] |
Returns safe speed when the path being followed is 'cbln_delay' older. This is will be useful when path planner is taking more time to compute the path, which means that reaction time of the system as increased hence better to go at lower speed.
References m_speed_for_delay.
Referenced by max_speed_limit().
double cajun::safe_speed_advisor_t::m_config_track_speed [private] |
Referenced by max_speed_limit(), and read_conf().
heading_data_t cajun::safe_speed_advisor_t::m_heading[2] [private] |
Referenced by relative_speed_at_heading_rate(), and safe_speed_advisor_t().
std::vector<interp_entry_t> cajun::safe_speed_advisor_t::m_heading_error_speed_limit [private] |
Referenced by read_conf(), and relative_speed_at_heading_error().
std::vector<interp_entry_t> cajun::safe_speed_advisor_t::m_heading_rate_speed_limit [private] |
Referenced by read_conf(), and relative_speed_at_heading_rate().
double cajun::safe_speed_advisor_t::m_path_speed_LAD [private] |
Referenced by read_conf(), and set_turn_path_speeds().
std::vector<interp_entry_t> cajun::safe_speed_advisor_t::m_path_turn_speeds [private] |
Referenced by read_conf(), and speed_limit_for_orient_change().
std::vector<speed_for_delay_t> cajun::safe_speed_advisor_t::m_speed_for_delay [private] |
Referenced by path_timeout_for_pause(), read_conf(), and suggested_speed_for_cbln_delay().
double cajun::safe_speed_advisor_t::m_suggested_acceleration [private] |
Referenced by read_conf(), and set_consistent_speed_limits().
double cajun::safe_speed_advisor_t::m_suggested_deceleration [private] |
Referenced by read_conf(), and set_consistent_speed_limits().
double cajun::safe_speed_advisor_t::m_suggested_high_acceleration [private] |
Referenced by read_conf(), and set_consistent_speed_limits().
std::vector<double> cajun::safe_speed_advisor_t::m_turn_speed [private] |
Referenced by read_conf(), and speed_at_orientation_diff().