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
31
32using namespace Eigen;
33
34namespace sas
35{
36
38{
39 // Examples from UR
40 //const std::string DEFAULT_ROBOT_IP = "192.168.56.101";
41 //const std::string SCRIPT_FILE = "resources/external_control.urscript";
42 //const std::string OUTPUT_RECIPE = "examples/resources/rtde_output_recipe.txt";
43 //const std::string INPUT_RECIPE = "examples/resources/rtde_input_recipe.txt";
44 //const std::string CALIBRATION_CHECKSUM = "calib_12788084448423163542";
45
46 std::string ip;
47 std::string script_file;
48 std::string output_recipe;
49 std::string input_recipe;
50 std::string calibration_checksum;
51 std::tuple<VectorXd,VectorXd> joint_limits;
52
53 bool turn_robot_off_on_connect = true;
54 bool turn_robot_off_on_disconnect = true;
55};
56
57class RobotDriverUR: public RobotDriver
58{
59private:
60 RobotDriverURConfiguration configuration_;
61 std::thread fri_thread_;
62
63 //Implementation details that depend on FRI source files.
64 class Impl;
65 std::unique_ptr<Impl> impl_;
66public:
67
68 RobotDriverUR(const RobotDriverUR&)=delete;
69 RobotDriverUR()=delete;
70 ~RobotDriverUR();
71
72 RobotDriverUR(const RobotDriverURConfiguration &configuration, std::atomic_bool* break_loops);
73
74 VectorXd get_joint_positions() override;
75 void set_target_joint_positions(const VectorXd& desired_joint_positions_rad) override;
76
77 VectorXd get_joint_velocities() override;
78 //void set_target_joint_velocities(const VectorXd& desired_joint_velocities_rads) override; //Not possible (yet?)
79
80 void connect() override;
81 void disconnect() override;
82
83 void initialize() override;
84 void deinitialize() override;
85
86};
87}
void initialize() override
Initialize the driver resources.
void disconnect() override
Disconnect from the underlying robot/hardware.
void connect() override
Connect to the underlying robot/hardware.
VectorXd get_joint_velocities() override
Get current joint velocities.
VectorXd get_joint_positions() override
Get current joint positions.
void deinitialize() override
Deinitialize the driver resources.
void set_target_joint_positions(const VectorXd &desired_joint_positions_rad) override
Set target joint positions.
Abstract RobotDriver interface and watchdog support.
Definition sas_robot_driver_ur.hpp:38