Skip to content

Commit

Permalink
Implemented MotionPlannerException
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSchneider42 committed Jun 4, 2024
1 parent 6ba3388 commit 2d351a6
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions include/franky/motion/waypoint_motion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@

namespace franky {

/**
* @brief Exception thrown if the motion planner fails.
*/
struct MotionPlannerException : public std::runtime_error {
using std::runtime_error::runtime_error;
};

/**
* @brief A waypoint with a target and optional parameters.
*
Expand Down Expand Up @@ -56,10 +63,10 @@ class WaypointMotion : public Motion<ControlSignalType> {
bool return_when_finished{true};
};

/**
* @param waypoints The waypoints to follow.
* @param params Parameters for the motion.
*/
/**
* @param waypoints The waypoints to follow.
* @param params Parameters for the motion.
*/
explicit WaypointMotion(std::vector<Waypoint<TargetType>> waypoints, Params params)
: waypoints_(std::move(waypoints)), params_(std::move(params)), prev_result_() {}

Expand Down Expand Up @@ -110,7 +117,7 @@ class WaypointMotion : public Motion<ControlSignalType> {
if (waypoint_iterator_ != waypoints_.end()) {
prev_result_ = trajectory_generator_.update(input_para_, output_para_);
if (prev_result_ == ruckig::Result::Error) {
throw std::runtime_error("Invalid inputs to motion planner.");
throw MotionPlannerException("Invalid inputs to motion planner.");
}
output_para_.pass_to_input(input_para_);
}
Expand Down

0 comments on commit 2d351a6

Please sign in to comment.