staubli_driver_ros2 main
ROS2 control driver for Staubli robots
Loading...
Searching...
No Matches
mock_robot_server.hpp
Go to the documentation of this file.
1// Copyright 2025 ICUBE Laboratory, University of Strasbourg
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Author: Thibault Poignonec (thibault.poignonec@gmail.fr)
16
17
18#ifndef STAUBLI_ROBOT_DRIVER__MOCK_ROBOT_SERVER_HPP_
19#define STAUBLI_ROBOT_DRIVER__MOCK_ROBOT_SERVER_HPP_
20
21// C++
22#include <atomic>
23#include <chrono>
24#include <condition_variable>
25#include <memory>
26#include <mutex>
27#include <string>
28#include <vector>
29
30// Staubli Robot Driver
34#include "rclcpp/rclcpp.hpp"
35
36namespace staubli_robot_driver {
37
45public:
59
60public:
65
70
71
77 bool init(const NetworkConfig& config);
78
83 bool is_ready() const;
84
89 bool disconnect();
90
98
105
113
114private:
115 // Logger
116 rclcpp::Logger logger_;
117
118 // Sockets
119 NetworkConfig network_config_;
120 std::shared_ptr<Socket> control_socket_;
121 std::shared_ptr<Socket> diagnostics_socket_;
122
123 // Communication interfaces
124 std::shared_ptr<
126};
127
128} // namespace staubli_robot_driver
129
130#endif // STAUBLI_ROBOT_DRIVER__MOCK_ROBOT_SERVER_HPP_
Diagnostic data.
Definition messages.hpp:191
Mock robot server to simulate a Staubli robot for testing purposes.
Definition mock_robot_server.hpp:44
bool send_mock_diagnostic_data(const DiagnosticDataMessage &data)
Send a diagnostic data message from the mock robot server.
bool is_ready() const
Check if mock robot server is initialized and ready.
bool init(const NetworkConfig &config)
Initialize the mock robot server with the given network configuration.
bool send_mock_robot_state(const RobotStateMessage &state)
Send a robot state message from the mock robot server.
bool disconnect()
Disconnect the mock robot server.
bool get_last_received_command(RobotCommandMessage &command, MessageStatus &status)
Receive a command message sent to the mock robot server.
Bilateral real-time socket interface for pub/sub communication.
Definition real_time_socket_interface.hpp:39
Robot command message.
Definition messages.hpp:139
Robot state message.
Definition messages.hpp:62
Definition messages.hpp:23
constexpr uint16_t DEFAULT_CONTROL_PORT
Default port for the control socket.
Definition protocol.hpp:45
constexpr uint16_t DEFAULT_DIAGNOSTICS_PORT
Default port for the diagnostics socket.
Definition protocol.hpp:50
Status struct to hold message status information.
Definition real_time_socket_subscriber.hpp:45
Configuration structure for the communication.
Definition mock_robot_server.hpp:47
uint16_t diagnostics_port
Port for diagnostics communication on the robot.
Definition mock_robot_server.hpp:55
uint16_t local_control_port
Port for control communication on ROS2 side.
Definition mock_robot_server.hpp:53
std::string robot_ip
IP address of the Staubli robot.
Definition mock_robot_server.hpp:49
uint16_t local_diagnostics_port
Port for diagnostics communication on ROS2 side.
Definition mock_robot_server.hpp:57
uint16_t control_port
Port for control communication on the robot.
Definition mock_robot_server.hpp:51