Skip to content

Commit

Permalink
Make normalizeVector private
Browse files Browse the repository at this point in the history
  • Loading branch information
DrDab committed Oct 3, 2023
1 parent 62a352a commit 73e01be
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/control/PlanarArmController.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,6 @@ template <unsigned int N> class PlanarArmController {
setpoint = normalizeVectorWithinRadius(newSetPoint, radius);
}

/**
* @brief Normalize the input vector to have a set radius,
* while maintaining the same direction it did before if it exceeds that set radius.
*
* @param input The input vector to normalize.
* @param radius The radius to normalize the vector to.
*/
Eigen::Vector2d normalizeVectorWithinRadius(Eigen::Vector2d input, double radius) {
if (input.norm() > radius) {
// TODO: will need to eventually shrink velocity vector until it is within radius
// instead of just normalizing it.

input.normalize();
input *= radius;
}

return input;
}

/**
* @brief Gets the current end effector setpoint / target position.
*
Expand Down Expand Up @@ -155,5 +136,24 @@ template <unsigned int N> class PlanarArmController {
Eigen::Vector2d velocity;
std::optional<robot::types::datatime_t> velTimestamp;
const double safetyFactor;

/**
* @brief Normalize the input vector to have a set radius,
* while maintaining the same direction it did before if it exceeds that set radius.
*
* @param input The input vector to normalize.
* @param radius The radius to normalize the vector to.
*/
Eigen::Vector2d normalizeVectorWithinRadius(Eigen::Vector2d input, double radius) {
if (input.norm() > radius) {
// TODO: will need to eventually shrink velocity vector until it is within radius
// instead of just normalizing it.

input.normalize();
input *= radius;
}

return input;
}
};
} // namespace control

0 comments on commit 73e01be

Please sign in to comment.