mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 01:50:46 +02:00
Added parse and toString functions for higher-level primary functions
This commit is contained in:
@@ -35,16 +35,20 @@ namespace ur_driver
|
||||
{
|
||||
namespace primary_interface
|
||||
{
|
||||
class PrimaryPackage : comm::URPackage<PackageHeader>
|
||||
class PrimaryPackage : public comm::URPackage<PackageHeader>
|
||||
{
|
||||
public:
|
||||
PrimaryPackage() = default;
|
||||
virtual ~PrimaryPackage() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
virtual std::string toString() const;
|
||||
|
||||
private:
|
||||
uint8_t* data_buffer_;
|
||||
std::string buffer_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace primary_interface
|
||||
} // namespace ur_driver
|
||||
|
||||
|
||||
@@ -34,20 +34,7 @@ namespace ur_driver
|
||||
{
|
||||
namespace primary_interface
|
||||
{
|
||||
enum class 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 RobotMessage : PrimaryPackage
|
||||
class RobotMessage : public PrimaryPackage
|
||||
{
|
||||
public:
|
||||
RobotMessage(const uint64_t timestamp, const uint8_t source) : timestamp_(timestamp), source_(source)
|
||||
@@ -55,8 +42,8 @@ public:
|
||||
}
|
||||
virtual ~RobotMessage() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp) = 0;
|
||||
virtual std::string toString() const = 0;
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
virtual std::string toString() const;
|
||||
|
||||
uint64_t timestamp_;
|
||||
uint8_t source_;
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
VersionMessage(uint64_t timestamp, uint8_t source) : RobotMessage(timestamp, source)
|
||||
{
|
||||
}
|
||||
virtual ~VersionMessage() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
|
||||
|
||||
@@ -48,6 +48,15 @@ public:
|
||||
RobotState() = default;
|
||||
virtual ~RobotState() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual std::string toString() const
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace primary_interface
|
||||
* a combination between the perfect model parameters and the correction deltas as noted in the
|
||||
* configuration files on the robot controller.
|
||||
*/
|
||||
class KinematicsInfo : RobotState
|
||||
class KinematicsInfo : public RobotState
|
||||
{
|
||||
public:
|
||||
KinematicsInfo() = default;
|
||||
|
||||
@@ -43,6 +43,9 @@ public:
|
||||
virtual ~PackageHeader() = default;
|
||||
using _package_size_type = uint16_t;
|
||||
|
||||
PackageHeader(PackageType& type) : package_type_(type){};
|
||||
PackageHeader(_package_size_type& size, PackageType& type) : package_size_(size), package_type_(type){};
|
||||
|
||||
static size_t getPackageLength(uint8_t* buf)
|
||||
{
|
||||
return be16toh(*(reinterpret_cast<_package_size_type*>(buf)));
|
||||
|
||||
Reference in New Issue
Block a user