Franky  0.9.1
A High-Level Motion API for Franka
Public Types | Public Member Functions | Protected Member Functions | List of all members
franky::Motion< ControlSignalType > Class Template Referenceabstract

Base class for motions. More...

#include <motion.hpp>

Inheritance diagram for franky::Motion< ControlSignalType >:
franky::WaypointMotion< ControlSignalType, TargetType >

Public Types

using CallbackType = std::function< void(const franka::RobotState &, franka::Duration, double, double, const ControlSignalType &)>
 

Public Member Functions

void addReaction (std::shared_ptr< Reaction< ControlSignalType >> reaction)
 Add a reaction to the motion. More...
 
void addReactionFront (std::shared_ptr< Reaction< ControlSignalType >> reaction)
 Add a reaction to the front of the reaction list. More...
 
std::vector< std::shared_ptr< Reaction< ControlSignalType > > > reactions ()
 Currently registered reactions of the motion. More...
 
void registerCallback (CallbackType callback)
 Register a callback that is called in every step of the motion. More...
 
void init (Robot *robot, const franka::RobotState &robot_state, const std::optional< ControlSignalType > &previous_command)
 Initialize the motion. More...
 
ControlSignalType nextCommand (const franka::RobotState &robot_state, franka::Duration time_step, double rel_time, double abs_time, const std::optional< ControlSignalType > &previous_command)
 Get the next command of the motion. More...
 
std::shared_ptr< Motion< ControlSignalType > > checkAndCallReactions (const franka::RobotState &robot_state, double rel_time, double abs_time)
 Check and call reactions. More...
 

Protected Member Functions

 Motion ()
 
virtual void initImpl (const franka::RobotState &robot_state, const std::optional< ControlSignalType > &previous_command)
 
virtual ControlSignalType nextCommandImpl (const franka::RobotState &robot_state, franka::Duration time_step, double rel_time, double abs_time, const std::optional< ControlSignalType > &previous_command)=0
 
Robotrobot () const
 

Detailed Description

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

Base class for motions.

Template Parameters
ControlSignalTypeControl signal type of the motion. Either franka::Torques, franka::JointVelocities, franka::CartesianVelocities, franka::JointPositions or franka::CartesianPose.

Member Typedef Documentation

◆ CallbackType

template<typename ControlSignalType >
using franky::Motion< ControlSignalType >::CallbackType = std::function< void(const franka::RobotState &, franka::Duration, double, double, const ControlSignalType &)>

Constructor & Destructor Documentation

◆ Motion()

template<typename ControlSignalType >
franky::Motion< ControlSignalType >::Motion
explicitprotected

Member Function Documentation

◆ addReaction()

template<typename ControlSignalType >
void franky::Motion< ControlSignalType >::addReaction ( std::shared_ptr< Reaction< ControlSignalType >>  reaction)

Add a reaction to the motion.

Reactions are evaluated in every step of the motion and can replace the current motion with a new motion.

Parameters
reactionThe reaction to add.

◆ addReactionFront()

template<typename ControlSignalType >
void franky::Motion< ControlSignalType >::addReactionFront ( std::shared_ptr< Reaction< ControlSignalType >>  reaction)

Add a reaction to the front of the reaction list.

Reactions are evaluated in every step of the motion and can replace the current motion with a new motion.

Parameters
reactionThe reaction to add.

◆ checkAndCallReactions()

template<typename ControlSignalType >
std::shared_ptr< Motion< ControlSignalType > > franky::Motion< ControlSignalType >::checkAndCallReactions ( const franka::RobotState &  robot_state,
double  rel_time,
double  abs_time 
)

Check and call reactions.

Parameters
robot_stateThe current robot state.
rel_timeThe relative time [s].
abs_timeThe absolute time [s].
Returns
The new motion if a reaction was triggered, nullptr otherwise.

◆ init()

template<typename ControlSignalType >
void franky::Motion< ControlSignalType >::init ( Robot robot,
const franka::RobotState &  robot_state,
const std::optional< ControlSignalType > &  previous_command 
)

Initialize the motion.

Parameters
robotThe robot instance.
robot_stateThe current robot state.
previous_commandThe previous command.

◆ initImpl()

template<typename ControlSignalType >
virtual void franky::Motion< ControlSignalType >::initImpl ( const franka::RobotState &  robot_state,
const std::optional< ControlSignalType > &  previous_command 
)
inlineprotectedvirtual

◆ nextCommand()

template<typename ControlSignalType >
ControlSignalType franky::Motion< ControlSignalType >::nextCommand ( const franka::RobotState &  robot_state,
franka::Duration  time_step,
double  rel_time,
double  abs_time,
const std::optional< ControlSignalType > &  previous_command 
)

Get the next command of the motion.

Parameters
robot_stateThe current robot state.
time_stepThe time step [s].
rel_timeThe relative time [s].
abs_timeThe absolute time [s].
previous_commandThe previous command.
Returns
The next control signal for libfranka.

◆ nextCommandImpl()

template<typename ControlSignalType >
virtual ControlSignalType franky::Motion< ControlSignalType >::nextCommandImpl ( const franka::RobotState &  robot_state,
franka::Duration  time_step,
double  rel_time,
double  abs_time,
const std::optional< ControlSignalType > &  previous_command 
)
protectedpure virtual

◆ reactions()

template<typename ControlSignalType >
std::vector< std::shared_ptr< Reaction< ControlSignalType > > > franky::Motion< ControlSignalType >::reactions

Currently registered reactions of the motion.

◆ registerCallback()

template<typename ControlSignalType >
void franky::Motion< ControlSignalType >::registerCallback ( CallbackType  callback)

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], the absolute time [s] and the control signal computed in this step.

◆ robot()

template<typename ControlSignalType >
Robot* franky::Motion< ControlSignalType >::robot ( ) const
inlineprotected

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