From c402b5ea06357218931fef60631bcf44c9bbc60a Mon Sep 17 00:00:00 2001 From: Juan Date: Thu, 14 Nov 2024 21:08:20 +0000 Subject: [PATCH 1/7] Added the new abstract class DQ_CoppeliaSimInterface. --- CMakeLists.txt | 11 +++ .../coppeliasim/DQ_CoppeliaSimInterface.h | 70 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b9bb1a7 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,11 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.5) +PROJECT(dqrobotics-interface-coppeliasim) +set (CMAKE_CXX_STANDARD 14) + +################################################################ +# INSTALL HEADERS +################################################################ + +INSTALL(FILES + include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h + DESTINATION "include/dqrobotics/interfaces/coppeliasim") diff --git a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h new file mode 100644 index 0000000..9c32dda --- /dev/null +++ b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h @@ -0,0 +1,70 @@ +/** +(C) Copyright 2024 DQ Robotics Developers + +This file is part of DQ Robotics. + + DQ Robotics is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + DQ Robotics is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with DQ Robotics. If not, see . + +DQ Robotics website: dqrobotics.github.io + +Contributors: + + 1. Juan Jose Quiroz Omana (juanjose.quirozomana@manchester.ac.uk) + - Responsible for the original implementation. +*/ + +#include +#include + +using namespace Eigen; + +namespace DQ_robotics +{ +class DQ_CoppeliaSimInterface +{ +protected: + DQ_CoppeliaSimInterface() = default; +public: + virtual ~DQ_CoppeliaSimInterface() = default; + virtual bool connect(const std::string& host, const int& port, const int&TIMEOUT_IN_MILISECONDS) = 0; + virtual void set_stepping_mode(const bool& flag) = 0; + virtual void trigger_next_simulation_step() = 0; + virtual void start_simulation() = 0; + virtual void stop_simulation() = 0; + + virtual int get_object_handle(const std::string& objectname) = 0; + virtual std::vector get_object_handles(const std::vector& objectnames) = 0; + + virtual DQ get_object_translation(const std::string& objectname) = 0; + virtual void set_object_translation(const std::string& objectname, const DQ& t) = 0; + + virtual DQ get_object_rotation (const std::string& objectname) = 0; + virtual void set_object_rotation (const std::string& objectname, const DQ& r) = 0; + + virtual DQ get_object_pose (const std::string& objectname) = 0; + virtual void set_object_pose (const std::string& objectname, const DQ& h) = 0; + + virtual VectorXd get_joint_positions(const std::vector& jointnames) = 0; + virtual void set_joint_positions(const std::vector& jointnames, const VectorXd& joint_positions) = 0; + virtual void set_joint_target_positions(const std::vector& jointnames, const VectorXd& joint_target_positions) = 0; + + virtual VectorXd get_joint_velocities(const std::vector& jointnames) = 0; + virtual void set_joint_target_velocities(const std::vector& jointnames, const VectorXd& joint_target_velocities) = 0; + + virtual void set_joint_torques(const std::vector& jointnames, const VectorXd& torques) = 0; + virtual VectorXd get_joint_torques(const std::vector& jointnames) = 0; + +}; + +} From 1cbebf3c743bbaf921f3dbcb0d21dd59a8c3ee20 Mon Sep 17 00:00:00 2001 From: Juan Date: Sat, 16 Nov 2024 20:04:20 +0000 Subject: [PATCH 2/7] Updated the some virtual methods as const --- CMakeLists.txt | 4 ++-- .../interfaces/coppeliasim/DQ_CoppeliaSimInterface.h | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9bb1a7..63eea4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.5) +CMAKE_MINIMUM_REQUIRED(VERSION 3.1) PROJECT(dqrobotics-interface-coppeliasim) -set (CMAKE_CXX_STANDARD 14) +set (CMAKE_CXX_STANDARD 11) ################################################################ # INSTALL HEADERS diff --git a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h index 9c32dda..e7f8a81 100644 --- a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h +++ b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h @@ -38,10 +38,9 @@ class DQ_CoppeliaSimInterface public: virtual ~DQ_CoppeliaSimInterface() = default; virtual bool connect(const std::string& host, const int& port, const int&TIMEOUT_IN_MILISECONDS) = 0; - virtual void set_stepping_mode(const bool& flag) = 0; - virtual void trigger_next_simulation_step() = 0; - virtual void start_simulation() = 0; - virtual void stop_simulation() = 0; + virtual void trigger_next_simulation_step() const = 0; + virtual void start_simulation() const = 0; + virtual void stop_simulation() const = 0; virtual int get_object_handle(const std::string& objectname) = 0; virtual std::vector get_object_handles(const std::vector& objectnames) = 0; From 148d4f0aaec00637cc67d2f6067885dfc4d116e5 Mon Sep 17 00:00:00 2001 From: Juan Date: Sun, 17 Nov 2024 21:02:58 +0000 Subject: [PATCH 3/7] Updated the header --- .../interfaces/coppeliasim/DQ_CoppeliaSimInterface.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h index e7f8a81..b5d0f22 100644 --- a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h +++ b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h @@ -25,7 +25,8 @@ DQ Robotics website: dqrobotics.github.io */ #include -#include +#include +#include using namespace Eigen; From 9fccdc2b8508b4340b65a8ccc4cca1fecce9cdd5 Mon Sep 17 00:00:00 2001 From: Juan Date: Sun, 17 Nov 2024 22:49:43 +0000 Subject: [PATCH 4/7] Added the set_stepping_mode --- .../dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h index b5d0f22..2b08b45 100644 --- a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h +++ b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h @@ -40,6 +40,7 @@ class DQ_CoppeliaSimInterface virtual ~DQ_CoppeliaSimInterface() = default; virtual bool connect(const std::string& host, const int& port, const int&TIMEOUT_IN_MILISECONDS) = 0; virtual void trigger_next_simulation_step() const = 0; + virtual void set_stepping_mode(const bool& flag) const = 0; virtual void start_simulation() const = 0; virtual void stop_simulation() const = 0; From 624d0070fe64cd36657c0811aead8d4a17b22f39 Mon Sep 17 00:00:00 2001 From: Juan Date: Sun, 17 Nov 2024 23:01:53 +0000 Subject: [PATCH 5/7] Added the enum class REFERENCE --- .../interfaces/coppeliasim/DQ_CoppeliaSimInterface.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h index 2b08b45..3541106 100644 --- a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h +++ b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h @@ -34,9 +34,12 @@ namespace DQ_robotics { class DQ_CoppeliaSimInterface { -protected: - DQ_CoppeliaSimInterface() = default; public: + enum class REFERENCE + { + BODY_FRAME, + ABSOLUTE_FRAME + }; virtual ~DQ_CoppeliaSimInterface() = default; virtual bool connect(const std::string& host, const int& port, const int&TIMEOUT_IN_MILISECONDS) = 0; virtual void trigger_next_simulation_step() const = 0; @@ -66,6 +69,8 @@ class DQ_CoppeliaSimInterface virtual void set_joint_torques(const std::vector& jointnames, const VectorXd& torques) = 0; virtual VectorXd get_joint_torques(const std::vector& jointnames) = 0; +protected: + DQ_CoppeliaSimInterface() = default; }; } From 74a330819af87842fd29e4a20667ac539375a584 Mon Sep 17 00:00:00 2001 From: Juan Date: Mon, 18 Nov 2024 15:07:03 +0000 Subject: [PATCH 6/7] Removed the REFERENCE enum class --- .../interfaces/coppeliasim/DQ_CoppeliaSimInterface.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h index 3541106..178c478 100644 --- a/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h +++ b/include/dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterface.h @@ -23,7 +23,7 @@ DQ Robotics website: dqrobotics.github.io 1. Juan Jose Quiroz Omana (juanjose.quirozomana@manchester.ac.uk) - Responsible for the original implementation. */ - +#pragma once #include #include #include @@ -35,11 +35,6 @@ namespace DQ_robotics class DQ_CoppeliaSimInterface { public: - enum class REFERENCE - { - BODY_FRAME, - ABSOLUTE_FRAME - }; virtual ~DQ_CoppeliaSimInterface() = default; virtual bool connect(const std::string& host, const int& port, const int&TIMEOUT_IN_MILISECONDS) = 0; virtual void trigger_next_simulation_step() const = 0; From 50e7ca8b02815dbbf73a43d05ec5b9b1bdcb91fa Mon Sep 17 00:00:00 2001 From: Juan Date: Mon, 18 Nov 2024 20:05:24 +0000 Subject: [PATCH 7/7] updated the name of the project --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63eea4e..a47d5b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.1) -PROJECT(dqrobotics-interface-coppeliasim) +PROJECT(cpp-interface-coppeliasim) set (CMAKE_CXX_STANDARD 11) ################################################################