mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 01:50:46 +02:00
introduced VersionInformation
Use this as a data container to store version information in.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#define UR_RTDE_DRIVER_GET_URCONTROL_VERSION_H_INCLUDED
|
||||
|
||||
#include "ur_rtde_driver/rtde/rtde_package.h"
|
||||
#include "ur_rtde_driver/ur/version_information.h"
|
||||
|
||||
namespace ur_driver
|
||||
{
|
||||
@@ -43,6 +44,8 @@ public:
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
virtual std::string toString() const;
|
||||
|
||||
VersionInformation version_information_;
|
||||
|
||||
uint32_t major_;
|
||||
uint32_t minor_;
|
||||
uint32_t bugfix_;
|
||||
|
||||
@@ -62,6 +62,11 @@ public:
|
||||
return max_frequency_;
|
||||
}
|
||||
|
||||
VersionInformation getVersion()
|
||||
{
|
||||
return urcontrol_version_;
|
||||
}
|
||||
|
||||
private:
|
||||
comm::URStream<PackageHeader> stream_;
|
||||
std::vector<std::string> recipe_;
|
||||
@@ -69,6 +74,8 @@ private:
|
||||
comm::URProducer<PackageHeader> prod_;
|
||||
comm::Pipeline<PackageHeader> pipeline_;
|
||||
|
||||
VersionInformation urcontrol_version_;
|
||||
|
||||
double max_frequency_;
|
||||
|
||||
constexpr static const double CB3_MAX_FREQUENCY = 125.0;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "ur_rtde_driver/comm/reverse_interface.h"
|
||||
#include "ur_rtde_driver/comm/script_sender.h"
|
||||
#include "ur_rtde_driver/ur/tool_communication.h"
|
||||
#include "ur_rtde_driver/primary/robot_message/version_message.h"
|
||||
|
||||
namespace ur_driver
|
||||
{
|
||||
|
||||
@@ -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
|
||||
@@ -33,10 +33,10 @@ namespace rtde_interface
|
||||
{
|
||||
bool GetUrcontrolVersion::parseWith(comm::BinParser& bp)
|
||||
{
|
||||
bp.parse(major_);
|
||||
bp.parse(minor_);
|
||||
bp.parse(bugfix_);
|
||||
bp.parse(build_);
|
||||
bp.parse(version_information_.major);
|
||||
bp.parse(version_information_.minor);
|
||||
bp.parse(version_information_.bugfix);
|
||||
bp.parse(version_information_.build);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include "ur_rtde_driver/rtde/rtde_client.h"
|
||||
#include "ur_rtde_driver/exceptions.h"
|
||||
|
||||
namespace ur_driver
|
||||
{
|
||||
@@ -73,9 +74,15 @@ bool RTDEClient::init()
|
||||
size = GetUrcontrolVersionRequest::generateSerializedRequest(buffer);
|
||||
stream_.write(buffer, size, written);
|
||||
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());
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user