Skip to content

Commit

Permalink
address Gilwoo's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Daqing Yi committed Apr 20, 2017
1 parent baa8310 commit aa443dd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
21 changes: 10 additions & 11 deletions include/aikido/constraint/TSR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class TSR : public Sampleable,
const Eigen::Matrix<double, 6, 2>& _Bw =
Eigen::Matrix<double, 6, 2>::Zero(),
const Eigen::Isometry3d& _Tw_e = Eigen::Isometry3d::Identity(),
const double _satisfiableTolerance = 1e-6);
const double _testableTolerance = 1e-6);


/// Constructor with default random seed generator.
Expand All @@ -59,7 +59,7 @@ class TSR : public Sampleable,
const Eigen::Matrix<double, 6, 2>& _Bw =
Eigen::Matrix<double, 6, 2>::Zero(),
const Eigen::Isometry3d& _Tw_e = Eigen::Isometry3d::Identity(),
const double _satisfiableTolerance = 1e-6);
const double _testableTolerance = 1e-6);

TSR(const TSR& other);
TSR(TSR&& other);
Expand Down Expand Up @@ -114,13 +114,13 @@ class TSR : public Sampleable,
bool project(const statespace::StateSpace::State* _s,
statespace::StateSpace::State* _out) const override;

/// Get the staisfiable tolerance for isSatisfiable.
/// \param[out] _out Satisfialble tolerance, double.
double getSatisfiableTolerance();
/// Get the testable tolerance used in isSatisfiable.
/// \param[out] _out Testable tolerance, double.
double getTestableTolerance();

/// Set the staisfiable tolerance for isSatisfiable.
/// \param _satisfiableTolerance Satisfiable tolerance to set.
void setSatisfiableTolerance(const double _satisfiableTolerance);
/// Set the testable tolerance used in isSatisfiable.
/// \param _testableTolerance Testable tolerance to set.
void setTestableTolerance(const double _testableTolerance);

/// Transformation from origin frame into the TSR frame "w".
/// "w" is usually centered at the origin of an object held by the hand
Expand All @@ -134,10 +134,9 @@ class TSR : public Sampleable,
/// This often represent an offset from "w" to the origin of the end-effector.
Eigen::Isometry3d mTw_e;


private:
/// Tolerance for checking satisfiability
double mSatisfiableTolerance;
/// Tolerance used in isSatisfied as a testable
double mTestableTolerance;
std::unique_ptr<util::RNG> mRng;
std::shared_ptr<statespace::SE3> mStateSpace;
};
Expand Down
26 changes: 13 additions & 13 deletions src/constraint/TSR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ class TSRSampleGenerator : public SampleGenerator
//=============================================================================
TSR::TSR(std::unique_ptr<util::RNG> _rng, const Eigen::Isometry3d& _T0_w,
const Eigen::Matrix<double, 6, 2>& _Bw, const Eigen::Isometry3d& _Tw_e,
const double _satisfiableTolerance)
const double _testableTolerance)
: mT0_w(_T0_w)
, mBw(_Bw)
, mTw_e(_Tw_e)
, mSatisfiableTolerance(_satisfiableTolerance)
, mTestableTolerance(_testableTolerance)
, mRng(std::move(_rng))
, mStateSpace(std::make_shared<SE3>())
{
Expand All @@ -93,11 +93,11 @@ TSR::TSR(std::unique_ptr<util::RNG> _rng, const Eigen::Isometry3d& _T0_w,

//=============================================================================
TSR::TSR(const Eigen::Isometry3d& _T0_w, const Eigen::Matrix<double, 6, 2>& _Bw,
const Eigen::Isometry3d& _Tw_e, const double _satisfiableTolerance)
const Eigen::Isometry3d& _Tw_e, const double _testableTolerance)
: mT0_w(_T0_w)
, mBw(_Bw)
, mTw_e(_Tw_e)
, mSatisfiableTolerance(_satisfiableTolerance)
, mTestableTolerance(_testableTolerance)
, mRng(std::unique_ptr<util::RNG>(
new util::RNGWrapper<std::default_random_engine>(0)))
, mStateSpace(std::make_shared<SE3>())
Expand All @@ -110,7 +110,7 @@ TSR::TSR(const TSR& other)
: mT0_w(other.mT0_w)
, mBw(other.mBw)
, mTw_e(other.mTw_e)
, mSatisfiableTolerance(other.mSatisfiableTolerance)
, mTestableTolerance(other.mTestableTolerance)
, mRng(std::move(other.mRng->clone()))
, mStateSpace(std::make_shared<SE3>())
{
Expand All @@ -122,7 +122,7 @@ TSR::TSR(TSR&& other)
: mT0_w(other.mT0_w)
, mBw(other.mBw)
, mTw_e(other.mTw_e)
, mSatisfiableTolerance(other.mSatisfiableTolerance)
, mTestableTolerance(other.mTestableTolerance)
, mRng(std::move(other.mRng))
, mStateSpace(std::make_shared<SE3>())
{
Expand All @@ -136,7 +136,7 @@ TSR& TSR::operator=(const TSR& other)
mT0_w = other.mT0_w;
mBw = other.mBw;
mTw_e = other.mTw_e;
mSatisfiableTolerance = other.mSatisfiableTolerance;
mTestableTolerance = other.mTestableTolerance;
mRng = std::move(other.mRng->clone());

// Intentionally don't assign StateSpace.
Expand All @@ -150,7 +150,7 @@ TSR& TSR::operator=(TSR&& other)
mT0_w = std::move(other.mT0_w);
mBw = std::move(other.mBw);
mTw_e = std::move(other.mTw_e);
mSatisfiableTolerance = other.mSatisfiableTolerance;
mTestableTolerance = other.mTestableTolerance;
mRng = std::move(other.mRng);
mStateSpace = std::move(other.mStateSpace);

Expand Down Expand Up @@ -199,7 +199,7 @@ bool TSR::isSatisfied(const statespace::StateSpace::State* _s) const
{
Eigen::VectorXd dist;
getValue(_s, dist);
return dist.norm() < mSatisfiableTolerance;
return dist.norm() < mTestableTolerance;
}

//=============================================================================
Expand Down Expand Up @@ -416,15 +416,15 @@ bool TSRSampleGenerator::sample(statespace::StateSpace::State* _state)
}

//=============================================================================
double TSR::getSatisfiableTolerance()
double TSR::getTestableTolerance()
{
return mSatisfiableTolerance;
return mTestableTolerance;
}

//=============================================================================
void TSR::setSatisfiableTolerance(const double _satisfiableTolerance)
void TSR::setTestableTolerance(const double _testableTolerance)
{
mSatisfiableTolerance = _satisfiableTolerance;
mTestableTolerance = _testableTolerance;
}

//=============================================================================
Expand Down

0 comments on commit aa443dd

Please sign in to comment.