Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segment fault on 32-bit machine #459

Merged
merged 8 commits into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
* Changed interface for TrajectoryPostProcessor: [#341](https://github.com/personalrobotics/aikido/pull/341)
* Planning calls with InverseKinematicsSampleable constraints explicitly set MetaSkeleton to solve IK with: [#379](https://github.com/personalrobotics/aikido/pull/379)
* Added a kinodynamic timer that generates a time-optimal smooth trajectory without completely stopping at each waypoint: [#443](https://github.com/personalrobotics/aikido/pull/443)
* Fix segment fault on 32 bit machine in vector-field planner: [#459](https://github.com/personalrobotics/aikido/pull/459)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Fixed


* Robot

Expand Down
15 changes: 11 additions & 4 deletions src/planner/vectorfield/detail/VectorFieldIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,20 @@ VectorFieldIntegrator::VectorFieldIntegrator(
double checkConstraintResolution)
: mVectorField(vectorField)
, mConstraint(collisionFreeConstraint)
, mCacheIndex(-1)
, mDimension(mVectorField->getStateSpace()->getDimension())
, mTimelimit(timelimit)
, mConstraintCheckResolution(checkConstraintResolution)
, mState(mVectorField->getStateSpace()->allocateState())
, mLastEvaluationTime(0.0)
{
mCacheIndex = -1;
mLastEvaluationTime = 0.0;
mDimension = mVectorField->getStateSpace()->getDimension();
mState = mVectorField->getStateSpace()->createState();
// Do Nothing
}

//==============================================================================
VectorFieldIntegrator::~VectorFieldIntegrator()
{
mVectorField->getStateSpace()->freeState(mState);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using ScopedState instead of we take the responsibility of the memory allocation/deallocation.

}

//==============================================================================
Expand Down
3 changes: 3 additions & 0 deletions src/planner/vectorfield/detail/VectorFieldIntegrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class VectorFieldIntegrator
double timelimit,
double checkConstraintResolution);

/// Destructor.
virtual ~VectorFieldIntegrator();

/// Called before doing integration.
///
void start();
Expand Down
4 changes: 2 additions & 2 deletions tests/planner/vectorfield/test_VectorFieldPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ TEST_F(VectorFieldPlannerTest, PlanToEndEffectorOffsetTest)
double initialStepSize = 0.001;
double jointLimitTolerance = 1e-3;
double constraintCheckResolution = 1e-3;
std::chrono::duration<double> timelimit(10.0);
std::chrono::duration<double> timelimit(60.0);

// Create problem.
auto offsetProblem = ConfigurationToEndEffectorOffset(
Expand Down Expand Up @@ -455,7 +455,7 @@ TEST_F(VectorFieldPlannerTest, PlanToEndEffectorPoseTest)
double r = 1.0;
double jointLimitTolerance = 1e-3;
double constraintCheckResolution = 1e-3;
std::chrono::duration<double> timelimit(5.);
std::chrono::duration<double> timelimit(60.);

mSkel->setPositions(mStartConfig);

Expand Down