-
Notifications
You must be signed in to change notification settings - Fork 30
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
Adding another kinodynamic timer #443
Changes from 16 commits
15afcfe
1a141c4
aaa4526
eb10f6a
0af3405
aa05d22
21c76ee
de10fd8
6cfa562
c2fb8e4
56cdff4
52262c0
d70bbe9
4513327
ce1d6b5
9994f9d
42d9402
af7936a
e3c3a77
fff7bde
1e221a0
aad12a1
7fcf90d
3292ac8
637dfde
079bbac
70175fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright (c) 2011-2018, The DART development contributors | ||
# All rights reserved. | ||
# | ||
# The list of contributors can be found at: | ||
# https://github.com/dartsim/dart/blob/master/LICENSE | ||
# | ||
# This file is provided under the "BSD-style" License | ||
|
||
# Find Eigen | ||
# | ||
# This sets the following variables: | ||
# EIGEN3_FOUND | ||
# EIGEN3_INCLUDE_DIRS | ||
# EIGEN3_VERSION | ||
|
||
find_package(PkgConfig QUIET) | ||
|
||
# Check to see if pkgconfig is installed. | ||
pkg_check_modules(PC_EIGEN3 eigen3 QUIET) | ||
|
||
# Include directories | ||
find_path(EIGEN3_INCLUDE_DIRS | ||
NAMES Eigen/Core | ||
PATHS "${CMAKE_INSTALL_PREFIX}/include" | ||
PATH_SUFFIXES eigen3 eigen) | ||
|
||
# Version | ||
set(EIGEN3_VERSION ${PC_EIGEN3_VERSION}) | ||
|
||
# Set (NAME)_FOUND if all the variables and the version are satisfied. | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(EIGEN3 | ||
FAIL_MESSAGE DEFAULT_MSG | ||
REQUIRED_VARS EIGEN3_INCLUDE_DIRS | ||
VERSION_VAR EIGEN3_VERSION) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
#ifndef AIKIDO_PLANNER_KINODYNAMIC_KINODYNAMICTIMER_HPP_ | ||
#define AIKIDO_PLANNER_KINODYNAMIC_KINODYNAMICTIMER_HPP_ | ||
|
||
#include <Eigen/Dense> | ||
#include "aikido/planner/TrajectoryPostProcessor.hpp" | ||
#include "aikido/trajectory/Interpolated.hpp" | ||
#include "aikido/trajectory/Spline.hpp" | ||
|
||
namespace aikido { | ||
namespace planner { | ||
namespace kinodynamic { | ||
|
||
/// Computes the time-optimal timing of a trajectory consisting of a sequence | ||
/// Geodesic interpolations between states under velocity and acceleration | ||
/// bounds. The output is a parabolic spline, encoded in cubic polynomials. | ||
/// It firstly preprocesses a non-differentiable path to a differentiable one | ||
/// by adding circular blends; and then \b exactly follows the preprocessed | ||
/// path. | ||
/// | ||
/// The output trajectory consists of a sequence of trapezoidal velocity | ||
/// profiles that implement bang-bang control. This function curently only | ||
/// supports \c RealVector, \c SO2, and compound state spaces of those types. | ||
/// Additionally, this function requires that \c inputTrajectory to be | ||
/// interpolated using a \c GeodesicInterpolator. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does the input trajectory need to have been interpolated using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is necessary. The interpolation implies the shape of a path given a sequence of waypoints. If you choose a different interpolator, the shape of a path will be different (length might also be changed). The timing algorithm works on the assumption of the geodesic interpolation. |
||
/// | ||
/// \param[in] inputTrajectory input piecewise Geodesic trajectory | ||
/// \param[in] maxVelocity maximum velocity for each dimension | ||
/// \param[in] maxAcceleration maximum acceleration for each dimension | ||
/// \param[in] maxDeviation maximum deviation from a waypoint in doing circular | ||
/// blending around the waypoint | ||
/// \param[in] timeStep time step in following the path | ||
/// \return time optimal trajectory that satisfies acceleration constraints | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: mention velocity constraints too? 🤔 |
||
std::unique_ptr<aikido::trajectory::Spline> computeKinodynamicTiming( | ||
const aikido::trajectory::Interpolated& inputTrajectory, | ||
const Eigen::VectorXd& maxVelocity, | ||
const Eigen::VectorXd& maxAcceleration, | ||
double maxDeviation = 1e-2, | ||
double timeStep = 0.1); | ||
|
||
/// Computes the time-optimal timing of a spline trajectory under velocity | ||
/// and acceleration bounds. The output is another parabolic spline, encoded | ||
/// in cubic polynomials. In retiming, the input trajectory is used as a | ||
/// piecewise Geodesic trajectory (only the geometry of the input trajectory | ||
/// is considered; and the velocity information is ignored. It firstly | ||
/// preprocesses a non-differentiable path to a differentiable one by adding | ||
/// circular blends; and then \b exactly follows the preprocessed path. | ||
/// | ||
/// The output trajectory consists of a sequence of trapezoidal velocity | ||
/// profiles that implement bang-bang control. This function curently only | ||
/// supports \c RealVector, \c SO2, and compound state spaces of those types. | ||
/// Additionally, this function requires that \c inputTrajectory to be | ||
/// a spline (only the geometry of the trajectory is considered in retiming). | ||
/// | ||
/// \param[in] inputTrajectory input piecewise Geodesic trajectory | ||
/// \param[in] maxVelocity maximum velocity for each dimension | ||
/// \param[in] maxAcceleration maximum acceleration for each dimension | ||
/// \param[in] maxDeviation maximum deviation from a waypoint in doing circular | ||
/// blending around the waypoint | ||
/// \param[in] timeStep time step in following the path | ||
/// \return time optimal trajectory that satisfies acceleration constraints | ||
std::unique_ptr<aikido::trajectory::Spline> computeKinodynamicTiming( | ||
const aikido::trajectory::Spline& inputTrajectory, | ||
const Eigen::VectorXd& maxVelocity, | ||
const Eigen::VectorXd& maxAcceleration, | ||
double maxDeviation = 1e-2, | ||
double timeStep = 0.1); | ||
|
||
/// Class for performing time-optimal trajectory retiming following subject to | ||
/// velocity and acceleration limits. | ||
class KinodynamicTimer : public aikido::planner::TrajectoryPostProcessor | ||
{ | ||
public: | ||
/// \param[in] velocityLimits Maximum velocity for each dimension. | ||
/// \param[in] accelerationLimits Maximum acceleration for each dimension. | ||
/// \param[in] maxDeviation Maximum deviation in circular blending | ||
/// \param[in] timeStep Time step in following the path | ||
KinodynamicTimer( | ||
const Eigen::VectorXd& velocityLimits, | ||
const Eigen::VectorXd& accelerationLimits, | ||
double maxDeviation, | ||
double timeStep); | ||
|
||
/// Performs parabolic retiming on an input trajectory. | ||
/// \copydoc TrajectoryPostProcessor::postprocess | ||
std::unique_ptr<aikido::trajectory::Spline> postprocess( | ||
const aikido::trajectory::Interpolated& inputTraj, | ||
const aikido::common::RNG& rng, | ||
const aikido::constraint::TestablePtr& constraint = nullptr) override; | ||
|
||
/// Performs parabolic retiming on an input *spline* trajectory. | ||
/// \copydoc TrajectoryPostProcessor::postprocess | ||
std::unique_ptr<aikido::trajectory::Spline> postprocess( | ||
const aikido::trajectory::Spline& inputTraj, | ||
const aikido::common::RNG& rng, | ||
const aikido::constraint::TestablePtr& constraint = nullptr) override; | ||
|
||
/// Returns the velocity limits of the dimensions | ||
const Eigen::VectorXd& getVelocityLimits() const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are all these getters and setters useful? I'm not sure if they're necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the getters are useful. For example, when we want to validate whether a timed trajectory violates the limits but only have the access to the timer handle. I prefer to keep the setters as well. It provides a way of adjusting timer parameters without reconstructing a new timer object. |
||
|
||
/// Returns the acceleration limits of the dimensions | ||
const Eigen::VectorXd& getAccelerationLimits() const; | ||
|
||
/// Sets the velocity limits of the dimensions | ||
void setVelocityLimits(const Eigen::VectorXd& velocityLimits); | ||
|
||
/// Sets the acceleration limits of the dimensions | ||
void setAccelerationLimits(const Eigen::VectorXd& accelerationLimits); | ||
|
||
/// Returns the time step in following a path | ||
double getTimeStep() const; | ||
|
||
/// Sets the time step in following a path | ||
void setTimeStep(double timeStep); | ||
|
||
/// Returns the max deviation of circular blending | ||
double getMaxDeviation() const; | ||
|
||
/// Sets the max deviation of circular blending | ||
void setMaxDeviation(double maxDeviation); | ||
|
||
private: | ||
/// Set to the value of \c velocityLimits. | ||
Eigen::VectorXd mVelocityLimits; | ||
|
||
/// Set to the value of \c accelerationLimits. | ||
Eigen::VectorXd mAccelerationLimits; | ||
|
||
/// Set to the value of \c maxDeviation | ||
double mMaxDeviation; | ||
|
||
/// Set to the value of \c timeStep | ||
double mTimeStep; | ||
}; | ||
|
||
} // namespace kinodynamic | ||
} // namespace planner | ||
} // namespace aikido | ||
|
||
#endif // ifndef AIKIDO_PLANNER_KINODYNAMIC_KINODYNAMICTIMER_HPP_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
find_package(EIGEN3 REQUIRED) | ||
|
||
add_library("${PROJECT_NAME}_external_optimaltimepathfollowing" STATIC | ||
Path.cpp | ||
Trajectory.cpp | ||
) | ||
|
||
target_include_directories("${PROJECT_NAME}_external_optimaltimepathfollowing" | ||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" | ||
${EIGEN3_INCLUDE_DIRS} | ||
) | ||
set_target_properties("${PROJECT_NAME}_external_optimaltimepathfollowing" | ||
PROPERTIES POSITION_INDEPENDENT_CODE TRUE | ||
) | ||
target_compile_options("${PROJECT_NAME}_external_optimaltimepathfollowing" | ||
PUBLIC ${AIKIDO_CXX_STANDARD_FLAGS} | ||
PRIVATE -w | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Added ~