sas
Modularised monitoring, logging, and control of robots.
Toggle main menu visibility
Loading...
Searching...
No Matches
sas_robot_driver_coppeliasim.hpp
Go to the documentation of this file.
1
#pragma once
2
/*
3
# Copyright (c) 2016-2025 Murilo Marques Marinho
4
#
5
# This file is part of sas_robot_driver_coppeliasim.
6
#
7
# sas_robot_driver_coppeliasim 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_coppeliasim 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_coppeliasim. If not, see <https://www.gnu.org/licenses/>.
19
#
20
# ################################################################
21
#
22
# Author: Murilo M. Marinho, email: murilomarinho@ieee.org
23
# Based on `sas` ros composer.
24
#
25
# ################################################################*/
26
31
32
#include <atomic>
33
#include <memory>
34
35
#include <sas_core/sas_robot_driver.hpp>
36
37
#include <dqrobotics/interfaces/coppeliasim/DQ_CoppeliaSimInterfaceZMQ.h>
38
39
namespace
sas
40
{
41
45
struct
RobotDriverCoppeliaSimConfiguration
46
{
47
int
port
;
48
std::string
ip
;
49
int
timeout
= 1000;
50
std::vector<std::string>
robot_joint_names
;
51
};
52
56
class
RobotDriverCoppeliaSim :
public
RobotDriver
57
{
58
private
:
59
RobotDriverCoppeliaSimConfiguration
configuration_;
60
Eigen::VectorXd joint_positions_;
61
std::shared_ptr<DQ_CoppeliaSimInterfaceZMQ> csi_;
62
63
public
:
64
// Prevent copies as usually drivers have threads
65
RobotDriverCoppeliaSim(
const
RobotDriverCoppeliaSim&) =
delete
;
66
RobotDriverCoppeliaSim() =
delete
;
67
~RobotDriverCoppeliaSim();
68
74
RobotDriverCoppeliaSim(
const
RobotDriverCoppeliaSimConfiguration
& configuration,
75
const
std::shared_ptr<marinholab::sas::core::ShutdownSignaler>& shutdown_signaler);
76
81
Eigen::VectorXd
get_joint_positions
()
override
;
82
87
void
set_target_joint_positions
(
const
Eigen::VectorXd& desired_joint_positions_rad)
override
;
88
93
std::tuple<Eigen::VectorXd, Eigen::VectorXd>
get_joint_limits
()
override
;
94
98
void
connect
()
override
;
99
103
void
disconnect
()
override
;
104
108
void
initialize
()
override
;
109
113
void
deinitialize
()
override
;
114
};
115
}
// namespace sas
sas::RobotDriverCoppeliaSim::deinitialize
void deinitialize() override
Deinitializes the driver state.
Definition
sas_robot_driver_coppeliasim.cpp:97
sas::RobotDriverCoppeliaSim::get_joint_positions
Eigen::VectorXd get_joint_positions() override
Returns current joint positions in radians.
Definition
sas_robot_driver_coppeliasim.cpp:55
sas::RobotDriverCoppeliaSim::get_joint_limits
std::tuple< Eigen::VectorXd, Eigen::VectorXd > get_joint_limits() override
Returns joint position limits.
Definition
sas_robot_driver_coppeliasim.cpp:118
sas::RobotDriverCoppeliaSim::connect
void connect() override
Connects to the CoppeliaSim instance.
Definition
sas_robot_driver_coppeliasim.cpp:75
sas::RobotDriverCoppeliaSim::disconnect
void disconnect() override
Disconnects from the CoppeliaSim instance.
Definition
sas_robot_driver_coppeliasim.cpp:105
sas::RobotDriverCoppeliaSim::set_target_joint_positions
void set_target_joint_positions(const Eigen::VectorXd &desired_joint_positions_rad) override
Sets joint positions and target joint positions.
Definition
sas_robot_driver_coppeliasim.cpp:64
sas::RobotDriverCoppeliaSim::initialize
void initialize() override
Initializes the driver state.
Definition
sas_robot_driver_coppeliasim.cpp:89
sas::RobotDriverCoppeliaSimConfiguration
Configuration for RobotDriverCoppeliaSim.
Definition
sas_robot_driver_coppeliasim.hpp:46
sas::RobotDriverCoppeliaSimConfiguration::port
int port
ZMQ port number.
Definition
sas_robot_driver_coppeliasim.hpp:47
sas::RobotDriverCoppeliaSimConfiguration::ip
std::string ip
CoppeliaSim IP address.
Definition
sas_robot_driver_coppeliasim.hpp:48
sas::RobotDriverCoppeliaSimConfiguration::robot_joint_names
std::vector< std::string > robot_joint_names
Names of the joints to control.
Definition
sas_robot_driver_coppeliasim.hpp:50
sas::RobotDriverCoppeliaSimConfiguration::timeout
int timeout
Connection timeout in milliseconds.
Definition
sas_robot_driver_coppeliasim.hpp:49
src
sas_robot_driver_coppeliasim
include
sas_robot_driver_coppeliasim
sas_robot_driver_coppeliasim.hpp
Generated by
1.17.0