mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-09 17:40:47 +02:00
Put package information in base package
This commit is contained in:
committed by
Tristan Schnell
parent
2e71c18f70
commit
da53c3b45c
@@ -49,8 +49,6 @@ public:
|
||||
URPackage() = default;
|
||||
virtual ~URPackage() = default;
|
||||
|
||||
using _header_type = HeaderT;
|
||||
|
||||
virtual bool parseWith(BinParser& bp) = 0;
|
||||
|
||||
virtual std::string toString() const = 0;
|
||||
|
||||
@@ -58,14 +58,11 @@ public:
|
||||
virtual ~PackageHeader() = default;
|
||||
|
||||
using _package_size_type = int32_t;
|
||||
|
||||
static size_t getPackageLength(uint8_t* buf)
|
||||
{
|
||||
return be32toh(*(reinterpret_cast<_package_size_type*>(buf)));
|
||||
}
|
||||
|
||||
private:
|
||||
_package_size_type package_size_;
|
||||
RobotPackageType package_type_;
|
||||
};
|
||||
} // namespace primary_interface
|
||||
} // namespace ur_driver
|
||||
|
||||
@@ -37,7 +37,9 @@ namespace rtde_interface
|
||||
class ControlPackagePause : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
ControlPackagePause() = default;
|
||||
ControlPackagePause() : RTDEPackage(PackageType::RTDE_CONTROL_PACKAGE_PAUSE)
|
||||
{
|
||||
}
|
||||
virtual ~ControlPackagePause() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
@@ -49,7 +51,9 @@ public:
|
||||
class ControlPackagePauseRequest : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
ControlPackagePauseRequest() = default;
|
||||
ControlPackagePauseRequest() : RTDEPackage(PackageType::RTDE_CONTROL_PACKAGE_PAUSE)
|
||||
{
|
||||
}
|
||||
virtual ~ControlPackagePauseRequest() = default;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ namespace rtde_interface
|
||||
class ControlPackageSetupInputs : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
ControlPackageSetupInputs() = default;
|
||||
ControlPackageSetupInputs() : RTDEPackage(PackageType::RTDE_CONTROL_PACKAGE_SETUP_INPUTS)
|
||||
{
|
||||
}
|
||||
virtual ~ControlPackageSetupInputs() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
@@ -50,7 +52,9 @@ public:
|
||||
class ControlPackageSetupInputsRequest : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
ControlPackageSetupInputsRequest() = default;
|
||||
ControlPackageSetupInputsRequest() : RTDEPackage(PackageType::RTDE_CONTROL_PACKAGE_SETUP_INPUTS)
|
||||
{
|
||||
}
|
||||
virtual ~ControlPackageSetupInputsRequest() = default;
|
||||
|
||||
std::string variable_names_;
|
||||
|
||||
@@ -38,7 +38,9 @@ namespace rtde_interface
|
||||
class ControlPackageSetupOutputs : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
ControlPackageSetupOutputs() = default;
|
||||
ControlPackageSetupOutputs() : RTDEPackage(PackageType::RTDE_CONTROL_PACKAGE_SETUP_OUTPUTS)
|
||||
{
|
||||
}
|
||||
virtual ~ControlPackageSetupOutputs() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
@@ -51,7 +53,9 @@ public:
|
||||
class ControlPackageSetupOutputsRequest : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
ControlPackageSetupOutputsRequest() = default;
|
||||
ControlPackageSetupOutputsRequest() : RTDEPackage(PackageType::RTDE_CONTROL_PACKAGE_SETUP_OUTPUTS)
|
||||
{
|
||||
}
|
||||
virtual ~ControlPackageSetupOutputsRequest() = default;
|
||||
|
||||
static size_t generateSerializedRequest(uint8_t* buffer, double output_frequency,
|
||||
|
||||
@@ -37,7 +37,9 @@ namespace rtde_interface
|
||||
class ControlPackageStart : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
ControlPackageStart() = default;
|
||||
ControlPackageStart() : RTDEPackage(PackageType::RTDE_CONTROL_PACKAGE_START)
|
||||
{
|
||||
}
|
||||
virtual ~ControlPackageStart() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
@@ -49,14 +51,15 @@ public:
|
||||
class ControlPackageStartRequest : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
ControlPackageStartRequest() = default;
|
||||
ControlPackageStartRequest() : RTDEPackage(PackageType::RTDE_CONTROL_PACKAGE_START)
|
||||
{
|
||||
}
|
||||
virtual ~ControlPackageStartRequest() = default;
|
||||
|
||||
static size_t generateSerializedRequest(uint8_t* buffer);
|
||||
|
||||
private:
|
||||
static const uint16_t PAYLOAD_SIZE = 0;
|
||||
static const PackageType PACKAGE_TYPE = PackageType::RTDE_CONTROL_PACKAGE_START;
|
||||
};
|
||||
|
||||
} // namespace rtde_interface
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
vector6int32_t, vector6uint32_t, std::string>;
|
||||
|
||||
DataPackage() = delete;
|
||||
DataPackage(const std::vector<std::string>& recipe) : recipe_(recipe)
|
||||
DataPackage(const std::vector<std::string>& recipe) : RTDEPackage(PackageType::RTDE_DATA_PACKAGE), recipe_(recipe)
|
||||
{
|
||||
}
|
||||
virtual ~DataPackage() = default;
|
||||
|
||||
@@ -38,7 +38,9 @@ namespace rtde_interface
|
||||
class GetUrcontrolVersion : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
GetUrcontrolVersion() = default;
|
||||
GetUrcontrolVersion() : RTDEPackage(PackageType::RTDE_GET_URCONTROL_VERSION)
|
||||
{
|
||||
}
|
||||
virtual ~GetUrcontrolVersion() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
@@ -55,14 +57,15 @@ public:
|
||||
class GetUrcontrolVersionRequest : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
GetUrcontrolVersionRequest() = default;
|
||||
GetUrcontrolVersionRequest() : RTDEPackage(PackageType::RTDE_GET_URCONTROL_VERSION)
|
||||
{
|
||||
}
|
||||
virtual ~GetUrcontrolVersionRequest() = default;
|
||||
|
||||
static size_t generateSerializedRequest(uint8_t* buffer);
|
||||
|
||||
private:
|
||||
static const uint16_t PAYLOAD_SIZE = 0;
|
||||
static const PackageType PACKAGE_TYPE = PackageType::RTDE_GET_URCONTROL_VERSION;
|
||||
};
|
||||
|
||||
} // namespace rtde_interface
|
||||
|
||||
@@ -57,9 +57,6 @@ 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)));
|
||||
@@ -73,10 +70,6 @@ public:
|
||||
comm::PackageSerializer::serialize(buffer + sizeof(size), package_type);
|
||||
return header_size;
|
||||
}
|
||||
|
||||
private:
|
||||
_package_size_type package_size_;
|
||||
PackageType package_type_;
|
||||
};
|
||||
|
||||
} // namespace rtde_interface
|
||||
|
||||
@@ -38,7 +38,9 @@ namespace rtde_interface
|
||||
class RequestProtocolVersion : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
RequestProtocolVersion() = default;
|
||||
RequestProtocolVersion() : RTDEPackage(PackageType::RTDE_REQUEST_PROTOCOL_VERSION)
|
||||
{
|
||||
}
|
||||
virtual ~RequestProtocolVersion() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
@@ -50,7 +52,10 @@ public:
|
||||
class RequestProtocolVersionRequest : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
RequestProtocolVersionRequest() = default;
|
||||
RequestProtocolVersionRequest() : RTDEPackage(PackageType::RTDE_REQUEST_PROTOCOL_VERSION)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~RequestProtocolVersionRequest() = default;
|
||||
|
||||
static size_t generateSerializedRequest(uint8_t* buffer, uint16_t version);
|
||||
@@ -59,7 +64,6 @@ public:
|
||||
|
||||
private:
|
||||
static const uint16_t PAYLOAD_SIZE = sizeof(uint16_t);
|
||||
static const PackageType PACKAGE_TYPE = PackageType::RTDE_REQUEST_PROTOCOL_VERSION;
|
||||
};
|
||||
|
||||
} // namespace rtde_interface
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
/*!
|
||||
* \brief Creates a new RTDEPackage object.
|
||||
*/
|
||||
RTDEPackage() = default;
|
||||
RTDEPackage() = delete;
|
||||
RTDEPackage(const PackageType type) : type_(type)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ namespace rtde_interface
|
||||
class TextMessage : public RTDEPackage
|
||||
{
|
||||
public:
|
||||
TextMessage() = default;
|
||||
TextMessage() : RTDEPackage(PackageType::RTDE_TEXT_MESSAGE)
|
||||
{
|
||||
}
|
||||
virtual ~TextMessage() = default;
|
||||
|
||||
virtual bool parseWith(comm::BinParser& bp);
|
||||
|
||||
@@ -47,7 +47,7 @@ std::string ControlPackageStart::toString() const
|
||||
|
||||
size_t ControlPackageStartRequest::generateSerializedRequest(uint8_t* buffer)
|
||||
{
|
||||
return PackageHeader::serializeHeader(buffer, PACKAGE_TYPE, PAYLOAD_SIZE);
|
||||
return PackageHeader::serializeHeader(buffer, PackageType::RTDE_CONTROL_PACKAGE_START, PAYLOAD_SIZE);
|
||||
}
|
||||
} // namespace rtde_interface
|
||||
} // namespace ur_driver
|
||||
|
||||
@@ -51,7 +51,7 @@ std::string GetUrcontrolVersion::toString() const
|
||||
|
||||
size_t GetUrcontrolVersionRequest::generateSerializedRequest(uint8_t* buffer)
|
||||
{
|
||||
return PackageHeader::serializeHeader(buffer, PACKAGE_TYPE, PAYLOAD_SIZE);
|
||||
return PackageHeader::serializeHeader(buffer, PackageType::RTDE_GET_URCONTROL_VERSION, PAYLOAD_SIZE);
|
||||
}
|
||||
} // namespace rtde_interface
|
||||
} // namespace ur_driver
|
||||
|
||||
@@ -47,7 +47,7 @@ std::string RequestProtocolVersion::toString() const
|
||||
size_t RequestProtocolVersionRequest::generateSerializedRequest(uint8_t* buffer, uint16_t version)
|
||||
{
|
||||
size_t size = 0;
|
||||
size += PackageHeader::serializeHeader(buffer, PACKAGE_TYPE, PAYLOAD_SIZE);
|
||||
size += PackageHeader::serializeHeader(buffer, PackageType::RTDE_REQUEST_PROTOCOL_VERSION, PAYLOAD_SIZE);
|
||||
|
||||
size += comm::PackageSerializer::serialize(buffer + size, version);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user