File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
nav2_smac_planner/include/nav2_smac_planner Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -159,12 +159,14 @@ inline std::vector<geometry_msgs::msg::Point> transformFootprintToEdges(
159
159
const double & x = pose.position .x ;
160
160
const double & y = pose.position .y ;
161
161
const double & yaw = tf2::getYaw (pose.orientation );
162
+ const double sin_yaw = sin (yaw);
163
+ const double cos_yaw = cos (yaw);
162
164
163
165
std::vector<geometry_msgs::msg::Point> out_footprint;
164
166
out_footprint.resize (2 * footprint.size ());
165
167
for (unsigned int i = 0 ; i < footprint.size (); i++) {
166
- out_footprint[2 * i].x = x + cos (yaw) * footprint[i].x - sin (yaw) * footprint[i].y ;
167
- out_footprint[2 * i].y = y + sin (yaw) * footprint[i].x + cos (yaw) * footprint[i].y ;
168
+ out_footprint[2 * i].x = x + cos_yaw * footprint[i].x - sin_yaw * footprint[i].y ;
169
+ out_footprint[2 * i].y = y + sin_yaw * footprint[i].x + cos_yaw * footprint[i].y ;
168
170
if (i == 0 ) {
169
171
out_footprint.back ().x = out_footprint[i].x ;
170
172
out_footprint.back ().y = out_footprint[i].y ;
You can’t perform that action at this time.
0 commit comments