sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas_robot_driver_ur.hpp
1#pragma once
2/*
3# Copyright (c) 2016-2024 Murilo Marques Marinho
4#
5# This file is part of sas_robot_driver_kuka.
6#
7# sas_robot_driver_kuka is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Lesser General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# sas_robot_driver_kuka is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Lesser General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public License
18# along with sas_robot_driver_kuka. If not, see <https://www.gnu.org/licenses/>.
19#
20# ################################################################
21#
22# Author: Murilo M. Marinho, email: murilomarinho@ieee.org
23# Based on sas_robot_driver_denso.h
24#
25# ################################################################*/
26
27#include <atomic>
28#include <thread>
29
30#include <sas_core/sas_robot_driver.hpp>
31
32
33namespace sas
34{
35
37{
38 // Examples from UR
39 //const std::string DEFAULT_ROBOT_IP = "192.168.56.101";
40 //const std::string SCRIPT_FILE = "resources/external_control.urscript";
41 //const std::string OUTPUT_RECIPE = "examples/resources/rtde_output_recipe.txt";
42 //const std::string INPUT_RECIPE = "examples/resources/rtde_input_recipe.txt";
43 //const std::string CALIBRATION_CHECKSUM = "calib_12788084448423163542";
44
45 std::string ip;
46 std::string script_file;
47 std::string output_recipe;
48 std::string input_recipe;
49 std::string calibration_checksum;
50 std::tuple<Eigen::VectorXd,Eigen::VectorXd> joint_limits;
51
52 bool turn_robot_off_on_connect = true;
53 bool turn_robot_off_on_disconnect = true;
54};
55
56class RobotDriverUR: public RobotDriver
57{
58private:
59 RobotDriverURConfiguration configuration_;
60 std::thread fri_thread_;
61
62 //Implementation details that depend on FRI source files.
63 class Impl;
64 std::unique_ptr<Impl> impl_;
65public:
66
67 RobotDriverUR(const RobotDriverUR&)=delete;
68 RobotDriverUR()=delete;
69 ~RobotDriverUR();
70
71 RobotDriverUR(const RobotDriverURConfiguration &configuration, std::atomic_bool* break_loops);
72
73 Eigen::VectorXd get_joint_positions() override;
74 void set_target_joint_positions(const Eigen::VectorXd& desired_joint_positions_rad) override;
75
76 Eigen::VectorXd get_joint_velocities() override;
77 //void set_target_joint_velocities(const Eigen::VectorXd& desired_joint_velocities_rads) override; //Not possible (yet?)
78
83 Eigen::VectorXd get_tcp_force();
84
89 Eigen::VectorXd get_tcp_torque();
90
91 void connect() override;
92 void disconnect() override;
93
94 void initialize() override;
95 void deinitialize() override;
96
97};
98}
Eigen::VectorXd get_tcp_torque()
Get the current torque (moment) estimated at the TCP by the robot controller.
void initialize() override
Initialize the driver resources.
Eigen::VectorXd get_tcp_force()
Get the current force estimated at the TCP by the robot controller.
void disconnect() override
Disconnect from the underlying robot/hardware.
void connect() override
Connect to the underlying robot/hardware.
void set_target_joint_positions(const Eigen::VectorXd &desired_joint_positions_rad) override
Set target joint positions.
Eigen::VectorXd get_joint_velocities() override
Get current joint velocities.
Eigen::VectorXd get_joint_positions() override
Get current joint positions.
void deinitialize() override
Deinitialize the driver resources.
Definition sas_robot_driver_ur.hpp:37