13 template<
typename ControlSignalType>
21 template<
typename ControlSignalType>
25 void(
const franka::RobotState &, franka::Duration,
double,
double,
const ControlSignalType &)>;
46 std::vector<std::shared_ptr<Reaction<ControlSignalType>>>
reactions();
62 Robot *
robot,
const franka::RobotState &robot_state,
const std::optional<ControlSignalType> &previous_command);
75 const franka::RobotState &robot_state,
76 franka::Duration time_step,
79 const std::optional<ControlSignalType> &previous_command);
88 std::shared_ptr<Motion<ControlSignalType>>
95 const franka::RobotState &robot_state,
const std::optional<ControlSignalType> &previous_command) {}
99 const franka::RobotState &robot_state,
100 franka::Duration time_step,
103 const std::optional<ControlSignalType> &previous_command) = 0;
110 std::mutex reaction_mutex_;
111 std::list<std::shared_ptr<Reaction<ControlSignalType>>> reactions_;
112 std::mutex callback_mutex_;
113 std::vector<CallbackType> callbacks_;
Base class for motions.
Definition: motion.hpp:22
void addReactionFront(std::shared_ptr< Reaction< ControlSignalType >> reaction)
Add a reaction to the front of the reaction list.
Definition: motion.cpp:32
void registerCallback(CallbackType callback)
Register a callback that is called in every step of the motion.
Definition: motion.cpp:20
virtual void initImpl(const franka::RobotState &robot_state, const std::optional< ControlSignalType > &previous_command)
Definition: motion.hpp:94
Robot * robot() const
Definition: motion.hpp:105
void init(Robot *robot, const franka::RobotState &robot_state, const std::optional< ControlSignalType > &previous_command)
Initialize the motion.
Definition: motion.cpp:44
std::function< void(const franka::RobotState &, franka::Duration, double, double, const ControlSignalType &)> CallbackType
Definition: motion.hpp:25
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.
Definition: motion.cpp:52
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
Motion()
Definition: motion.cpp:17
std::shared_ptr< Motion< ControlSignalType > > checkAndCallReactions(const franka::RobotState &robot_state, double rel_time, double abs_time)
Check and call reactions.
Definition: motion.cpp:66
void addReaction(std::shared_ptr< Reaction< ControlSignalType >> reaction)
Add a reaction to the motion.
Definition: motion.cpp:26
std::vector< std::shared_ptr< Reaction< ControlSignalType > > > reactions()
Currently registered reactions of the motion.
Definition: motion.cpp:38
A reaction that can be attached to a motion.
Definition: reaction.hpp:25
A class representing a Franka robot.
Definition: robot.hpp:45
Definition: gripper.cpp:3
ControlSignalType
Type of control signal.
Definition: control_signal_type.hpp:8