15#include <research_interface/robot/service_types.h>
16#include <franka/commands/get_robot_model_command.hpp>
26class ActiveControlBase;
92 explicit Robot(
const std::string& franka_address,
94 size_t log_size = 50);
181 bool limit_rate = false,
182 double cutoff_frequency = kDefaultCutoffFrequency);
211 bool limit_rate = false,
212 double cutoff_frequency = kDefaultCutoffFrequency);
241 bool limit_rate = false,
242 double cutoff_frequency = kDefaultCutoffFrequency);
271 bool limit_rate = false,
272 double cutoff_frequency = kDefaultCutoffFrequency);
300 motion_generator_callback,
301 bool limit_rate = false,
302 double cutoff_frequency = kDefaultCutoffFrequency);
329 bool limit_rate = false,
330 double cutoff_frequency = kDefaultCutoffFrequency);
357 bool limit_rate = false,
358 double cutoff_frequency = kDefaultCutoffFrequency);
385 bool limit_rate = false,
386 double cutoff_frequency = kDefaultCutoffFrequency);
411 motion_generator_callback,
413 bool limit_rate = false,
414 double cutoff_frequency = kDefaultCutoffFrequency);
527 const std::array<
double, 7>& upper_torque_thresholds_acceleration,
528 const std::array<
double, 7>& lower_torque_thresholds_nominal,
529 const std::array<
double, 7>& upper_torque_thresholds_nominal,
530 const std::array<
double, 6>& lower_force_thresholds_acceleration,
531 const std::array<
double, 6>& upper_force_thresholds_acceleration,
532 const std::array<
double, 6>& lower_force_thresholds_nominal,
533 const std::array<
double, 6>& upper_force_thresholds_nominal);
562 const std::array<
double, 7>& upper_torque_thresholds,
563 const std::array<
double, 6>& lower_force_thresholds,
564 const std::array<
double, 6>& upper_force_thresholds);
578 const std::array<
double, 7>& K_theta);
595 const std::array<
double, 6>& K_x);
625 void setK(const std::array<
double, 16>& EE_T_K);
642 void setEE(const std::array<
double, 16>& NE_T_EE);
661 const std::array<
double, 3>& F_x_Cload,
662 const std::array<
double, 9>& load_inertia);
701 const research_interface::robot::Move::
ControllerMode& control_type);
718 const research_interface::robot::Move::
ControllerMode& control_type,
719 const std::optional<std::vector<
double>>& maximum_velocities);
734 const research_interface::robot::Move::
ControllerMode& control_type);
749 const research_interface::robot::Move::
ControllerMode& control_type);
765 const research_interface::robot::Move::
ControllerMode& control_type);
815 Robot(std::shared_ptr<Impl> robot_impl);
837 template <typename MotionGeneratorType>
839 const research_interface::robot::Move::
ControllerMode& controller_type);
841 std::shared_ptr<Impl> impl_;
842 std::mutex control_mutex_;
858 template <typename MotionGeneratorType>
859 auto startAsyncControl(const research_interface::robot::Move::
ControllerMode& controller_type,
860 const std::optional<std::vector<
double>>& maximum_velocities)
Robot dynamic parameters computed from the URDF model with Pinocchio.
Definition robot_model_base.h:16
Allows the user to read the state of a Robot and to send new control commands after starting a contro...
Definition active_control_base.h:27
Stores values for Cartesian pose motion generation.
Definition control_types.h:127
Stores values for Cartesian velocity motion generation.
Definition control_types.h:211
Represents a duration with millisecond resolution.
Definition duration.h:19
Stores values for joint position motion generation.
Definition control_types.h:72
Stores values for joint velocity motion generation.
Definition control_types.h:99
Calculates poses of joints and dynamic properties of the robot.
Definition model.h:49
Maintains a network connection to the robot, provides the current robot state, gives access to the mo...
Definition robot.h:68
void control(std::function< Torques(const RobotState &, franka::Duration)> control_callback, bool limit_rate=false, double cutoff_frequency=kDefaultCutoffFrequency)
Starts a control loop for sending joint-level torque commands.
void setCollisionBehavior(const std::array< double, 7 > &lower_torque_thresholds_acceleration, const std::array< double, 7 > &upper_torque_thresholds_acceleration, const std::array< double, 7 > &lower_torque_thresholds_nominal, const std::array< double, 7 > &upper_torque_thresholds_nominal, const std::array< double, 6 > &lower_force_thresholds_acceleration, const std::array< double, 6 > &upper_force_thresholds_acceleration, const std::array< double, 6 > &lower_force_thresholds_nominal, const std::array< double, 6 > &upper_force_thresholds_nominal)
Changes the collision behavior.
Model loadModel()
Loads the model library from the robot.
Robot & operator=(Robot &&other) noexcept
Move-assigns this Robot from another Robot instance.
Robot(Robot &&other) noexcept
Move-constructs a new Robot instance.
auto getUpperJointVelocityLimits(const std::array< double, kNumJoints > &joint_positions) -> std::array< double, kNumJoints >
Computes upper limits for joint velocities based on current joint positions.
ServerVersion serverVersion() const noexcept
Returns the software version reported by the connected server.
virtual std::unique_ptr< ActiveControlBase > startJointPositionControl(const research_interface::robot::Move::ControllerMode &control_type)
Starts a new joint position motion generator.
auto getRobotModel() -> std::string
virtual std::unique_ptr< ActiveControlBase > startAsyncJointPositionControl(const research_interface::robot::Move::ControllerMode &control_type, const std::optional< std::vector< double > > &maximum_velocities)
Starts a new async joint position motion generator.
void stop()
Stops all currently running motions.
void setGuidingMode(const std::array< bool, 6 > &guiding_mode, bool elbow)
Locks or unlocks guiding mode movement in (x, y, z, roll, pitch, yaw).
void read(std::function< bool(const RobotState &)> read_callback)
Starts a loop for reading the current robot state.
virtual std::unique_ptr< ActiveControlBase > startCartesianVelocityControl(const research_interface::robot::Move::ControllerMode &control_type)
Starts a new cartesian velocity motion generator.
virtual std::unique_ptr< ActiveControlBase > startTorqueControl()
Starts a new torque controller.
void setJointImpedance(const std::array< double, 7 > &K_theta)
Sets the impedance for each joint in the internal controller.
virtual std::unique_ptr< ActiveControlBase > startCartesianPoseControl(const research_interface::robot::Move::ControllerMode &control_type)
Starts a new cartesian position motion generator.
virtual ~Robot() noexcept
Closes the connection.
void setCartesianImpedance(const std::array< double, 6 > &K_x)
Sets the Cartesian stiffness/compliance (for x, y, z, roll, pitch, yaw) in the internal controller.
void setK(const std::array< double, 16 > &EE_T_K)
Sets the transformation from end effector frame to stiffness frame.
uint16_t ServerVersion
Version of the robot server.
Definition robot.h:78
virtual std::unique_ptr< ActiveControlBase > startJointVelocityControl(const research_interface::robot::Move::ControllerMode &control_type)
Starts a new joint velocity motion generator.
virtual RobotState readOnce()
Waits for a robot state update and returns it.
Robot(const std::string &franka_address, RealtimeConfig realtime_config=RealtimeConfig::kEnforce, size_t log_size=50)
Establishes a connection with the robot.
void setEE(const std::array< double, 16 > &NE_T_EE)
Sets the transformation from nominal end effector to end effector frame.
static constexpr size_t kNumJoints
Number of joints of the robot.
Definition robot.h:73
void automaticErrorRecovery()
Runs automatic error recovery on the robot.
auto getLowerJointVelocityLimits(const std::array< double, kNumJoints > &joint_positions) -> std::array< double, kNumJoints >
Computes lower limits for joint velocities based on current joint positions.
void setLoad(double load_mass, const std::array< double, 3 > &F_x_Cload, const std::array< double, 9 > &load_inertia)
Sets dynamic parameters of a payload.
Stores joint-level torque commands without gravity and friction.
Definition control_types.h:45
Contains helper types for returning motion generation and joint-level torque commands.
ControllerMode
Available controller modes for a franka::Robot.
Definition control_types.h:19
RealtimeConfig
Used to decide whether to enforce realtime mode for a control loop thread.
Definition control_types.h:26
Contains the franka::Duration type.
Contains functions for filtering signals with a low-pass filter.
Abstract interface class for robot dynamic parameters computed from the URDF model with Pinocchio.
Contains the franka::RobotState types.
Describes the robot state.
Definition robot_state.h:34