1
0
mirror of https://gitlab.com/obbart/universal_robots_ros_driver.git synced 2026-04-10 10:00:48 +02:00

introduced VersionInformation

Use this as a data container to store version information in.
This commit is contained in:
Felix Mauch
2019-06-11 17:52:58 +02:00
parent e1e71b5cb4
commit e0201002f6
6 changed files with 60 additions and 6 deletions

View File

@@ -29,6 +29,7 @@
#define UR_RTDE_DRIVER_GET_URCONTROL_VERSION_H_INCLUDED #define UR_RTDE_DRIVER_GET_URCONTROL_VERSION_H_INCLUDED
#include "ur_rtde_driver/rtde/rtde_package.h" #include "ur_rtde_driver/rtde/rtde_package.h"
#include "ur_rtde_driver/ur/version_information.h"
namespace ur_driver namespace ur_driver
{ {
@@ -43,6 +44,8 @@ public:
virtual bool parseWith(comm::BinParser& bp); virtual bool parseWith(comm::BinParser& bp);
virtual std::string toString() const; virtual std::string toString() const;
VersionInformation version_information_;
uint32_t major_; uint32_t major_;
uint32_t minor_; uint32_t minor_;
uint32_t bugfix_; uint32_t bugfix_;

View File

@@ -62,6 +62,11 @@ public:
return max_frequency_; return max_frequency_;
} }
VersionInformation getVersion()
{
return urcontrol_version_;
}
private: private:
comm::URStream<PackageHeader> stream_; comm::URStream<PackageHeader> stream_;
std::vector<std::string> recipe_; std::vector<std::string> recipe_;
@@ -69,6 +74,8 @@ private:
comm::URProducer<PackageHeader> prod_; comm::URProducer<PackageHeader> prod_;
comm::Pipeline<PackageHeader> pipeline_; comm::Pipeline<PackageHeader> pipeline_;
VersionInformation urcontrol_version_;
double max_frequency_; double max_frequency_;
constexpr static const double CB3_MAX_FREQUENCY = 125.0; constexpr static const double CB3_MAX_FREQUENCY = 125.0;

View File

@@ -31,6 +31,7 @@
#include "ur_rtde_driver/comm/reverse_interface.h" #include "ur_rtde_driver/comm/reverse_interface.h"
#include "ur_rtde_driver/comm/script_sender.h" #include "ur_rtde_driver/comm/script_sender.h"
#include "ur_rtde_driver/ur/tool_communication.h" #include "ur_rtde_driver/ur/tool_communication.h"
#include "ur_rtde_driver/primary/robot_message/version_message.h"
namespace ur_driver namespace ur_driver
{ {

View File

@@ -0,0 +1,36 @@
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
// -- BEGIN LICENSE BLOCK ----------------------------------------------
// -- END LICENSE BLOCK ------------------------------------------------
//----------------------------------------------------------------------
/*!\file
*
* \author Felix Mauch mauch@fzi.de
* \date 2019-06-11
*
*/
//----------------------------------------------------------------------
#ifndef UR_RTDE_DRIVER_UR_VERSION_INFORMATION_H_INCLUDED
#define UR_RTDE_DRIVER_UR_VERSION_INFORMATION_H_INCLUDED
namespace ur_driver
{
struct VersionInformation
{
VersionInformation()
{
major = 0;
minor = 0;
bugfix = 0;
build = 0;
}
uint32_t major;
uint32_t minor;
uint32_t bugfix;
uint32_t build;
};
} // namespace ur_driver
#endif // ifndef UR_RTDE_DRIVER_UR_VERSION_INFORMATION_H_INCLUDED

View File

@@ -33,10 +33,10 @@ namespace rtde_interface
{ {
bool GetUrcontrolVersion::parseWith(comm::BinParser& bp) bool GetUrcontrolVersion::parseWith(comm::BinParser& bp)
{ {
bp.parse(major_); bp.parse(version_information_.major);
bp.parse(minor_); bp.parse(version_information_.minor);
bp.parse(bugfix_); bp.parse(version_information_.bugfix);
bp.parse(build_); bp.parse(version_information_.build);
return true; return true;
} }

View File

@@ -26,6 +26,7 @@
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#include "ur_rtde_driver/rtde/rtde_client.h" #include "ur_rtde_driver/rtde/rtde_client.h"
#include "ur_rtde_driver/exceptions.h"
namespace ur_driver namespace ur_driver
{ {
@@ -73,9 +74,15 @@ bool RTDEClient::init()
size = GetUrcontrolVersionRequest::generateSerializedRequest(buffer); size = GetUrcontrolVersionRequest::generateSerializedRequest(buffer);
stream_.write(buffer, size, written); stream_.write(buffer, size, written);
pipeline_.getLatestProduct(package, std::chrono::milliseconds(1000)); pipeline_.getLatestProduct(package, std::chrono::milliseconds(1000));
rtde_interface::GetUrcontrolVersion* tmp_control_version = rtde_interface::GetUrcontrolVersion* tmp_urcontrol_version =
dynamic_cast<rtde_interface::GetUrcontrolVersion*>(package.get()); dynamic_cast<rtde_interface::GetUrcontrolVersion*>(package.get());
if (tmp_control_version->major_ < 5)
if (tmp_urcontrol_version == nullptr)
{
throw UrException("Could not get urcontrol version from robot. This should not happen!");
}
urcontrol_version_ = tmp_urcontrol_version->version_information_;
if (urcontrol_version_.major < 5)
{ {
max_frequency_ = CB3_MAX_FREQUENCY; max_frequency_ = CB3_MAX_FREQUENCY;
} }