Franky 0.12.0
A High-Level Motion API for Franka
|
A reaction that can be attached to a motion. More...
#include <reaction.hpp>
Public Member Functions | |
Reaction (const Condition &condition, std::shared_ptr< Motion< ControlSignalType > > new_motion=nullptr) | |
Reaction (Condition condition, const MotionFunc &motion_func) | |
std::shared_ptr< Motion< ControlSignalType > > | operator() (const RobotState &robot_state, franka::Duration rel_time, franka::Duration abs_time) |
Get the new motion if the condition is met. | |
bool | condition (const RobotState &robot_state, franka::Duration rel_time, franka::Duration abs_time) const |
Check if the condition is met. | |
void | registerCallback (const std::function< void(const RobotState &, franka::Duration, franka::Duration)> &callback) |
Register a callback that is called when the condition of this reaction is met. | |
A reaction that can be attached to a motion.
This class defines a reaction in a motion, which can be used to change the motion based on the robot state. Reactions consist of a condition and a motion that replaces the current motion immediately if the condition is met.
|
explicit |
condition | The condition that must be met for the reaction to be executed. |
new_motion | The motion that is executed if the condition is met. |
|
explicit |
condition | The condition that must be met for the reaction to be executed. |
motion_func | A function that returns a motion that is executed if the condition is met. |
|
inline |
Check if the condition is met.
robot_state | The current robot state. |
rel_time | The time since the start of the current motion. |
abs_time | The time since the start of the current chain of motions. This value measures the time since the robot started moving, and is only reset if a motion expires without being replaced by a new motion. |
std::shared_ptr< Motion< ControlSignalType > > franky::Reaction< ControlSignalType >::operator() | ( | const RobotState & | robot_state, |
franka::Duration | rel_time, | ||
franka::Duration | abs_time | ||
) |
Get the new motion if the condition is met.
robot_state | The current robot state. |
rel_time | The time since the start of the current motion. |
abs_time | The time since the start of the current chain of motions. This value measures the time since the robot started moving, and is only reset if a motion expires without being replaced by a new motion. |
void franky::Reaction< ControlSignalType >::registerCallback | ( | const std::function< void(const RobotState &, franka::Duration, franka::Duration)> & | callback | ) |
Register a callback that is called when the condition of this reaction is met.
callback | The callback to register. Callbacks are called with the robot state, the relative time [s] and the absolute time [s]. |