mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-12 11:00:47 +02:00
Big code dump
This commit is contained in:
@@ -17,11 +17,12 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool uploadProg(std::string &s);
|
||||
virtual bool speedj(std::array<double, 6> &speeds, double acceleration);
|
||||
virtual bool stopj(double a = 10.0);
|
||||
virtual bool setDigitalOut(uint8_t pin, bool value);
|
||||
virtual bool setAnalogOut(uint8_t pin, double value);
|
||||
virtual bool setToolVoltage(uint8_t voltage);
|
||||
virtual bool setFlag(bool value);
|
||||
virtual bool setFlag(uint8_t pin, bool value);
|
||||
virtual bool setPayload(double value);
|
||||
};
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
bool real_robot_enabled;
|
||||
bool robot_power_on;
|
||||
bool emergency_stopped;
|
||||
bool protective_stopped; //AKA security_stopped
|
||||
bool program_running;
|
||||
bool program_paused;
|
||||
|
||||
@@ -43,7 +44,6 @@ public:
|
||||
virtual bool parseWith(BinParser& bp);
|
||||
virtual bool consumeWith(URStatePacketConsumer& consumer);
|
||||
|
||||
bool security_stopped;
|
||||
robot_mode_V1_X robot_mode;
|
||||
double speed_fraction;
|
||||
|
||||
@@ -79,7 +79,6 @@ public:
|
||||
virtual bool parseWith(BinParser& bp);
|
||||
virtual bool consumeWith(URStatePacketConsumer& consumer);
|
||||
|
||||
bool protective_stopped;
|
||||
|
||||
robot_mode_V3_X robot_mode;
|
||||
robot_control_mode_V3_X control_mode;
|
||||
|
||||
19
include/ur_modern_driver/ur/server.h
Normal file
19
include/ur_modern_driver/ur/server.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <cstdlib>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include "ur_modern_driver/ur/stream.h"
|
||||
|
||||
class URServer
|
||||
{
|
||||
private:
|
||||
int socket_fd_ = -1;
|
||||
|
||||
public:
|
||||
URServer(int port);
|
||||
URStream accept();
|
||||
};
|
||||
@@ -19,15 +19,38 @@ private:
|
||||
std::mutex send_mutex_, receive_mutex_;
|
||||
|
||||
public:
|
||||
URStream()
|
||||
{
|
||||
}
|
||||
|
||||
URStream(std::string& host, int port) : host_(host), port_(port), initialized_(false), stopping_(false)
|
||||
{
|
||||
}
|
||||
|
||||
URStream(int socket_fd) : socket_fd_(socket_fd), initialized_(true), stopping_(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
URStream(URStream&& other) noexcept : socket_fd_(other.socket_fd_), host_(other.host_), initialized_(other.initialized_.load()), stopping_(other.stopping_.load())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
~URStream()
|
||||
{
|
||||
disconnect();
|
||||
}
|
||||
|
||||
URStream& operator=(URStream&& other)
|
||||
{
|
||||
socket_fd_ = std::move(other.socket_fd_);
|
||||
host_ = std::move(other.host_);
|
||||
initialized_ = std::move(other.initialized_.load());
|
||||
stopping_ = std::move(other.stopping_.load());
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool connect();
|
||||
void disconnect();
|
||||
void reconnect();
|
||||
|
||||
Reference in New Issue
Block a user