14#include <research_interface/robot/service_types.h>
15#include <franka/commands/get_robot_model_command.hpp>
25class ActiveControlBase;
91 explicit Robot(
const std::string& franka_address,
93 size_t log_size = 50);
180 bool limit_rate = false,
181 double cutoff_frequency = kDefaultCutoffFrequency);
210 bool limit_rate = false,
211 double cutoff_frequency = kDefaultCutoffFrequency);
240 bool limit_rate = false,
241 double cutoff_frequency = kDefaultCutoffFrequency);
270 bool limit_rate = false,
271 double cutoff_frequency = kDefaultCutoffFrequency);
299 motion_generator_callback,
300 bool limit_rate = false,
301 double cutoff_frequency = kDefaultCutoffFrequency);
328 bool limit_rate = false,
329 double cutoff_frequency = kDefaultCutoffFrequency);
356 bool limit_rate = false,
357 double cutoff_frequency = kDefaultCutoffFrequency);
384 bool limit_rate = false,
385 double cutoff_frequency = kDefaultCutoffFrequency);
410 motion_generator_callback,
412 bool limit_rate = false,
413 double cutoff_frequency = kDefaultCutoffFrequency);
559 const std::array<
double, 7>& upper_torque_thresholds_acceleration,
560 const std::array<
double, 7>& lower_torque_thresholds_nominal,
561 const std::array<
double, 7>& upper_torque_thresholds_nominal,
562 const std::array<
double, 6>& lower_force_thresholds_acceleration,
563 const std::array<
double, 6>& upper_force_thresholds_acceleration,
564 const std::array<
double, 6>& lower_force_thresholds_nominal,
565 const std::array<
double, 6>& upper_force_thresholds_nominal);
600 const std::array<
double, 7>& upper_torque_thresholds,
601 const std::array<
double, 6>& lower_force_thresholds,
602 const std::array<
double, 6>& upper_force_thresholds);
616 const std::array<
double, 7>& K_theta);
633 const std::array<
double, 6>& K_x);
663 void setK(const std::array<
double, 16>& EE_T_K);
680 void setEE(const std::array<
double, 16>& NE_T_EE);
699 const std::array<
double, 3>& F_x_Cload,
700 const std::array<
double, 9>& load_inertia);
739 const research_interface::robot::Move::
ControllerMode& control_type);
756 const research_interface::robot::Move::
ControllerMode& control_type,
757 const std::optional<std::vector<
double>>& maximum_velocities);
772 const research_interface::robot::Move::
ControllerMode& control_type);
787 const research_interface::robot::Move::
ControllerMode& control_type);
803 const research_interface::robot::Move::
ControllerMode& control_type);
864 Robot(std::shared_ptr<Impl> robot_impl);
886 template <typename MotionGeneratorType>
888 const research_interface::robot::Move::
ControllerMode& controller_type);
890 std::shared_ptr<Impl> impl_;
891 std::mutex control_mutex_;
907 template <typename MotionGeneratorType>
908 auto startAsyncControl(const research_interface::robot::Move::
ControllerMode& controller_type,
909 const std::optional<std::vector<
double>>& maximum_velocities)
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:130
Stores values for Cartesian velocity motion generation.
Definition control_types.h:214
Represents a duration with millisecond resolution.
Definition duration.h:19
Stores values for joint position motion generation.
Definition control_types.h:75
Stores values for joint velocity motion generation.
Definition control_types.h:102
Calculates poses of joints and dynamic properties of the robot.
Definition model.h:50
Maintains a network connection to the robot, provides the current robot state, gives access to the mo...
Definition robot.h:67
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)
Configures the contact and collision detection thresholds.
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.
bool isMobileRobot() const noexcept
Returns whether the connected robot is a mobile robot (TMR).
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:77
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:72
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:48
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:29
Contains the franka::Duration type.
Contains functions for filtering signals with a low-pass filter.
Contains the franka::RobotState types.
Describes the robot state.
Definition robot_state.h:34