Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi-Armstrong committed May 28, 2024
1 parent 3d80638 commit b5c4e64
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ class NodesVariables;
/**
* @brief Base class to receive up-to-date values of the NodeVariables.
*
* This class registers with the node variables and everytime the positions or
* velocities of a node change, the subject updates this class by calling the
* UpdatePolynomials() method.
* This class registers with the node variables and everytime a node changes,
* the subject updates this class by calling the UpdatePolynomials() method.
*
* Used by spline.h
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,11 @@ class Var
Var(Var&&) = default;
Var& operator=(Var&&) = default;

Eigen::Index getIndex() const { return index_; }
Eigen::Index size() const { return length_; }
Eigen::Index getIndex() const;
Eigen::Index size() const;

void incrementIndex(Eigen::Index value) { index_ += value; }
void setVariables(const Eigen::Ref<const Eigen::VectorXd>& x)
{
assert(index_ > -1 && index_ < x.size());
assert(length_ > 0 && (index_ + length_) < x.size());
values_ = x.segment(index_, length_);
}
void incrementIndex(Eigen::Index value);
void setVariables(const Eigen::Ref<const Eigen::VectorXd>& x);

template <typename T>
const T& value() const
Expand Down
11 changes: 11 additions & 0 deletions trajopt_ifopt/trajopt/src/variable_sets/var.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@ Var::Var(Eigen::Index index, Eigen::Index length, std::string identifier, std::v
{
}

Eigen::Index Var::getIndex() const { return index_; }
Eigen::Index Var::size() const { return length_; }

void Var::incrementIndex(Eigen::Index value) { index_ += value; }
void Var::setVariables(const Eigen::Ref<const Eigen::VectorXd>& x)
{
assert(index_ > -1 && index_ < x.size());
assert(length_ > 0 && (index_ + length_) < x.size());
values_ = x.segment(index_, length_);
}

} // namespace trajopt_ifopt

0 comments on commit b5c4e64

Please sign in to comment.