Franky  0.9.1
A High-Level Motion API for Franka
Public Member Functions | Static Public Attributes | List of all members
franky::MotionGenerator< ControlSignalType > Class Template Reference

Helper class for handling motions and reactions. More...

#include <motion_generator.hpp>

Public Member Functions

 MotionGenerator (Robot *robot, std::shared_ptr< Motion< ControlSignalType >> initial_motion)
 
ControlSignalType operator() (const franka::RobotState &robot_state, franka::Duration period)
 Update the motion generator and get the next control signal. More...
 
void registerUpdateCallback (const std::function< void(const franka::RobotState &, franka::Duration, double)> &callback)
 Register a callback that is called in every step of the motion. More...
 
void updateMotion (std::shared_ptr< Motion< ControlSignalType >> new_motion)
 Update the current motion. More...
 
bool has_new_motion ()
 Whether a new motion is available. More...
 
void resetTimeUnsafe ()
 Reset the time of the motion generator without locking the mutex. More...
 

Static Public Attributes

static constexpr size_t REACTION_RECURSION_LIMIT = 8
 Maximum recursion limit for reactions. After more than this number of reactions are fired in a single step, the motion generator will throw a ReactionRecursionException. More...
 

Detailed Description

template<typename ControlSignalType>
class franky::MotionGenerator< ControlSignalType >

Helper class for handling motions and reactions.

Constructor & Destructor Documentation

◆ MotionGenerator()

template<typename ControlSignalType >
franky::MotionGenerator< ControlSignalType >::MotionGenerator ( Robot robot,
std::shared_ptr< Motion< ControlSignalType >>  initial_motion 
)
explicit
Parameters
robotThe robot instance.
initial_motionThe initial motion.

Member Function Documentation

◆ has_new_motion()

template<typename ControlSignalType >
bool franky::MotionGenerator< ControlSignalType >::has_new_motion

Whether a new motion is available.

◆ operator()()

template<typename ControlSignalType >
ControlSignalType franky::MotionGenerator< ControlSignalType >::operator() ( const franka::RobotState &  robot_state,
franka::Duration  period 
)

Update the motion generator and get the next control signal.

Parameters
robot_stateThe current robot state.
periodThe time step.
Returns
The control signal for the robot.

◆ registerUpdateCallback()

template<typename ControlSignalType >
void franky::MotionGenerator< ControlSignalType >::registerUpdateCallback ( const std::function< void(const franka::RobotState &, franka::Duration, double)> &  callback)
inline

Register a callback that is called in every step of the motion.

Parameters
callbackThe callback to register. Callbacks are called with the robot state, the time step [s], the relative time [s] and the control signal computed in this step.

◆ resetTimeUnsafe()

template<typename ControlSignalType >
void franky::MotionGenerator< ControlSignalType >::resetTimeUnsafe

Reset the time of the motion generator without locking the mutex.

◆ updateMotion()

template<typename ControlSignalType >
void franky::MotionGenerator< ControlSignalType >::updateMotion ( std::shared_ptr< Motion< ControlSignalType >>  new_motion)

Update the current motion.

Parameters
new_motionThe new motion.

Member Data Documentation

◆ REACTION_RECURSION_LIMIT

template<typename ControlSignalType >
constexpr size_t franky::MotionGenerator< ControlSignalType >::REACTION_RECURSION_LIMIT = 8
staticconstexpr

Maximum recursion limit for reactions. After more than this number of reactions are fired in a single step, the motion generator will throw a ReactionRecursionException.


The documentation for this class was generated from the following files: