00001 #include <vigir_footstep_planner/environment_parameters.h>
00002
00003 namespace vigir_footstep_planning
00004 {
00005 EnvironmentParameters::EnvironmentParameters(const vigir_generic_params::ParameterSet& params)
00006 {
00007
00008 ros::NodeHandle nh;
00009
00010
00011 nh.getParam("foot/size/x", foot_size.x);
00012 nh.getParam("foot/size/y", foot_size.y);
00013 nh.getParam("foot/size/z", foot_size.z);
00014 nh.getParam("foot/separation", foot_seperation);
00015
00016 params.getParam("max_risk", max_risk, 1.0);
00017
00018
00019 params.getParam("heuristic_scale", heuristic_scale);
00020 params.getParam("max_hash_size", hash_table_size);
00021
00022 params.getParam("planner_type", ivPlannerType);
00023 params.getParam("search_until_first_solution", ivSearchUntilFirstSolution);
00024 params.getParam("forward_search", forward_search);
00025
00026 params.getParam("max_planning_time", max_planning_time);
00027 params.getParam("initial_epsilon", initial_eps);
00028 params.getParam("decrease_epsilon", decrease_eps);
00029
00030
00031
00032
00033
00034
00035 params.getParam("collision_check/cell_size", cell_size);
00036 params.getParam("collision_check/num_angle_bins", num_angle_bins);
00037 angle_bin_size = 2.0*M_PI / static_cast<double>(num_angle_bins);
00038
00039 double max_step_range_x, max_step_range_y, max_step_range_theta;
00040 double max_inverse_step_range_x, max_inverse_step_range_y, max_inverse_step_range_theta;
00041
00042
00043 XmlRpc::XmlRpcValue step_range_x;
00044 XmlRpc::XmlRpcValue step_range_y;
00045 if (params.getParam("step_range/x", step_range_x) && params.getParam("step_range/y", step_range_y))
00046 {
00047 max_step_dist = 0;
00048 double max_x = (double)step_range_x[0];
00049 double max_y = (double)step_range_y[0];
00050 double max_inv_x = (double)step_range_x[0];
00051 double max_inv_y = (double)step_range_y[0];
00052 for (int i=0; i < step_range_x.size(); ++i)
00053 {
00054 double x = (double)step_range_x[i];
00055 double y = (double)step_range_y[i];
00056
00057 max_x = std::max(max_x, x);
00058 max_y = std::max(max_y, y);
00059 max_inv_x = std::min(max_inv_x, x);
00060 max_inv_y = std::min(max_inv_y, y);
00061
00062 double cur_step_width = sqrt(x*x + y*y);
00063 if (cur_step_width > max_step_dist)
00064 max_step_dist = cur_step_width;
00065 }
00066
00067 max_step_range_x = max_x;
00068 max_step_range_y = max_y;
00069 params.getParam("foot/max/step/theta", max_step_range_theta);
00070 max_inverse_step_range_x = max_inv_x;
00071 max_inverse_step_range_y = max_inv_y;
00072 params.getParam("foot/max/inverse/step/theta", max_inverse_step_range_theta);
00073
00074 max_x = std::max(std::abs(max_x), std::abs(max_inv_x));
00075 max_y = std::max(std::abs(max_y), std::abs(max_inv_y));
00076 max_step_range_width = sqrt(max_x*max_x + max_y*max_y);
00077 }
00078
00079
00080 params.getParam("feedback_rate", feedback_rate);
00081 params.getParam("threads", threads);
00082 params.getParam("jobs_per_thread", jobs_per_thread);
00083
00084
00086 vigir_generic_params::ParameterSet& params_(const_cast<vigir_generic_params::ParameterSet&>(params));
00087
00088 params_.setParam("max_step_range/x", max_step_range_x);
00089 params_.setParam("max_step_range/y", max_step_range_y);
00090 params_.setParam("max_step_range/yaw", max_step_range_theta);
00091
00092 params_.setParam("max_step_range/inv_x", max_inverse_step_range_x);
00093 params_.setParam("max_step_range/inv_y", max_inverse_step_range_y);
00094 params_.setParam("max_step_range/inv_yaw", max_inverse_step_range_theta);
00095
00096 params_.setParam("max_step_range/width", max_step_range_width);
00097
00098 params_.setParam("max_step_dist/x", std::max(std::abs(max_step_range_x), std::abs(max_inverse_step_range_x)));
00099 params_.setParam("max_step_dist/y", 0.5*(std::max(std::abs(max_step_range_y), std::abs(max_inverse_step_range_y)) - foot_seperation));
00100 }
00101
00102 EnvironmentParameters::~EnvironmentParameters()
00103 {
00104 }
00105 }