#include <drive.H>
Public Member Functions | |
drive_t (base_path_interpolator_t *path_interpolator, speed_planner_t *speed_planner, guide_mode_t *guide_mode, base_steering_t *steering_controller, safe_speed_advisor_t *safe_speed_advisor, base_throttle_t *throttle_controller, world_state_t *world_state, const conf_t &steering_conf, const conf_t &cajun_conf) | |
~drive_t () | |
void | drive_the_bot (double tstamp, bool bot_should_die) |
Central function of the class which makes function calls to read iput data, check if system should be paused, get the guide point on the path , and ask steering controller to provide steering commands to drive to this point, calls safety_speed_advisor and speed planner to get instantneous desired speed and calls throttle controller to provde throttle commands and populates these steering commands. | |
void | publish_pause_values (double tstamp, double pause_brake, steering_data_t::gear_t gear_) |
Publishes the steering commands when started or before terminating the program. | |
bool | shutdown () |
Returns true if the vehicle is stopped and software can quit. | |
Private Member Functions | |
bool | read_steering_conf (const conf_t &steering_conf) |
Read parameters from steering config file. | |
bool | read_cajun_conf (const conf_t &cajun_conf) |
Read parameters from cajun.conf config file. | |
void | update_data (double tstamp) |
Updates all input data, and callt he function that will print a message once per every change of signal line status. | |
void | compute_azimuths () |
Compute azimuth for all the waypoint in m_path, the path to be followed. | |
void | update_signal_line (double tstamp) |
Print a message once per every change of signal line status. | |
bool | check_staled_data (double tstamp) |
Checks the how old is each of the input data, and returns 'false' if any data is older than max timeout amount. | |
void | update_stale_status (double tstamp, double data_tstamp, double timeout, bool &data_staled, const char *data_name) |
This is a common interface to print message regarding staled status for each of the input data that is being read. | |
void | update_delayed_hardware_pause (double tstamp, bool h_pause) |
Delays the hardware unpause signal so as to give the system enough time to register the environment and determine what to do. Also its GC's requirement to have a lag before start moving after receiving the unpause signal. | |
void | update_software_pause (double tstamp, int goal_index) |
Goes through all the conditions which can cause software pause, right now there are only 2, one is staled data, and second no more path to follow. | |
void | update_bot_should_die (double tstamp, bool received_interrupt) |
Goes through all conditions which can cause bot to die. | |
void | update_bot_should_stop (double tstamp, int goal_index) |
Goes through all conditions which can cause bot to stop. | |
void | update_zero_speed (double tstamp, int goal_index) |
void | update_gear_action (double tstamp) |
void | update_action_status (double tstamp, bool bot_should_die, int goal_index) |
Updates status of 'software_pause', 'm_bot_stopped', 'm_bot_should_die' variables. | |
double | steering_position (double tstamp) |
Depending on the what is selected in config file, steering feedback is provided from drive queue or last iteration's steering command. | |
double | map_steering_angle_to_command (double st_angle) |
Maps the steering wheel angle to steering command from -1 to +1. | |
void | convert_to_output_format (double tstamp, path_data_t &output_path) |
Generate path data to output detail path from vector<waypoint_t>. | |
void | update_flag (double tstamp, bool &present_status, bool new_status, const char *mesg, const char *mesg_okay, const char *mesg_not_okay) |
updates the flag and prints appropriate message once per a change in flag | |
void | change_gear (double tstamp_) |
Gives gear command, records gear issue command_tstamp for confirming gear is changed. Also disables m_gear_change_stop flag once gear is changed. | |
Private Attributes | |
base_path_interpolator_t * | m_path_interpolator |
speed_planner_t * | m_speed_planner |
guide_mode_t * | m_guide_mode |
base_steering_t * | m_steering_controller |
safe_speed_advisor_t * | m_safe_speed_advisor |
base_throttle_t * | m_throttle_controller |
world_state_t * | m_world_state |
nav_data_t | m_nav |
heading_data_t | m_heading |
sog_data_t | m_sog |
drive_data_t | m_drive |
steering_data_t | m_steering |
signal_line_data_t | m_signal_line |
path_data_t | m_input_path |
std::vector< waypoint_t > | m_path |
bool | m_input_path_forward |
steering_data_t::gear_t | m_pres_gear |
steering_data_t::gear_t | m_req_gear |
double | m_gear_req_tstamp |
double | m_gear_change_time |
bool | m_gear_change_stop |
bool | m_nav_staled |
bool | m_heading_staled |
bool | m_sog_staled |
bool | m_drive_staled |
bool | m_signal_line_staled |
bool | m_path_staled |
bool | m_bot_should_die |
bool | m_bot_should_stop |
bool | m_bot_stopped |
bool | m_software_pause |
bool | m_hardware_pause |
bool | m_covered_input_path |
bool | m_empty_input_path |
bool | m_zero_speed_path |
double | m_min_wheel_angle |
double | m_max_wheel_angle |
double | m_max_stop_speed |
double | m_pause_brake |
double | m_prev_tstamp |
double | m_unpause_delay_left |
double | m_unpause_delay |
double | m_path_data_timeout |
double | m_data_timeout |
int | m_steering_position_feedback |
double | m_min_dis_to_reach_wp |
drive_t::drive_t | ( | base_path_interpolator_t * | path_interpolator, | |
speed_planner_t * | speed_planner, | |||
guide_mode_t * | guide_mode, | |||
base_steering_t * | steering_controller, | |||
safe_speed_advisor_t * | safe_speed_advisor, | |||
base_throttle_t * | throttle_controller, | |||
world_state_t * | world_state, | |||
const conf_t & | steering_conf, | |||
const conf_t & | cajun_conf | |||
) |
References m_bot_should_die, m_bot_should_stop, m_bot_stopped, m_covered_input_path, m_empty_input_path, m_gear_change_stop, m_gear_change_time, m_hardware_pause, m_heading_staled, m_nav_staled, m_path_data_timeout, m_path_staled, m_pres_gear, m_prev_tstamp, m_req_gear, m_signal_line_staled, m_software_pause, m_sog_staled, m_steering, m_unpause_delay_left, m_zero_speed_path, cajun::safe_speed_advisor_t::path_timeout_for_pause(), read_cajun_conf(), and read_steering_conf().
cajun::drive_t::~drive_t | ( | ) | [inline] |
void drive_t::change_gear | ( | double | tstamp_ | ) | [private] |
Gives gear command, records gear issue command_tstamp for confirming gear is changed. Also disables m_gear_change_stop flag once gear is changed.
References m_bot_stopped, m_gear_change_stop, m_gear_change_time, m_gear_req_tstamp, m_input_path_forward, m_pres_gear, and m_req_gear.
Referenced by drive_the_bot().
bool drive_t::check_staled_data | ( | double | tstamp | ) | [private] |
Checks the how old is each of the input data, and returns 'false' if any data is older than max timeout amount.
References m_data_timeout, m_heading, m_heading_staled, m_input_path, m_nav, m_nav_staled, m_path_data_timeout, m_path_staled, m_signal_line, m_signal_line_staled, m_sog, m_sog_staled, and update_stale_status().
Referenced by update_software_pause().
void drive_t::compute_azimuths | ( | ) | [private] |
Compute azimuth for all the waypoint in m_path, the path to be followed.
References m_empty_input_path, and m_path.
Referenced by update_data().
void drive_t::convert_to_output_format | ( | double | tstamp, | |
path_data_t & | output_path | |||
) | [private] |
Generate path data to output detail path from vector<waypoint_t>.
References m_path.
Referenced by drive_the_bot().
void drive_t::drive_the_bot | ( | double | tstamp, | |
bool | bot_should_die | |||
) |
Central function of the class which makes function calls to read iput data, check if system should be paused, get the guide point on the path , and ask steering controller to provide steering commands to drive to this point, calls safety_speed_advisor and speed planner to get instantneous desired speed and calls throttle controller to provde throttle commands and populates these steering commands.
References change_gear(), convert_to_output_format(), cajun::speed_planner_t::desired_speed(), cajun::guide_mode_t::guide(), m_bot_should_die, m_bot_should_stop, m_bot_stopped, m_covered_input_path, m_empty_input_path, m_gear_change_stop, m_guide_mode, m_hardware_pause, m_heading, m_input_path, m_min_dis_to_reach_wp, m_nav, m_path, m_pause_brake, m_pres_gear, m_req_gear, m_safe_speed_advisor, m_software_pause, m_sog, m_speed_planner, m_steering, m_steering_controller, m_throttle_controller, m_world_state, cajun::safe_speed_advisor_t::max_speed_limit(), cajun::next_goal_to_drive_to(), publish_pause_values(), cajun::safe_speed_advisor_t::set_safe_path_speeds(), cajun::base_steering_t::steer(), steering_position(), cajun::base_throttle_t::throttle(), update_action_status(), update_data(), and update_flag().
Referenced by main().
double drive_t::map_steering_angle_to_command | ( | double | st_angle | ) | [private] |
Maps the steering wheel angle to steering command from -1 to +1.
References m_max_wheel_angle, and m_min_wheel_angle.
void drive_t::publish_pause_values | ( | double | tstamp, | |
double | pause_brake, | |||
steering_data_t::gear_t | gear_ | |||
) |
Publishes the steering commands when started or before terminating the program.
References m_nav, and m_world_state.
Referenced by drive_the_bot(), and main().
bool drive_t::read_cajun_conf | ( | const conf_t & | cajun_conf | ) | [private] |
Read parameters from cajun.conf config file.
References D2R, m_gear_change_time, m_max_wheel_angle, and m_min_wheel_angle.
Referenced by drive_t().
bool drive_t::read_steering_conf | ( | const conf_t & | steering_conf | ) | [private] |
Read parameters from steering config file.
References m_data_timeout, m_max_stop_speed, m_min_dis_to_reach_wp, m_pause_brake, m_steering_position_feedback, and m_unpause_delay.
Referenced by drive_t().
bool drive_t::shutdown | ( | ) |
Returns true if the vehicle is stopped and software can quit.
References m_bot_should_die, and m_bot_stopped.
Referenced by main().
double drive_t::steering_position | ( | double | tstamp | ) | [private] |
Depending on the what is selected in config file, steering feedback is provided from drive queue or last iteration's steering command.
References m_steering, m_steering_position_feedback, message, and msg_logger.
Referenced by drive_the_bot().
void drive_t::update_action_status | ( | double | tstamp, | |
bool | bot_should_die, | |||
int | goal_index | |||
) | [private] |
Updates status of 'software_pause', 'm_bot_stopped', 'm_bot_should_die' variables.
References cajun::base_throttle_t::init(), cajun::base_steering_t::init(), m_bot_should_die, m_bot_should_stop, m_bot_stopped, m_gear_change_stop, m_hardware_pause, m_max_stop_speed, m_signal_line, m_software_pause, m_sog, m_steering_controller, m_throttle_controller, m_zero_speed_path, update_bot_should_die(), update_bot_should_stop(), update_delayed_hardware_pause(), update_gear_action(), update_software_pause(), and update_zero_speed().
Referenced by drive_the_bot().
void drive_t::update_bot_should_die | ( | double | tstamp, | |
bool | received_interrupt | |||
) | [private] |
Goes through all conditions which can cause bot to die.
References m_bot_should_die, m_empty_input_path, m_signal_line, and update_flag().
Referenced by update_action_status().
void drive_t::update_bot_should_stop | ( | double | tstamp, | |
int | goal_index | |||
) | [private] |
Goes through all conditions which can cause bot to stop.
References m_bot_should_stop, m_covered_input_path, m_empty_input_path, and update_flag().
Referenced by update_action_status().
void drive_t::update_data | ( | double | tstamp | ) | [private] |
Updates all input data, and callt he function that will print a message once per every change of signal line status.
References compute_azimuths(), cajun::base_path_interpolator_t::interpolate(), m_empty_input_path, m_heading, m_input_path, m_input_path_forward, m_nav, m_path, m_path_interpolator, m_sog, m_world_state, update_flag(), and update_signal_line().
Referenced by drive_the_bot().
void drive_t::update_delayed_hardware_pause | ( | double | tstamp, | |
bool | h_pause | |||
) | [private] |
Delays the hardware unpause signal so as to give the system enough time to register the environment and determine what to do. Also its GC's requirement to have a lag before start moving after receiving the unpause signal.
References m_hardware_pause, m_prev_tstamp, m_unpause_delay, m_unpause_delay_left, and update_flag().
Referenced by update_action_status().
void drive_t::update_flag | ( | double | tstamp, | |
bool & | present_status, | |||
bool | new_status, | |||
const char * | mesg, | |||
const char * | mesg_okay, | |||
const char * | mesg_not_okay | |||
) | [private] |
updates the flag and prints appropriate message once per a change in flag
References message, and msg_logger.
Referenced by drive_the_bot(), update_bot_should_die(), update_bot_should_stop(), update_data(), update_delayed_hardware_pause(), update_gear_action(), update_software_pause(), and update_zero_speed().
void drive_t::update_gear_action | ( | double | tstamp | ) | [private] |
References m_gear_change_stop, m_input_path_forward, m_pres_gear, and update_flag().
Referenced by update_action_status().
void drive_t::update_signal_line | ( | double | tstamp | ) | [private] |
Print a message once per every change of signal line status.
References m_signal_line, m_world_state, message, and msg_logger.
Referenced by update_data().
void drive_t::update_software_pause | ( | double | tstamp, | |
int | goal_index | |||
) | [private] |
Goes through all the conditions which can cause software pause, right now there are only 2, one is staled data, and second no more path to follow.
References check_staled_data(), m_software_pause, and update_flag().
Referenced by update_action_status().
void drive_t::update_stale_status | ( | double | tstamp, | |
double | data_tstamp, | |||
double | timeout, | |||
bool & | data_staled, | |||
const char * | data_name | |||
) | [private] |
This is a common interface to print message regarding staled status for each of the input data that is being read.
References message, and msg_logger.
Referenced by check_staled_data().
void drive_t::update_zero_speed | ( | double | tstamp, | |
int | goal_index | |||
) | [private] |
References m_path, m_zero_speed_path, and update_flag().
Referenced by update_action_status().
bool cajun::drive_t::m_bot_should_die [private] |
Referenced by drive_t(), drive_the_bot(), shutdown(), update_action_status(), and update_bot_should_die().
bool cajun::drive_t::m_bot_should_stop [private] |
Referenced by drive_t(), drive_the_bot(), update_action_status(), and update_bot_should_stop().
bool cajun::drive_t::m_bot_stopped [private] |
Referenced by change_gear(), drive_t(), drive_the_bot(), shutdown(), and update_action_status().
bool cajun::drive_t::m_covered_input_path [private] |
Referenced by drive_t(), drive_the_bot(), and update_bot_should_stop().
double cajun::drive_t::m_data_timeout [private] |
Referenced by check_staled_data(), and read_steering_conf().
drive_data_t cajun::drive_t::m_drive [private] |
bool cajun::drive_t::m_drive_staled [private] |
bool cajun::drive_t::m_empty_input_path [private] |
Referenced by compute_azimuths(), drive_t(), drive_the_bot(), update_bot_should_die(), update_bot_should_stop(), and update_data().
bool cajun::drive_t::m_gear_change_stop [private] |
Referenced by change_gear(), drive_t(), drive_the_bot(), update_action_status(), and update_gear_action().
double cajun::drive_t::m_gear_change_time [private] |
Referenced by change_gear(), drive_t(), and read_cajun_conf().
double cajun::drive_t::m_gear_req_tstamp [private] |
Referenced by change_gear().
guide_mode_t* cajun::drive_t::m_guide_mode [private] |
Referenced by drive_the_bot().
bool cajun::drive_t::m_hardware_pause [private] |
Referenced by drive_t(), drive_the_bot(), update_action_status(), and update_delayed_hardware_pause().
heading_data_t cajun::drive_t::m_heading [private] |
Referenced by check_staled_data(), drive_the_bot(), and update_data().
bool cajun::drive_t::m_heading_staled [private] |
Referenced by check_staled_data(), and drive_t().
path_data_t cajun::drive_t::m_input_path [private] |
Referenced by check_staled_data(), drive_the_bot(), and update_data().
bool cajun::drive_t::m_input_path_forward [private] |
Referenced by change_gear(), update_data(), and update_gear_action().
double cajun::drive_t::m_max_stop_speed [private] |
Referenced by read_steering_conf(), and update_action_status().
double cajun::drive_t::m_max_wheel_angle [private] |
Referenced by map_steering_angle_to_command(), and read_cajun_conf().
double cajun::drive_t::m_min_dis_to_reach_wp [private] |
Referenced by drive_the_bot(), and read_steering_conf().
double cajun::drive_t::m_min_wheel_angle [private] |
Referenced by map_steering_angle_to_command(), and read_cajun_conf().
nav_data_t cajun::drive_t::m_nav [private] |
Referenced by check_staled_data(), drive_the_bot(), publish_pause_values(), and update_data().
bool cajun::drive_t::m_nav_staled [private] |
Referenced by check_staled_data(), and drive_t().
std::vector<waypoint_t> cajun::drive_t::m_path [private] |
Referenced by compute_azimuths(), convert_to_output_format(), drive_the_bot(), update_data(), and update_zero_speed().
double cajun::drive_t::m_path_data_timeout [private] |
Referenced by check_staled_data(), and drive_t().
Referenced by update_data().
bool cajun::drive_t::m_path_staled [private] |
Referenced by check_staled_data(), and drive_t().
double cajun::drive_t::m_pause_brake [private] |
Referenced by drive_the_bot(), and read_steering_conf().
steering_data_t::gear_t cajun::drive_t::m_pres_gear [private] |
Referenced by change_gear(), drive_t(), drive_the_bot(), and update_gear_action().
double cajun::drive_t::m_prev_tstamp [private] |
Referenced by drive_t(), and update_delayed_hardware_pause().
steering_data_t::gear_t cajun::drive_t::m_req_gear [private] |
Referenced by change_gear(), drive_t(), and drive_the_bot().
Referenced by drive_the_bot().
signal_line_data_t cajun::drive_t::m_signal_line [private] |
Referenced by check_staled_data(), update_action_status(), update_bot_should_die(), and update_signal_line().
bool cajun::drive_t::m_signal_line_staled [private] |
Referenced by check_staled_data(), and drive_t().
bool cajun::drive_t::m_software_pause [private] |
Referenced by drive_t(), drive_the_bot(), update_action_status(), and update_software_pause().
sog_data_t cajun::drive_t::m_sog [private] |
Referenced by check_staled_data(), drive_the_bot(), update_action_status(), and update_data().
bool cajun::drive_t::m_sog_staled [private] |
Referenced by check_staled_data(), and drive_t().
speed_planner_t* cajun::drive_t::m_speed_planner [private] |
Referenced by drive_the_bot().
steering_data_t cajun::drive_t::m_steering [private] |
Referenced by drive_t(), drive_the_bot(), and steering_position().
Referenced by drive_the_bot(), and update_action_status().
int cajun::drive_t::m_steering_position_feedback [private] |
Referenced by read_steering_conf(), and steering_position().
Referenced by drive_the_bot(), and update_action_status().
double cajun::drive_t::m_unpause_delay [private] |
Referenced by read_steering_conf(), and update_delayed_hardware_pause().
double cajun::drive_t::m_unpause_delay_left [private] |
Referenced by drive_t(), and update_delayed_hardware_pause().
world_state_t* cajun::drive_t::m_world_state [private] |
Referenced by drive_the_bot(), publish_pause_values(), update_data(), and update_signal_line().
bool cajun::drive_t::m_zero_speed_path [private] |
Referenced by drive_t(), update_action_status(), and update_zero_speed().