Franky
0.9.1
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 franka::RobotState &robot_state, double rel_time, double abs_time) |
Get the new motion if the condition is met. More... | |
bool | condition (const franka::RobotState &robot_state, double rel_time, double abs_time) const |
Check if the condition is met. More... | |
void | registerCallback (std::function< void(const franka::RobotState &, double, double)> callback) |
Register a callback that is called when the condition of this reaction is met. More... | |
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 franka::RobotState & | robot_state, |
double | rel_time, | ||
double | 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 | ( | std::function< void(const franka::RobotState &, double, double)> | 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]. |