Skip to content

Commit a923648

Browse files
tonynajjarSteveMacenski
authored andcommitted
Fix seg fault (#5501)
* Fix segmentation fault Signed-off-by: Tony Najjar <[email protected]> * fix linting Signed-off-by: Tony Najjar <[email protected]> --------- Signed-off-by: Tony Najjar <[email protected]>
1 parent 3efb1fb commit a923648

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nav2_smac_planner/src/node_lattice.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ bool NodeLattice::isNodeValid(
229229
// Check primitive end pose
230230
// Convert grid quantization of primitives to radians, then collision checker quantization
231231
static const double bin_size = 2.0 * M_PI / collision_checker->getPrecomputedAngles().size();
232-
const double & angle = motion_table.getAngleFromBin(this->pose.theta) / bin_size;
232+
const double angle = std::fmod(motion_table.getAngleFromBin(this->pose.theta),
233+
2.0 * M_PI) / bin_size;
233234
if (collision_checker->inCollision(
234235
this->pose.x, this->pose.y, angle /*bin in collision checker*/, traverse_unknown))
235236
{
@@ -268,7 +269,7 @@ bool NodeLattice::isNodeValid(
268269
if (is_backwards) {
269270
prim_pose._theta = std::fmod(it->_theta + M_PI, 2.0 * M_PI);
270271
} else {
271-
prim_pose._theta = it->_theta;
272+
prim_pose._theta = std::fmod(it->_theta, 2.0 * M_PI);
272273
}
273274
if (collision_checker->inCollision(
274275
prim_pose._x,

0 commit comments

Comments
 (0)