Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes franka::Error trivially copyable #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 44 additions & 41 deletions include/franka/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@ namespace franka {
*/
struct Errors {
private:
std::array<bool, 37> errors_{};
static constexpr int kMaxNumErrors = 37;
std::array<bool, kMaxNumErrors> errors_{};

public:
const std::array<bool, kMaxNumErrors>& errors() const { return errors_; }

/**
* Creates an empty Errors instance.
*/
Errors();
Errors() = default;

/**
* Copy constructs a new Errors instance.
*
* @param[in] other Other Errors instance.
*/
Errors(const Errors& other);
Errors(const Errors& other) = default;

/**
* Assigns this Errors instance from another Errors value.
Expand All @@ -39,7 +42,7 @@ struct Errors {
*
* @return Errors instance.
*/
Errors& operator=(Errors other);
Errors& operator=(const Errors& other) = default;

/**
* Creates a new Errors instance from the given array.
Expand Down Expand Up @@ -67,166 +70,166 @@ struct Errors {
/**
* True if the robot moved past the joint limits.
*/
const bool& joint_position_limits_violation;
const bool& joint_position_limits_violation() const;
/**
* True if the robot moved past any of the virtual walls.
*/
const bool& cartesian_position_limits_violation;
const bool& cartesian_position_limits_violation() const;
/**
* True if the robot would have collided with itself.
*/
const bool& self_collision_avoidance_violation;
const bool& self_collision_avoidance_violation() const;
/**
* True if the robot exceeded joint velocity limits.
*/
const bool& joint_velocity_violation;
const bool& joint_velocity_violation() const;
/**
* True if the robot exceeded Cartesian velocity limits.
*/
const bool& cartesian_velocity_violation;
const bool& cartesian_velocity_violation() const;
/**
* True if the robot exceeded safety threshold during force control.
*/
const bool& force_control_safety_violation;
const bool& force_control_safety_violation() const;
/**
* True if a collision was detected, i.e.\ the robot exceeded a torque threshold in a joint
* motion.
*/
const bool& joint_reflex;
const bool& joint_reflex() const;
/**
* True if a collision was detected, i.e.\ the robot exceeded a torque threshold in a Cartesian
* motion.
*/
const bool& cartesian_reflex;
const bool& cartesian_reflex() const;
/**
* True if internal motion generator did not reach the goal pose.
*/
const bool& max_goal_pose_deviation_violation;
const bool& max_goal_pose_deviation_violation() const;
/**
* True if internal motion generator deviated from the path.
*/
const bool& max_path_pose_deviation_violation;
const bool& max_path_pose_deviation_violation() const;
/**
* True if Cartesian velocity profile for internal motions was exceeded.
*/
const bool& cartesian_velocity_profile_safety_violation;
const bool& cartesian_velocity_profile_safety_violation() const;
/**
* True if an external joint position motion generator was started with a pose too far from the
* current pose.
*/
const bool& joint_position_motion_generator_start_pose_invalid;
const bool& joint_position_motion_generator_start_pose_invalid() const;
/**
* True if an external joint motion generator would move into a joint limit.
*/
const bool& joint_motion_generator_position_limits_violation;
const bool& joint_motion_generator_position_limits_violation() const;
/**
* True if an external joint motion generator exceeded velocity limits.
*/
const bool& joint_motion_generator_velocity_limits_violation;
const bool& joint_motion_generator_velocity_limits_violation() const;
/**
* True if commanded velocity in joint motion generators is discontinuous (target values are too
* far apart).
*/
const bool& joint_motion_generator_velocity_discontinuity;
const bool& joint_motion_generator_velocity_discontinuity() const;
/**
* True if commanded acceleration in joint motion generators is discontinuous (target values are
* too far apart).
*/
const bool& joint_motion_generator_acceleration_discontinuity;
const bool& joint_motion_generator_acceleration_discontinuity() const;
/**
* True if an external Cartesian position motion generator was started with a pose too far from
* the current pose.
*/
const bool& cartesian_position_motion_generator_start_pose_invalid;
const bool& cartesian_position_motion_generator_start_pose_invalid() const;
/**
* True if an external Cartesian motion generator would move into an elbow limit.
*/
const bool& cartesian_motion_generator_elbow_limit_violation;
const bool& cartesian_motion_generator_elbow_limit_violation() const;
/**
* True if an external Cartesian motion generator would move with too high velocity.
*/
const bool& cartesian_motion_generator_velocity_limits_violation;
const bool& cartesian_motion_generator_velocity_limits_violation() const;
/**
* True if commanded velocity in Cartesian motion generators is discontinuous (target values are
* too far apart).
*/
const bool& cartesian_motion_generator_velocity_discontinuity;
const bool& cartesian_motion_generator_velocity_discontinuity() const;
/**
* True if commanded acceleration in Cartesian motion generators is discontinuous (target values
* are too far apart).
*/
const bool& cartesian_motion_generator_acceleration_discontinuity;
const bool& cartesian_motion_generator_acceleration_discontinuity() const;
/**
* True if commanded elbow values in Cartesian motion generators are inconsistent.
*/
const bool& cartesian_motion_generator_elbow_sign_inconsistent;
const bool& cartesian_motion_generator_elbow_sign_inconsistent() const;
/**
* True if the first elbow value in Cartesian motion generators is too far from initial one.
*/
const bool& cartesian_motion_generator_start_elbow_invalid;
const bool& cartesian_motion_generator_start_elbow_invalid() const;
/**
* True if the joint position limits would be exceeded after IK calculation.
*/
const bool& cartesian_motion_generator_joint_position_limits_violation;
const bool& cartesian_motion_generator_joint_position_limits_violation() const;
/**
* True if the joint velocity limits would be exceeded after IK calculation.
*/
const bool& cartesian_motion_generator_joint_velocity_limits_violation;
const bool& cartesian_motion_generator_joint_velocity_limits_violation() const;
/**
* True if the joint velocity in Cartesian motion generators is discontinuous after IK
* calculation.
*/
const bool& cartesian_motion_generator_joint_velocity_discontinuity;
const bool& cartesian_motion_generator_joint_velocity_discontinuity() const;
/**
* True if the joint acceleration in Cartesian motion generators is discontinuous after IK
* calculation.
*/
const bool& cartesian_motion_generator_joint_acceleration_discontinuity;
const bool& cartesian_motion_generator_joint_acceleration_discontinuity() const;
/**
* True if the Cartesian pose is not a valid transformation matrix.
*/
const bool& cartesian_position_motion_generator_invalid_frame;
const bool& cartesian_position_motion_generator_invalid_frame() const;
/**
* True if desired force exceeds the safety thresholds.
*/
const bool& force_controller_desired_force_tolerance_violation;
const bool& force_controller_desired_force_tolerance_violation() const;
/**
* True if the torque set by the external controller is discontinuous.
*/
const bool& controller_torque_discontinuity;
const bool& controller_torque_discontinuity() const;
/**
* True if the start elbow sign was inconsistent.
*
* Applies only to motions started from Desk.
*/
const bool& start_elbow_sign_inconsistent;
const bool& start_elbow_sign_inconsistent() const;
/**
* True if minimum network communication quality could not be held during a motion.
*/
const bool& communication_constraints_violation;
const bool& communication_constraints_violation() const;
/**
* True if commanded values would result in exceeding the power limit.
*/
const bool& power_limit_violation;
const bool& power_limit_violation() const;
/**
* True if the robot is overloaded for the required motion.
*
* Applies only to motions started from Desk.
*/
const bool& joint_p2p_insufficient_torque_for_planning;
const bool& joint_p2p_insufficient_torque_for_planning() const;
/**
* True if the measured torque signal is out of the safe range.
*/
const bool& tau_j_range_violation;
const bool& tau_j_range_violation() const;
/**
* True if an instability is detected.
*/
const bool& instability_detected;
const bool& instability_detected() const;
/**
* True if the robot is in joint position limits violation error and the user guides the robot
* further towards the limit.
*/
const bool& joint_move_in_wrong_direction;
const bool& joint_move_in_wrong_direction() const;
};

/**
Expand Down
Loading