1
0
mirror of https://gitlab.com/obbart/universal_robots_ros_driver.git synced 2026-04-09 17:40:47 +02:00

header files for messages added

This commit is contained in:
Lea Steffen
2019-04-08 09:43:19 +02:00
committed by Felix Mauch
parent 44751cfb2a
commit f7c51bae87
11 changed files with 648 additions and 0 deletions

2
.gitignore vendored
View File

@@ -5,3 +5,5 @@ cmake_install.cmake
install_manifest.txt install_manifest.txt
*~ *~
.idea .idea
.directory
.vscode

View File

@@ -0,0 +1,51 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// Copyright 2019 FZI Forschungszentrum Informatik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_KINEMATICS_INFO_H_INCLUDED
#define UR_RTDE_DRIVER_KINEMATICS_INFO_H_INCLUDED
#include "ur_rtde_driver/primary/primary_package.h"
#include "ur_rtde_driver/primary/robot_state.h"
namespace ur_driver
{
namespace primary_interface
{
class KinematicsInfo : PrimaryPackage
{
private:
RobotState robot_state_;
public:
KinematicsInfo() = default;
virtual ~KinematicsInfo() = default;
};
} // namespace primary_interface
} // namespace ur_driver
#endif /* UR_RTDE_DRIVER_KINEMATICS_INFO_H_INCLUDED */

View File

@@ -0,0 +1,107 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// Copyright 2019 FZI Forschungszentrum Informatik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Felix Mauch mauch@fzi.de
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_PRIMARY_INTERFACE_H_INCLUDED
#define UR_RTDE_DRIVER_PRIMARY_INTERFACE_H_INCLUDED
#include <inttypes.h>
#include <cstddef>
#include <endian.h>
#include "ur_rtde_driver/types.h"
namespace ur_driver
{
namespace primary
{
enum class message_type : int8_t
{
DISCONNECT = -1,
ROBOT_STATE = 16,
ROBOT_MESSAGE = 20,
HMC_MESSAGE = 22,
MODBUS_INFO_MESSAGE = 5,
SAFETY_SETUP_BROADCAST_MESSAGE = 23,
SAFETY_COMPLIANCE_TOLERANCES_MESSAGE = 24,
PROGRAM_STATE_MESSAGE = 25
};
enum class robot_state_type : uint8_t
{
ROBOT_MODE_DATA = 0,
JOINT_DATA = 1,
TOOL_DATA = 2,
MASTERBOARD_DATA = 3,
CARTESIAN_INFO = 4,
KINEMATICS_INFO = 5,
CONFIGURATION_DATA = 6,
FORCE_MODE_DATA = 7,
ADDITIONAL_INFO = 8,
CALIBRATION_DATA = 9
};
enum class robot_message_type : uint8_t
{
ROBOT_MESSAGE_TEXT = 0,
ROBOT_MESSAGE_PROGRAM_LABEL = 1,
PROGRAM_STATE_MESSAGE_VARIABLE_UPDATE = 2,
ROBOT_MESSAGE_VERSION = 3,
ROBOT_MESSAGE_SAFETY_MODE = 5,
ROBOT_MESSAGE_ERROR_CODE = 6,
ROBOT_MESSAGE_KEY = 7,
ROBOT_MESSAGE_REQUEST_VALUE = 9,
ROBOT_MESSAGE_RUNTIME_EXCEPTION = 10
};
class Header
{
public:
Header() = default;
virtual ~Header() = default;
using _package_size_type = int32_t;
static size_t getPackageLength(uint8_t* buf)
{
return be32toh(*(reinterpret_cast<int32_t*>(buf)));
}
static size_t getPackageSize()
{
return sizeof(package_size_);
}
private:
int32_t package_size_;
int8_t package_type_;
};
} // namespace primary_interface
} // namespace ur_driver
#endif // ifndef UR_RTDE_DRIVER_PRIMARY_INTERFACE_H_INCLUDED

View File

@@ -0,0 +1,54 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// Copyright 2019 FZI Forschungszentrum Informatik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_PRIMARY_PACKAGE_H_INCLUDED
#define UR_RTDE_DRIVER_PRIMARY_PACKAGE_H_INCLUDED
#include "ur_rtde_driver/primary/primary_header.h"
namespace ur_driver
{
namespace primary_interface
{
class PrimaryPackage
{
private:
uint8_t* data_buffer_;
public:
PrimaryPackage() = default;
virtual ~PrimaryPackage() = default;
};
} // namespace primary_interface
} // namespace ur_driver
#endif /* UR_RTDE_DRIVER_PRIMARY_PACKAGE_H_INCLUDED */

View File

@@ -0,0 +1,47 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// Copyright 2019 FZI Forschungszentrum Informatik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_ROBOT_MESSAGE_H_INCLUDED
#define UR_RTDE_DRIVER_ROBOT_MESSAGE_H_INCLUDED
#include "ur_rtde_driver/primary/primary_package.h"
namespace ur_driver
{
namespace primary_interface
{
class RobotMessage : PrimaryPackage
{
public:
RobotMessage() = default;
virtual ~RobotMessage() = default;
};
} // namespace primary_interface
} // namespace ur_driver
#endif /* UR_RTDE_DRIVER_ROBOT_MESSAGE_H_INCLUDED */

View File

@@ -0,0 +1,51 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// Copyright 2019 FZI Forschungszentrum Informatik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_ROBOT_MODE_DATA_H_INCLUDED
#define UR_RTDE_DRIVER_ROBOT_MODE_DATA_H_INCLUDED
#include "ur_rtde_driver/primary/primary_package.h"
#include "ur_rtde_driver/primary/robot_state.h"
namespace ur_driver
{
namespace primary_interface
{
class RobotModeData : PrimaryPackage
{
private:
RobotState robot_state_;
public:
RobotModeData() = default;
virtual ~RobotModeData() = default;
};
} // namespace primary_interface
} // namespace ur_driver
#endif /* UR_RTDE_DRIVER_ROBOT_MODE_DATA_H_INCLUDED */

View File

@@ -0,0 +1,117 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// Copyright 2019 FZI Forschungszentrum Informatik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_ROBOT_STATE_H_INCLUDED
#define UR_RTDE_DRIVER_ROBOT_STATE_H_INCLUDED
#include <mutex>
#include <condition_variable>
#include "ur_rtde_driver/primary/primary_package.h"
#include "ur_rtde_driver/primary/primary_header.h"
namespace ur_driver
{
namespace primary_interface
{
struct version_message
{
uint64_t timestamp;
int8_t source;
int8_t robot_message_type;
int8_t project_name_size;
char project_name[15];
uint8_t major_version;
uint8_t minor_version;
int svn_revision;
char build_date[25];
};
struct masterboard_data
{
int digitalInputBits;
int digitalOutputBits;
char analogInputRange0;
char analogInputRange1;
double analogInput0;
double analogInput1;
char analogOutputDomain0;
char analogOutputDomain1;
double analogOutput0;
double analogOutput1;
float masterBoardTemperature;
float robotVoltage48V;
float robotCurrent;
float masterIOCurrent;
unsigned char safetyMode;
unsigned char masterOnOffState;
char euromap67InterfaceInstalled;
int euromapInputBits;
int euromapOutputBits;
float euromapVoltage;
float euromapCurrent;
};
struct robot_mode_data
{
uint64_t timestamp;
bool isRobotConnected;
bool isRealRobotEnabled;
bool isPowerOnRobot;
bool isEmergencyStopped;
bool isProtectiveStopped;
bool isProgramRunning;
bool isProgramPaused;
unsigned char robotMode;
unsigned char controlMode;
double targetSpeedFraction;
double speedScaling;
};
class RobotState : PrimaryPackage
{
private:
robot_state_type robot_state_;
/*
version_message version_msg_;
masterboard_data mb_data_;
robot_mode_data robot_mode_;
std::recursive_mutex val_lock_; // Locks the variables while unpack parses data;
std::condition_variable* pMsg_cond_; //Signals that new vars are available
bool new_data_available_; //to avoid spurious wakes
unsigned char robot_mode_running_;
double ntohd(uint64_t nf); */
public:
RobotState() = default;
virtual ~RobotState() = default;
};
} // namespace primary_interface
} // namespace ur_driver
#endif /* UR_RTDE_DRIVER_ROBOT_STATE_H_INCLUDED */

View File

@@ -0,0 +1,50 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// Copyright 2019 FZI Forschungszentrum Informatik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_DATA_PACKAGE_H_INCLUDED
#define UR_RTDE_DRIVER_DATA_PACKAGE_H_INCLUDED
#include "ur_rtde_driver/rtde/rtde_package.h"
namespace ur_driver
{
namespace rtde_interface
{
class DataPackage : RTDEPackage
{
private:
uint8_t recipe_id_;
public:
DataPackage() = default;
virtual ~DataPackage() = default;
};
} // namespace rtde_interface
} // namespace ur_driver
#endif // ifndef UR_RTDE_DRIVER_DATA_PACKAGE_H_INCLUDED

View File

@@ -0,0 +1,69 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_RTDE__HEADER_H_INCLUDED
#define UR_RTDE_DRIVER_RTDE__HEADER_H_INCLUDED
#include <cstddef>
#include <endian.h>
#include "ur_rtde_driver/types.h"
namespace ur_driver
{
namespace rtde_interface
{
enum class PackageType
{
RTDE_REQUEST_PROTOCOL_VERSION = 86, // ascii V
RTDE_GET_URCONTROL_VERSION = 118, // ascii v
RTDE_TEXT_MESSAGE = 77, // ascii M
RTDE_DATA_PACKAGE = 85, // ascii U
RTDE_CONTROL_PACKAGE_SETUP_OUTPUTS = 79, // ascii O
RTDE_CONTROL_PACKAGE_SETUP_INPUTS = 73, // ascii I
RTDE_CONTROL_PACKAGE_START = 83, // ascii S
RTDE_CONTROL_PACKAGE_PAUSE = 80 // ascii P
};
class Header
{
public:
Header() = default;
virtual ~Header() = default;
static size_t getPackageLength(uint8_t* buf)
{
return be16toh(*(reinterpret_cast<uint16_t*>(buf)));
}
static size_t getPackageSize()
{
return sizeof(package_size_);
}
private:
uint16_t package_size_;
PackageType package_type_;
};
} // namespace rtde_interface
} // namespace ur_driver
#endif // #ifndef UR_RTDE_DRIVER_RTDE__HEADER_H_INCLUDED

View File

@@ -0,0 +1,53 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// Copyright 2019 FZI Forschungszentrum Informatik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_RTDE_PACKAGE_H_INCLUDED
#define UR_RTDE_DRIVER_RTDE_PACKAGE_H_INCLUDED
#include "ur_rtde_driver/rtde/rtde_header.h"
namespace ur_driver
{
namespace rtde_interface
{
class RTDEPackage
{
public:
RTDEPackage() = default;
virtual ~RTDEPackage() = default;
};
} // namespace rtde_interface
} // namespace ur_driver
#endif // UR_RTDE_DRIVER_RTDE_PACKAGE_H_INCLUDED

View File

@@ -0,0 +1,47 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// Copyright 2019 FZI Forschungszentrum Informatik
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Lea Steffen steffen@fzi.de
* \date 2019-04-01
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_TEXT_MESSAGE_H_INCLUDED
#define UR_RTDE_DRIVER_TEXT_MESSAGE_H_INCLUDED
#include "ur_rtde_driver/rtde/rtde_package.h"
namespace ur_driver
{
namespace rtde_interface
{
class TextMessage : RTDEPackage
{
public:
TextMessage() = default;
virtual ~TextMessage() = default;
};
} // namespace rtde_interface
} // namespace ur_driver
#endif // UR_RTDE_DRIVER_TEXT_MESSAGE_H_INCLUDED