17 #include <franka_msgs/ErrorRecoveryAction.h> 72 bool checkForConflict(
const std::list<hardware_interface::ControllerInfo>& info)
const override;
96 std::string
getArmID()
const noexcept;
124 template <
typename T>
129 std::string error_message =
"FrankaCombinableHW: Got NaN value in command!";
131 throw std::invalid_argument(error_message);
140 T current_cmd = command;
155 double cutoff_frequency,
162 std::unique_ptr<actionlib::SimpleActionServer<franka_msgs::ErrorRecoveryAction>>
ServiceContainer services_
std::unique_ptr< actionlib::SimpleActionServer< franka_msgs::ErrorRecoveryAction > > recovery_action_server_
void initRobot() override
Uses the robot_ip_ to connect to the robot via libfranka and loads the libfranka model.
std::unique_ptr< std::thread > control_loop_thread_
void triggerError()
Triggers a stop of the controlLoop.
This class serves as container that gathers all possible service interfaces to a libfranka robot inst...
A hardware class for a Panda robot based on the ros_control framework.
std::string getArmID() const noexcept
Getter method for the arm_id which is used to distinguish between multiple instances of FrankaCombina...
void initROSInterfaces(ros::NodeHandle &robot_hw_nh) override
Initializes the class in terms of ros_control interfaces.
virtual void checkJointLimits()
Checks the proximity of each joint to its joint position limits and prints a warning whenever a joint...
T libfrankaUpdateCallback(const T &command, const franka::RobotState &robot_state, franka::Duration time_step)
bool setRunFunction(const ControlMode &requested_control_mode, bool limit_rate, double cutoff_frequency, franka::ControllerMode internal_controller) override
Configures the run function which is used as libfranka control callback based on the requested contro...
bool hasError() const noexcept
Getter for the error flag of the class.
void control(const std::function< bool(const ros::Time &, const ros::Duration &)> &ros_callback=[](const ros::Time &, const ros::Duration &){return true;}) const override
Runs the currently active controller in a realtime loop.
ros::Publisher has_error_pub_
std::atomic_bool controller_needs_reset_
void publishErrorState(bool error)
void read(const ros::Time &, const ros::Duration &) override
Reads data from the franka robot.
std::mutex libfranka_cmd_mutex_
franka::RobotState robot_state_libfranka_
void resetError()
Recovers the libfranka robot, resets the error flag and publishes the error state.
std::atomic_bool has_error_
void setupServicesAndActionServers(ros::NodeHandle &node_handle)
std::atomic_bool controller_active_
FrankaCombinableHW()
Creates an instance of FrankaCombinableHW.
void write(const ros::Time &, const ros::Duration &period) override
Writes data to the franka robot.
bool checkForConflict(const std::list< hardware_interface::ControllerInfo > &info) const override
Checks whether a requested controller can be run, based on the resources and interfaces it claims...
This class wraps the functionality of libfranka for controlling Panda robots into the ros_control fra...
bool controllerNeedsReset() const noexcept
Returns whether the controller needs to be reset e.g.
Torques MotionFinished(Torques command) noexcept
std::mutex libfranka_state_mutex_
std::atomic_bool error_recovered_
static bool commandHasNaN(const franka::Torques &command)
Checks a command for NaN values.