Reflex presents a key challenge when operating the Franka Research 3 robot.
What is a Reflex?
In my understanding, the word “reflex” is similar to human’s instant behavior. The “reflex” refers to a low-level, automatic, and rapid response to a sensory stimulus, very much like how your hand instantly pulling away from a hot stove without any thought.
When working with the Franka Research 3, I frequently encounter the error:
Move command aborted: motion aborted by reflex!
Reflex can be triggered by numerous conditions. For example:
/**
* True if an external joint motion generator exceeded velocity limits.
*/
const bool& joint_motion_generator_velocity_limits_violation;This indicates that a joint’s velocity bypass has exceeded its maximum allowable limit. For instance, if the maximum angular velocity of the 3rd joint is but you command it to move at , the safety system immediately aborts the motion.
Recovering from a Reflex
Prevent First
To avoid triggering reflex, ensure your motion commands always adhere to the robot’s velocity, acceleration, jerk, and torque limits. See this link.
When a reflex occurs and the robot enters an error state, there are 2 primary recovery approaches:
📌soft recovery (software-only)
A soft recovery can be performed entirely through code, without physical interaction with the robot. Here is the pattern I use:
std::unique_ptr<franka::Robot> robot = std::make_unique<franka::Robot>(robot_ip);
try {
// robot control logic here
} catch(const franka::Exception& e) {
robot.reset(); // destroy current object and release all resources via RAII
robot = std::make_unique<franka::Robot>(robot_ip); // establish fresh connection
robot->automaticErrorRecovery(); // clear error state
// resume operation...
}The key element is robot.reset(); which properly destroys the franka::Robot object by setting it as a null pointer and ensuring all resources are released through RAII before creating a clean connection. This prevents resource conflicts and communication jams.
📌hard recovery (physical intervention)
If soft recovery fails, for example the robot is in a kinematic singularity, hard recovery requires manual intervention. This typically involves physically moving the robot joints to a safe configuration before reinitializing the system.