Skip to content

Commit

Permalink
Fixed actual term number check being 1 more than stated number
Browse files Browse the repository at this point in the history
  • Loading branch information
marrts committed Jun 15, 2023
1 parent 4564e7f commit 70de004
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tesseract_motion_planners/trajopt/src/trajopt_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ trajopt::TermInfo::Ptr createCollisionTermInfo(int start_index,
trajopt::TermInfo::Ptr
createSmoothVelocityTermInfo(int start_index, int end_index, int n_joints, double coeff, trajopt::TermType type)
{
if ((end_index - start_index) < 2)
if ((end_index - start_index) < 1)
throw std::runtime_error("TrajOpt JointVelTermInfo requires at least two states!");

std::shared_ptr<trajopt::JointVelTermInfo> jv = std::make_shared<trajopt::JointVelTermInfo>();
Expand All @@ -208,7 +208,7 @@ trajopt::TermInfo::Ptr createSmoothVelocityTermInfo(int start_index,
const Eigen::Ref<const Eigen::VectorXd>& coeff,
trajopt::TermType type)
{
if ((end_index - start_index) < 2)
if ((end_index - start_index) < 1)
throw std::runtime_error("TrajOpt JointVelTermInfo requires at least two states!");

std::shared_ptr<trajopt::JointVelTermInfo> jv = std::make_shared<trajopt::JointVelTermInfo>();
Expand All @@ -224,7 +224,7 @@ trajopt::TermInfo::Ptr createSmoothVelocityTermInfo(int start_index,
trajopt::TermInfo::Ptr
createSmoothAccelerationTermInfo(int start_index, int end_index, int n_joints, double coeff, trajopt::TermType type)
{
if ((end_index - start_index) < 3)
if ((end_index - start_index) < 2)
throw std::runtime_error("TrajOpt JointAccTermInfo requires at least three states!");

std::shared_ptr<trajopt::JointAccTermInfo> ja = std::make_shared<trajopt::JointAccTermInfo>();
Expand All @@ -242,7 +242,7 @@ trajopt::TermInfo::Ptr createSmoothAccelerationTermInfo(int start_index,
const Eigen::Ref<const Eigen::VectorXd>& coeff,
trajopt::TermType type)
{
if ((end_index - start_index) < 3)
if ((end_index - start_index) < 2)
throw std::runtime_error("TrajOpt JointAccTermInfo requires at least three states!");

std::shared_ptr<trajopt::JointAccTermInfo> ja = std::make_shared<trajopt::JointAccTermInfo>();
Expand All @@ -258,7 +258,7 @@ trajopt::TermInfo::Ptr createSmoothAccelerationTermInfo(int start_index,
trajopt::TermInfo::Ptr
createSmoothJerkTermInfo(int start_index, int end_index, int n_joints, double coeff, trajopt::TermType type)
{
if ((end_index - start_index) < 5)
if ((end_index - start_index) < 4)
throw std::runtime_error("TrajOpt JointJerkTermInfo requires at least five states!");

std::shared_ptr<trajopt::JointJerkTermInfo> jj = std::make_shared<trajopt::JointJerkTermInfo>();
Expand All @@ -276,7 +276,7 @@ trajopt::TermInfo::Ptr createSmoothJerkTermInfo(int start_index,
const Eigen::Ref<const Eigen::VectorXd>& coeff,
trajopt::TermType type)
{
if ((end_index - start_index) < 5)
if ((end_index - start_index) < 4)
throw std::runtime_error("TrajOpt JointJerkTermInfo requires at least five states!");

std::shared_ptr<trajopt::JointJerkTermInfo> jj = std::make_shared<trajopt::JointJerkTermInfo>();
Expand Down

0 comments on commit 70de004

Please sign in to comment.