|
franky 1.1.2
A High-Level Motion API for Franka
|
Base class for motions. More...
#include <motion.hpp>
Public Types | |
| using | CallbackType = std::function< void(const RobotState &, franka::Duration, franka::Duration, franka::Duration, const ControlSignalType &)> |
Public Member Functions | |
| virtual | ~Motion ()=default |
| void | addReaction (std::shared_ptr< Reaction< ControlSignalType > > reaction) |
| Add a reaction to the motion. | |
| void | addReactionFront (std::shared_ptr< Reaction< ControlSignalType > > reaction) |
| Add a reaction to the front of the reaction list. | |
| std::vector< std::shared_ptr< Reaction< ControlSignalType > > > | reactions () |
| Currently registered reactions of the motion. | |
| void | registerCallback (CallbackType callback) |
| Register a callback that is called in every step of the motion. | |
| void | init (Robot *robot, const RobotState &robot_state, const std::optional< ControlSignalType > &previous_command) |
| Initialize the motion. | |
| ControlSignalType | nextCommand (const RobotState &robot_state, franka::Duration time_step, franka::Duration rel_time, franka::Duration abs_time, const std::optional< ControlSignalType > &previous_command) |
| Get the next command of the motion. | |
| std::shared_ptr< Motion< ControlSignalType > > | checkAndCallReactions (const RobotState &robot_state, franka::Duration rel_time, franka::Duration abs_time) |
| Check and call reactions. | |
Protected Member Functions | |
| Motion () | |
| virtual void | initImpl (const RobotState &robot_state, const std::optional< ControlSignalType > &previous_command) |
| virtual ControlSignalType | nextCommandImpl (const RobotState &robot_state, franka::Duration time_step, franka::Duration rel_time, franka::Duration abs_time, const std::optional< ControlSignalType > &previous_command)=0 |
| Robot * | robot () const |
Base class for motions.
| ControlSignalType | Control signal type of the motion. Either franka::Torques, franka::JointVelocities, franka::CartesianVelocities, franka::JointPositions or franka::CartesianPose. |
| using franky::Motion< ControlSignalType >::CallbackType = std::function<void( const RobotState &, franka::Duration, franka::Duration, franka::Duration, const ControlSignalType &)> |
|
virtualdefault |
|
explicitprotected |
| 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.
| reaction | The reaction to add. |
| 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.
| reaction | The reaction to add. |
| std::shared_ptr< Motion< ControlSignalType > > franky::Motion< ControlSignalType >::checkAndCallReactions | ( | const RobotState & | robot_state, |
| franka::Duration | rel_time, | ||
| franka::Duration | abs_time | ||
| ) |
Check and call reactions.
| robot_state | The current robot state. |
| rel_time | The relative time. |
| abs_time | The absolute time [s]. |
| void franky::Motion< ControlSignalType >::init | ( | Robot * | robot, |
| const RobotState & | robot_state, | ||
| const std::optional< ControlSignalType > & | previous_command | ||
| ) |
Initialize the motion.
| robot | The robot instance. |
| robot_state | The current robot state. |
| previous_command | The previous command. |
|
inlineprotectedvirtual |
Reimplemented in franky::WaypointMotion< ControlSignalType, WaypointType, TargetType >, franky::WaypointMotion< ControlSignalType, PositionWaypoint< TargetType >, TargetType >, franky::WaypointMotion< ControlSignalType, VelocityWaypoint< TargetType >, TargetType >, franky::CartesianImpedanceMotion, and franky::ImpedanceMotion.
| ControlSignalType franky::Motion< ControlSignalType >::nextCommand | ( | const RobotState & | robot_state, |
| franka::Duration | time_step, | ||
| franka::Duration | rel_time, | ||
| franka::Duration | abs_time, | ||
| const std::optional< ControlSignalType > & | previous_command | ||
| ) |
Get the next command of the motion.
| robot_state | The current robot state. |
| time_step | The time step [s]. |
| rel_time | The relative time. |
| abs_time | The absolute time [s]. |
| previous_command | The previous command. |
|
protectedpure virtual |
| std::vector< std::shared_ptr< Reaction< ControlSignalType > > > franky::Motion< ControlSignalType >::reactions | ( | ) |
Currently registered reactions of the motion.
| void franky::Motion< ControlSignalType >::registerCallback | ( | CallbackType | callback | ) |
Register a callback that is called in every step of the motion.
| callback | The 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. |
|
inlineprotected |