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

Code format: control #191

Merged
merged 72 commits into from
May 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
8feb924
Renaming, adding an abstract BarretHandPositionCommandExecutor class
gilwoolee Apr 12, 2017
811a63b
Adding -override
gilwoolee Apr 12, 2017
dd96c10
Merge branch 'master' into SimBarrettHandCommandExecutor
gilwoolee Apr 12, 2017
83f69dd
Exposing step
gilwoolee Apr 13, 2017
cf8f104
Merge branch 'SimBarrettHandCommandExecutor' of https://github.com/pe…
gilwoolee Apr 13, 2017
9d9fb3d
Renaiming PositionCommandExecutor
gilwoolee Apr 13, 2017
648c2bf
Changing header files
gilwoolee Apr 13, 2017
90a7ab6
Format statespace code
jslee02 Apr 13, 2017
a38c65a
Changing names and step function.
gilwoolee Apr 14, 2017
06dad13
Merge branch 'master' into SimBarrettHandCommandExecutor
gilwoolee Apr 14, 2017
012031d
Merge branch 'master' into style/statespace
jslee02 Apr 14, 2017
c6462db
Update simulation speed constants and matrix->vector methods.
brianhou Apr 14, 2017
e16880e
Add collisionDetector argument. Make collideWith an optional argument.
brianhou Apr 15, 2017
ce86f93
Don't reset mCollideWith every time.
brianhou Apr 15, 2017
c90cd8d
Simplify logic of optional collision detector and collision groups.
brianhou Apr 15, 2017
9347ffd
Merge branch 'master' into style/statespace
jslee02 Apr 15, 2017
2d3a5bc
Add ShapeFrames of original collision group to new collision group.
brianhou Apr 15, 2017
d9d36fc
Make collisionDetector, collideWith optional.
brianhou Apr 15, 2017
3af8671
Instantiate FingerPositionCommandExecutors and FingerSpreadCommandExe…
brianhou Apr 15, 2017
2174930
Clean up some documentation.
brianhou Apr 15, 2017
6ecb30e
Remove parameter from step.
brianhou Apr 15, 2017
c3eb6f3
Set mCollisionDetector when setting mCollideWith.
brianhou Apr 15, 2017
47a9852
Make FingerCommandExecutors implement PositionCommandExecutor.
brianhou Apr 15, 2017
bebb761
Swap argument order in HandPositionExecutor.
brianhou Apr 16, 2017
f1d805f
Partial test fixes.
brianhou Apr 16, 2017
56f1644
Rename RnTraits to RJointTraits
jslee02 Apr 16, 2017
0be9ae8
Yaml parser
gilwoolee Apr 16, 2017
fc7cd1c
Adding time-reset when a new execute command is given.
gilwoolee Apr 16, 2017
57e404f
Merge branch 'SimBarrettHandCommandExecutor' of https://github.com/pe…
gilwoolee Apr 16, 2017
7ec2fbd
Move eigen_yaml to util renaming to yaml_eigen_extension
jslee02 Apr 18, 2017
c6c12d9
Address Mike's comments -- still need docstrings
jslee02 Apr 18, 2017
4804ff2
Merge remote-tracking branch 'origin/master' into util/yaml_helper
jslee02 Apr 18, 2017
e74d236
Merge branch 'master' into style/statespace
jslee02 Apr 18, 2017
0a05e5a
Merge remote-tracking branch 'origin/master' into util/yaml_helper
jslee02 Apr 19, 2017
5a5cec9
Use find module for yaml-cpp instead of pkgconfig
jslee02 Apr 19, 2017
9053361
Remove meaningless test line
jslee02 Apr 19, 2017
1bd0c27
Fix style
jslee02 Apr 19, 2017
9ea12ef
Suppress warnings per GCC 6.3.0
jslee02 Apr 19, 2017
2fe83d4
Add yaml converter for std::unordered_map
jslee02 Apr 19, 2017
4f0a428
Add comment
jslee02 Apr 19, 2017
80d0be3
Rename deserialize to decode
jslee02 Apr 19, 2017
9d02314
Add comments
jslee02 Apr 19, 2017
1fe6f27
Add more comments
jslee02 Apr 19, 2017
a7d0f77
Rename yaml_eigen_extension to yaml_extension
jslee02 Apr 19, 2017
e4a5f43
Fix header including
jslee02 Apr 19, 2017
fcc093f
Merge branch 'master' into style/statespace
jslee02 Apr 19, 2017
3eb4b88
Rename test_yaml_eigen_extension to test_yaml_extension
jslee02 Apr 19, 2017
7a8f2c6
Fix typos in version.hpp.in
jslee02 Apr 21, 2017
e359fef
Use YAML::RepresentationException instead of std::exception
jslee02 Apr 21, 2017
c5ce755
Fix style
jslee02 Apr 21, 2017
e39ef72
Merge branch 'master' into util/yaml_helper
gilwoolee Apr 22, 2017
22e0ebb
Merge branch 'master' into style/statespace
jslee02 Apr 22, 2017
5e4b783
Use detail namespace instead of anonymous namespace
jslee02 Apr 22, 2017
5b39cb7
Make function inline-ed that is defined in header
jslee02 Apr 22, 2017
0ce929c
Merge branch 'master' into style/statespace
jslee02 Apr 22, 2017
9b437a9
Merge branch 'master' into util/yaml_helper
gilwoolee Apr 22, 2017
151b7e6
Add comment
jslee02 Apr 23, 2017
fe89b10
Merge branch 'master' into util/yaml_helper
mkoval Apr 23, 2017
1f7aba6
Renaming spin to step and removing template (#189)
gilwoolee Apr 23, 2017
4e5817b
Suppress warnings per gcc 5.4.0
jslee02 Apr 23, 2017
1ba78bf
Merge remote-tracking branch 'origin/util/yaml_helper' into style/con…
jslee02 Apr 23, 2017
b4aadcc
Update code style by clang-format-3.8
jslee02 Apr 23, 2017
7a0e8c0
Removing mspace from RosTrajectoryExecutor.
gilwoolee Apr 23, 2017
e4fc76f
Update code style by hand
jslee02 Apr 23, 2017
538877e
Merge remote-tracking branch 'origin/rosTrajExecutor' into style/control
jslee02 Apr 23, 2017
206163e
Fix style
jslee02 Apr 23, 2017
3125bf1
Merge branch 'master' into style/control
jslee02 Apr 23, 2017
b35d8eb
Fix style
jslee02 Apr 23, 2017
64516f4
Merge remote-tracking branch 'origin/master' into style/control
jslee02 Apr 27, 2017
b8e3916
Merge branch 'master' into style/control
jslee02 May 2, 2017
c25d192
Merge branch 'master' into style/control
jslee02 May 4, 2017
be3f0bc
Merge branch 'master' into style/control
jslee02 May 4, 2017
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ file(GLOB_RECURSE headers_planner "${CMAKE_SOURCE_DIR}/include/aikido/planner/*.
file(GLOB_RECURSE headers_util "${CMAKE_SOURCE_DIR}/include/aikido/util/*.hpp")
file(GLOB_RECURSE headers_rviz "${CMAKE_SOURCE_DIR}/include/aikido/rviz/*.hpp")
file(GLOB_RECURSE headers_distance "${CMAKE_SOURCE_DIR}/include/aikido/distance/*.hpp")
file(GLOB_RECURSE headers_distance "${CMAKE_SOURCE_DIR}/include/aikido/control/*.hpp")
format_add_sources(${headers_statespace})
format_add_sources(${headers_perception})
format_add_sources(${headers_planner})
format_add_sources(${headers_util})
format_add_sources(${headers_rviz})
format_add_sources(${headers_distance})
format_add_sources(${headers_control})

#==============================================================================
# Helper functions.
Expand Down
4 changes: 2 additions & 2 deletions include/aikido/constraint/CartesianProductTestable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CartesianProductTestable : public Testable
std::vector<TestablePtr> mConstraints;
};

} // namespace constraint
} // namespace aikido
} // namespace constraint
} // namespace aikido

#endif // define AIKIDO_CONSTRAINT_SAMPLEABLESUBSPACE_HPP_
4 changes: 2 additions & 2 deletions include/aikido/constraint/Differentiable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Differentiable

using DifferentiablePtr = std::shared_ptr<Differentiable>;

} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif
4 changes: 2 additions & 2 deletions include/aikido/constraint/DifferentiableIntersection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DifferentiableIntersection : public Differentiable
};


} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif
4 changes: 2 additions & 2 deletions include/aikido/constraint/DifferentiableSubspace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DifferentiableSubspace : public Differentiable
size_t mIndex;
};

} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif // AIKIDO_CONSTRAINT_DIFFERENTIABLESUBSPACE_HPP_
4 changes: 2 additions & 2 deletions include/aikido/constraint/FrameDifferentiable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FrameDifferentiable: public Differentiable
};


} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif
4 changes: 2 additions & 2 deletions include/aikido/constraint/FramePairDifferentiable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class FramePairDifferentiable: public Differentiable
};


} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif
5 changes: 2 additions & 3 deletions include/aikido/constraint/NewtonsMethodProjectable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ class NewtonsMethodProjectable : public Projectable
bool contains(const statespace::StateSpace::State* _s) const;
};


} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif
5 changes: 3 additions & 2 deletions include/aikido/constraint/NonColliding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class NonColliding : public Testable

using NonCollidingPtr = std::shared_ptr<NonColliding>;

} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif // AIKIDO_CONSTRAINT_NONCOLLIDING_HPP_
4 changes: 2 additions & 2 deletions include/aikido/constraint/Projectable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Projectable

using ProjectablePtr = std::shared_ptr<Projectable>;

} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif
4 changes: 2 additions & 2 deletions include/aikido/constraint/RejectionSampleable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RejectionSampleable : public Sampleable
int mMaxTrialPerSample;
};

} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif
4 changes: 2 additions & 2 deletions include/aikido/constraint/TSR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class TSR : public Sampleable,

using TSRPtr = std::shared_ptr<TSR>;

} // namespace constraint
} // namespace aikido
} // namespace constraint
} // namespace aikido

#endif // AIKIDO_CONSTRAINT_TSR_HPP_
4 changes: 2 additions & 2 deletions include/aikido/constraint/Testable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Testable

using TestablePtr = std::shared_ptr<Testable>;

} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif // AIKIDO_CONSTRAINT_TESTABLE_HPP_
4 changes: 2 additions & 2 deletions include/aikido/constraint/TestableIntersection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TestableIntersection : public Testable

using TestableIntersectionPtr = std::shared_ptr<TestableIntersection>;

} // constraint
} // aikido
} // namespace constraint
} // namespace aikido

#endif // AIKIDO_CONSTRAINT_TESTABLEINTERSECTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ bool RnBoxConstraintSampleGenerator<N>::sample(
{
Vectord value(mDistributions.size());

for (size_t i = 0; i < static_cast<std::size_t>(value.size()); ++i)
for (auto i = 0; i < value.size(); ++i)
value[i] = mDistributions[i](*mRng);

mSpace->setValue(static_cast<typename statespace::R<N>::State*>(_state), value);
Expand Down Expand Up @@ -184,7 +184,7 @@ bool RBoxConstraint<N>::isSatisfied(
const auto value = mSpace->getValue(
static_cast<const typename statespace::R<N>::State*>(state));

for (size_t i = 0; i < static_cast<std::size_t>(value.size()); ++i)
for (auto i = 0; i < value.size(); ++i)
{
if (value[i] < mLowerLimits[i] || value[i] > mUpperLimits[i])
return false;
Expand All @@ -201,7 +201,7 @@ bool RBoxConstraint<N>::project(
Vectord value = mSpace->getValue(
static_cast<const typename statespace::R<N>::State*>(_s));

for (size_t i = 0; i < static_cast<std::size_t>(value.size()); ++i)
for (auto i = 0; i < value.size(); ++i)
{
if (value[i] < mLowerLimits[i])
value[i] = mLowerLimits[i];
Expand Down Expand Up @@ -250,7 +250,7 @@ void RBoxConstraint<N>::getJacobian(
const size_t dimension = mSpace->getDimension();
_out = Eigen::MatrixXd::Zero(dimension, dimension);

for (size_t i = 0; i < static_cast<std::size_t>(_out.rows()); ++i)
for (auto i = 0; i < _out.rows(); ++i)
{
if (stateValue[i] < mLowerLimits[i])
_out(i, i) = -1.;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,52 @@
#ifndef AIKIDO_CONTROL_BARRETFINGERKINEMATICSIMULATIONPOSITIONCOMMANDEXECUTOR_HPP_
#define AIKIDO_CONTROL_BARRETFINGERKINEMATICSIMULATIONPOSITIONCOMMANDEXECUTOR_HPP_
#include <aikido/control/PositionCommandExecutor.hpp>

#include <chrono>
#include <condition_variable>
#include <future>
#include <mutex>
#include <dart/collision/CollisionDetector.hpp>
#include <dart/collision/CollisionOption.hpp>
#include <dart/collision/CollisionGroup.hpp>
#include <dart/collision/CollisionFilter.hpp>
#include <dart/collision/CollisionGroup.hpp>
#include <dart/collision/CollisionOption.hpp>
#include <dart/dynamics/dynamics.hpp>
#include <future>
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <aikido/control/PositionCommandExecutor.hpp>

namespace aikido {
namespace control {

/// This executor mimics the behavior of BarretFinger.
/// It moves a finger to a desired point; it may stop early if
/// joint limit is reached or collision is detected.
/// Only the proximal joint is actuated; the distal joint moves with mimic ratio.
/// Only the proximal joint is actuated; the distal joint moves with mimic
/// ratio.
/// When collision is detected on the distal link, the finger stops.
/// When collision is detected on the proximal link, the distal link moves
/// until it reaches joint limit or until distal collision is detected.
class BarrettFingerKinematicSimulationPositionCommandExecutor
: public PositionCommandExecutor
: public PositionCommandExecutor
{
public:
/// Constructor.
/// \param[in] finger Finger to be controlled by this Executor.
/// \param[in] proximal Index of proximal dof
/// \param[in] distal Index of distal dof
/// \param[in] collisionDetector CollisionDetector to check collision with fingers.
/// \param[in] collisionDetector CollisionDetector to check collision with
/// fingers.
/// If nullptr, default to FCLCollisionDetector.
/// \param[in] collideWith CollisionGroup to check collision with fingers.
/// If nullptr, default to empty CollisionGroup.
/// \param[in] collisionOptions Default is (enableContact=false, binaryCheck=true,
/// \param[in] collisionOptions Default is (enableContact=false,
/// binaryCheck=true,
/// maxNumContacts = 1.)
/// See dart/collison/Option.h for more information
BarrettFingerKinematicSimulationPositionCommandExecutor(
::dart::dynamics::ChainPtr finger, size_t proximal, size_t distal,
::dart::collision::CollisionDetectorPtr collisionDetector = nullptr,
::dart::collision::CollisionGroupPtr collideWith = nullptr,
::dart::collision::CollisionOption collisionOptions
::dart::dynamics::ChainPtr finger,
size_t proximal,
size_t distal,
::dart::collision::CollisionDetectorPtr collisionDetector = nullptr,
::dart::collision::CollisionGroupPtr collideWith = nullptr,
::dart::collision::CollisionOption collisionOptions
= ::dart::collision::CollisionOption(false, 1));

/// Open/close fingers to goal configuration.
Expand All @@ -55,7 +61,10 @@ class BarrettFingerKinematicSimulationPositionCommandExecutor
/// the proximal joint. The joint movements follow
/// this ratio only when both joints are moving.
/// \return mimic ratio.
constexpr static double getMimicRatio() { return kMimicRatio; }
constexpr static double getMimicRatio()
{
return kMimicRatio;
}

/// Moves the joints of the finger by dofVelocity*timeSincePreviousCall
/// until execute's goalPosition by primary dof or collision is detected.
Expand All @@ -75,7 +84,7 @@ class BarrettFingerKinematicSimulationPositionCommandExecutor
constexpr static double kMimicRatio = 0.333;
// TODO: read velocity limit from herb_description
constexpr static double kProximalSpeed = 2.0;
constexpr static double kDistalSpeed = kProximalSpeed*kMimicRatio;
constexpr static double kDistalSpeed = kProximalSpeed * kMimicRatio;

/// If (current dof - goalPosition) execution terminates.
constexpr static double kTolerance = 1e-3;
Expand Down Expand Up @@ -116,14 +125,12 @@ class BarrettFingerKinematicSimulationPositionCommandExecutor

/// Helper method for step() to set variables for terminating an execution.
void terminate();

};

using BarrettFingerKinematicSimulationPositionCommandExecutorPtr
= std::shared_ptr<BarrettFingerKinematicSimulationPositionCommandExecutor>;

= std::shared_ptr<BarrettFingerKinematicSimulationPositionCommandExecutor>;

} // control
} // aikido
} // namespace control
} // namespace aikido

#endif
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#ifndef AIKIDO_CONTROL_BARRETFINGERKINEMATICSIMULATIONSPREADCOMMANDEXECUTOR_HPP_
#define AIKIDO_CONTROL_BARRETFINGERKINEMATICSIMULATIONSPREADCOMMANDEXECUTOR_HPP_
#include <aikido/control/PositionCommandExecutor.hpp>

#include <chrono>
#include <condition_variable>
#include <future>
#include <mutex>
#include <dart/collision/CollisionDetector.hpp>
#include <dart/collision/CollisionOption.hpp>
#include <dart/collision/CollisionGroup.hpp>
#include <dart/collision/CollisionFilter.hpp>
#include <dart/collision/CollisionGroup.hpp>
#include <dart/collision/CollisionOption.hpp>
#include <dart/dynamics/dynamics.hpp>
#include <future>
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <aikido/control/PositionCommandExecutor.hpp>

namespace aikido {
namespace control {
Expand All @@ -18,23 +19,26 @@ namespace control {
/// It moves two finger spreads simultaneously to certain goal value;
/// it will stop prematurely if joint limit is reached or collision is detected.
class BarrettFingerKinematicSimulationSpreadCommandExecutor
: public PositionCommandExecutor
: public PositionCommandExecutor
{
public:
/// Constructor.
/// \param[in] fingers 2 fingers to be controlled by this Executor.
/// \param[in] spread Index of spread dof
/// \param[in] collisionDetector CollisionDetector to check collision with fingers.
/// \param[in] collisionDetector CollisionDetector to check collision with
/// fingers.
/// If nullptr, default to FCLCollisionDetector.
/// \param[in] collideWith CollisionGroup to check collision with fingers.
/// If nullptr, default to empty CollisionGroup
/// \param[in] collisionOptions Default is (enableContact=false, binaryCheck=true,
/// \param[in] collisionOptions Default is (enableContact=false,
/// binaryCheck=true,
/// maxNumContacts = 1.)
BarrettFingerKinematicSimulationSpreadCommandExecutor(
std::array<::dart::dynamics::ChainPtr, 2> fingers, size_t spread,
::dart::collision::CollisionDetectorPtr collisionDetector = nullptr,
::dart::collision::CollisionGroupPtr collideWith = nullptr,
::dart::collision::CollisionOption collisionOptions
std::array<::dart::dynamics::ChainPtr, 2> fingers,
size_t spread,
::dart::collision::CollisionDetectorPtr collisionDetector = nullptr,
::dart::collision::CollisionGroupPtr collideWith = nullptr,
::dart::collision::CollisionOption collisionOptions
= ::dart::collision::CollisionOption(false, 1));

/// Move the spread joint by goalPosition until goalPosition or
Expand Down Expand Up @@ -94,10 +98,10 @@ class BarrettFingerKinematicSimulationSpreadCommandExecutor
double mGoalPosition;
};

using BarrettFingerKinematicSimulationSpreadCommandExecutorPtr
= std::shared_ptr<BarrettFingerKinematicSimulationSpreadCommandExecutor>;
using BarrettFingerKinematicSimulationSpreadCommandExecutorPtr
= std::shared_ptr<BarrettFingerKinematicSimulationSpreadCommandExecutor>;

} // control
} // aikido
} // namespace control
} // namespace aikido

#endif
Loading