Skip to content

Commit

Permalink
Added docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSchneider42 committed Jun 3, 2024
1 parent 7f141dc commit f9a883a
Show file tree
Hide file tree
Showing 4 changed files with 297 additions and 41 deletions.
20 changes: 20 additions & 0 deletions include/franky/joint_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,45 @@

namespace franky {

/**
* @brief Joint state of a robot.
*
* This class encapsulates the joint state of a robot, which comprises the joint positions and the joint velocities.
*/
class JointState {
public:
// Suppress implicit conversion warning
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-conversion"
/**
* @brief Construct a joint state with the given joint positions and zero velocities.
*
* @param position The joint positions.
*/
JointState(Vector7d position) : position_(std::move(position)), velocity_(Vector7d::Zero()) {}
#pragma clang diagnostic pop

/**
* @param position The joint positions.
* @param velocity The joint velocities.
*/
JointState(Vector7d position, Vector7d velocity)
: position_(std::move(position)), velocity_(std::move(velocity)) {}

JointState(const JointState &) = default;

JointState() = default;

/**
* @brief The position component of the state.
*/
[[nodiscard]] inline Vector7d position() const {
return position_;
}

/**
* @brief The velocity component of the state.
*/
[[nodiscard]] inline Vector7d velocity() const {
return velocity_;
}
Expand Down
43 changes: 41 additions & 2 deletions include/franky/relative_dynamics_factor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,69 @@

namespace franky {

/**
* @brief Relative dynamics factors
*
* This class encapsulates the relative dynamics factors, which are used to scale the maximum velocity, acceleration,
* and jerk of a trajectory.
*/
class RelativeDynamicsFactor {
public:
RelativeDynamicsFactor();;
/**
* @brief Default constructor which initializes all values to 1.0.
*/
RelativeDynamicsFactor();

// Suppress implicit conversion warning
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-conversion"
/**
* @brief Constructor which initializes all values to the given value.
*
* @param value The value to initialize all factors with. Must be in the range (0, 1].
*/
RelativeDynamicsFactor(double value);
#pragma clang diagnostic pop

RelativeDynamicsFactor(double velocity, double acceleration, double jerk);;
/**
* @param velocity The factor for the velocity. Must be in the range (0, 1].
* @param acceleration The factor for the acceleration. Must be in the range (0, 1].
* @param jerk The factor for the jerk. Must be in the range (0, 1].
*/
RelativeDynamicsFactor(double velocity, double acceleration, double jerk);

/**
* @brief Special factor which causes the maximum dynamics to be used, independent of other factors applied
* elsewhere.
*/
static inline RelativeDynamicsFactor MAX_DYNAMICS() {
return {1.0, 1.0, 1.0, true};
}

/**
* @brief Velocity factor.
*/
[[nodiscard]] inline double velocity() const {
return velocity_;
}

/**
* @brief Acceleration factor.
*/
[[nodiscard]] inline double acceleration() const {
return acceleration_;
}

/**
* @brief Jerk factor.
*/
[[nodiscard]] inline double jerk() const {
return jerk_;
}

/**
* @brief Whether the maximum dynamics should be used.
*/
[[nodiscard]] inline bool max_dynamics() const {
return max_dynamics_;
}
Expand Down
Loading

0 comments on commit f9a883a

Please sign in to comment.