staubli_driver_ros2 main
ROS2 control driver for Staubli robots
Loading...
Searching...
No Matches
real_time_socket_interface.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#ifndef STAUBLI_ROBOT_DRIVER__REAL_TIME_SOCKET_INTERFACE_HPP_
18#define STAUBLI_ROBOT_DRIVER__REAL_TIME_SOCKET_INTERFACE_HPP_
19
20// C++
21#include <cstdint>
22#include <chrono>
23#include <memory>
24#include <string>
25#include <vector>
26
27// ROS2
29
30namespace staubli_robot_driver {
31
38template <typename MessageSub, typename MessagePub>
40public:
41 explicit RealTimeSocketInterface(std::shared_ptr<Socket> socket);
43
52 bool send_message(const MessagePub& msg);
53
58 bool is_ready() const override {
60 }
61
62private:
63 std::vector<uint8_t> data_out_; // Buffer for serialized message
64};
65
66// Declarations for message types
67template class RealTimeSocketInterface<RobotStateMessage, RobotCommandMessage>;
68template class RealTimeSocketInterface<RobotCommandMessage, RobotStateMessage>;
69
70} // namespace staubli_robot_driver
71
72#endif // STAUBLI_ROBOT_DRIVER__REAL_TIME_SOCKET_INTERFACE_HPP_
Bilateral real-time socket interface for pub/sub communication.
Definition real_time_socket_interface.hpp:39
RealTimeSocketInterface(std::shared_ptr< Socket > socket)
bool send_message(const MessagePub &msg)
Serialize and send a message over the socket.
bool is_ready() const override
Check if the interface is ready (socket connected and receiving)
Definition real_time_socket_interface.hpp:58
Real-time socket subscriber class template.
Definition real_time_socket_subscriber.hpp:63
virtual bool is_ready() const
Check if the subscriber is ready (socket connected and receiving)
Definition messages.hpp:23