Skip to content

Commit

Permalink
refactor(freespace_planner): parameterize margin. (autowarefoundation…
Browse files Browse the repository at this point in the history
…#1190)

Signed-off-by: Karmen Lu <[email protected]>
  • Loading branch information
karmenlu authored and yukke42 committed Oct 14, 2022
1 parent 57e1b3e commit 05ece7a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
th_stopped_time_sec: 1.0
th_stopped_velocity_mps: 0.01
th_course_out_distance_m: 1.0
vehicle_shape_margin_m: 1.0
replan_when_obstacle_found: true
replan_when_course_out: true

Expand Down
1 change: 1 addition & 0 deletions planning/freespace_planner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ None
| `th_stopped_time_sec` | double | threshold time to check if vehicle is stopped |
| `th_stopped_velocity_mps` | double | threshold velocity to check if vehicle is stopped |
| `th_course_out_distance_m` | double | threshold distance to check if vehicle is out of course |
| `vehicle_shape_margin_m` | double | vehicle margin |
| `replan_when_obstacle_found` | bool | whether replanning when obstacle has found on the trajectory |
| `replan_when_course_out` | bool | whether replanning when vehicle is out of course |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
th_stopped_time_sec: 1.0
th_stopped_velocity_mps: 0.01
th_course_out_distance_m: 1.0
vehicle_shape_margin_m: 1.0
replan_when_obstacle_found: true
replan_when_course_out: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct NodeParam
double th_stopped_time_sec;
double th_stopped_velocity_mps;
double th_course_out_distance_m;
double vehicle_shape_margin_m;
bool replan_when_obstacle_found;
bool replan_when_course_out;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ FreespacePlannerNode::FreespacePlannerNode(const rclcpp::NodeOptions & node_opti
p.th_stopped_time_sec = declare_parameter("th_stopped_time_sec", 1.0);
p.th_stopped_velocity_mps = declare_parameter("th_stopped_velocity_mps", 0.01);
p.th_course_out_distance_m = declare_parameter("th_course_out_distance_m", 3.0);
p.vehicle_shape_margin_m = declare_parameter("vehicle_shape_margin_m", 1.0);
p.replan_when_obstacle_found = declare_parameter("replan_when_obstacle_found", true);
p.replan_when_course_out = declare_parameter("replan_when_course_out", true);
declare_parameter<bool>("is_completed", false);
Expand Down Expand Up @@ -463,7 +464,7 @@ void FreespacePlannerNode::planTrajectory()
// Extend robot shape
freespace_planning_algorithms::VehicleShape extended_vehicle_shape =
planner_common_param_.vehicle_shape;
constexpr double margin = 1.0;
const double margin = node_param_.vehicle_shape_margin_m;
extended_vehicle_shape.length += margin;
extended_vehicle_shape.width += margin;
extended_vehicle_shape.base2back += margin / 2;
Expand Down

0 comments on commit 05ece7a

Please sign in to comment.