mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 10:00:48 +02:00
Safe Trajectory Follower implements different approach for controlling the robot. Rather than calculate the interpolation steps in the driver and send the small interpolated steps over the network to the URScript program with 500Hz frequency, the coarser MoveIt trajectory is sent (with few Hz) and the interpolation steps are calculated by the URScript. The algorithm for time progress has also built-in protection against any delays induced by load on the driver, network or URControl - it will never "catch-up" dangerously when such delay are introduced, It will rather pause and wait for the next small interpolation step instructions and re-start the move slower - never skipping any interpolated steps. Those changes make Safe Trajectory Follower much more resilient to network communication problems and removes any superficial requirements for the network setup, kernel latency and no-load-requirement for the driver's PC - making it much more suitable for research, development and quick iteration loops. It works reliably even over WiFi.
32 lines
643 B
C++
32 lines
643 B
C++
#pragma once
|
|
#include <netdb.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/types.h>
|
|
#include <atomic>
|
|
#include <cstdlib>
|
|
#include <mutex>
|
|
#include <string>
|
|
#include "ur_modern_driver/tcp_socket.h"
|
|
|
|
#define MAX_SERVER_BUF_LEN 50
|
|
|
|
class URServer : private TCPSocket
|
|
{
|
|
private:
|
|
int port_;
|
|
TCPSocket client_;
|
|
|
|
protected:
|
|
virtual bool open(int socket_fd, struct sockaddr *address, size_t address_len);
|
|
|
|
public:
|
|
URServer(int port);
|
|
~URServer();
|
|
std::string getIP();
|
|
bool bind();
|
|
bool accept();
|
|
void disconnectClient();
|
|
bool readLine(char* buffer, size_t buf_len);
|
|
bool write(const uint8_t *buf, size_t buf_len, size_t &written);
|
|
};
|