sas
Modularised monitoring, logging, and control of robots.
Toggle main menu visibility
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 <memory>
28
#include <thread>
29
30
#include <sas_core/sas_robot_driver.hpp>
31
#include <
marinholab/sas/core/sas_shutdown_signaler.hpp
>
32
33
namespace
sas
34
{
35
36
struct
RobotDriverURConfiguration
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
// When true, the driver only streams joint feedback (RTDE): no dashboard
56
// commands (stop/power on/power off/brake release) are sent and the external
57
// control program is not started, so the teach pendant keeps full control
58
// (e.g. free-drive) while the driver reads joint states.
59
bool
monitoring_mode =
false
;
60
};
61
62
class
RobotDriverUR :
public
RobotDriver
63
{
64
private
:
65
RobotDriverURConfiguration
configuration_;
66
std::thread fri_thread_;
67
68
//Implementation details that depend on FRI source files.
69
class
Impl;
70
std::unique_ptr<Impl> impl_;
71
72
public
:
73
RobotDriverUR(
const
RobotDriverUR&) =
delete
;
74
RobotDriverUR() =
delete
;
75
~RobotDriverUR();
76
77
RobotDriverUR(
const
RobotDriverURConfiguration
& configuration,
78
const
std::shared_ptr<marinholab::sas::core::ShutdownSignaler>& shutdown_signaler);
79
80
Eigen::VectorXd
get_joint_positions
()
override
;
81
void
set_target_joint_positions
(
const
Eigen::VectorXd& desired_joint_positions_rad)
override
;
82
83
Eigen::VectorXd
get_joint_velocities
()
override
;
84
//void set_target_joint_velocities(const Eigen::VectorXd& desired_joint_velocities_rads) override; //Not possible (yet?)
85
92
Eigen::VectorXd
get_joint_torques
()
override
;
93
98
Eigen::VectorXd
get_tcp_force
();
99
104
Eigen::VectorXd
get_tcp_torque
();
105
106
void
connect
()
override
;
107
void
disconnect
()
override
;
108
109
void
initialize
()
override
;
110
void
deinitialize
()
override
;
111
};
112
}
// namespace sas
sas::RobotDriverUR::get_tcp_torque
Eigen::VectorXd get_tcp_torque()
Get the current torque (moment) estimated at the TCP by the robot controller.
sas::RobotDriverUR::initialize
void initialize() override
Initialize the driver resources.
sas::RobotDriverUR::get_tcp_force
Eigen::VectorXd get_tcp_force()
Get the current force estimated at the TCP by the robot controller.
sas::RobotDriverUR::disconnect
void disconnect() override
Disconnect from the underlying robot/hardware.
sas::RobotDriverUR::connect
void connect() override
Connect to the underlying robot/hardware.
sas::RobotDriverUR::set_target_joint_positions
void set_target_joint_positions(const Eigen::VectorXd &desired_joint_positions_rad) override
Set target joint positions.
sas::RobotDriverUR::get_joint_velocities
Eigen::VectorXd get_joint_velocities() override
Get current joint velocities.
sas::RobotDriverUR::get_joint_torques
Eigen::VectorXd get_joint_torques() override
Get the joint torques estimated by the robot controller (RTDE actual_current_as_torque).
sas::RobotDriverUR::get_joint_positions
Eigen::VectorXd get_joint_positions() override
Get current joint positions.
sas::RobotDriverUR::deinitialize
void deinitialize() override
Deinitialize the driver resources.
sas_shutdown_signaler.hpp
Cross-module shutdown signaling class.
sas::RobotDriverURConfiguration
Definition
sas_robot_driver_ur.hpp:37
src
sas_robot_driver_ur
include
sas_robot_driver_ur
sas_robot_driver_ur.hpp
Generated by
1.17.0