From 1208c18d3dfb9e005e7cdd55a064a61aa870fc54 Mon Sep 17 00:00:00 2001 From: Tristan Schnell Date: Tue, 24 Sep 2019 17:00:08 +0200 Subject: [PATCH] doxygen documentation for primary headers --- .../ur_rtde_driver/primary/package_header.h | 10 ++++++++ .../ur_rtde_driver/primary/primary_package.h | 14 +++++++++++ .../ur_rtde_driver/primary/primary_parser.h | 13 ++++++++++ .../ur_rtde_driver/primary/robot_message.h | 25 ++++++++++++++++++- .../primary/robot_message/version_message.h | 22 ++++++++++++++++ .../ur_rtde_driver/primary/robot_state.h | 19 ++++++++++++++ .../primary/robot_state/kinematics_info.h | 24 ++++++++++++++++++ 7 files changed, 126 insertions(+), 1 deletion(-) diff --git a/ur_rtde_driver/include/ur_rtde_driver/primary/package_header.h b/ur_rtde_driver/include/ur_rtde_driver/primary/package_header.h index e99555c..dedee49 100644 --- a/ur_rtde_driver/include/ur_rtde_driver/primary/package_header.h +++ b/ur_rtde_driver/include/ur_rtde_driver/primary/package_header.h @@ -52,6 +52,9 @@ enum class RobotPackageType : int8_t PROGRAM_STATE_MESSAGE = 25 }; +/*! + * \brief This class represents the header for primary packages. + */ class PackageHeader { public: @@ -60,6 +63,13 @@ public: using _package_size_type = int32_t; + /*! + * \brief Reads a buffer, interpreting the next bytes as the size of the contained package. + * + * \param buf The given byte stream containing a serialized package + * + * \returns The size of the given serialized package + */ static size_t getPackageLength(uint8_t* buf) { return be32toh(*(reinterpret_cast<_package_size_type*>(buf))); diff --git a/ur_rtde_driver/include/ur_rtde_driver/primary/primary_package.h b/ur_rtde_driver/include/ur_rtde_driver/primary/primary_package.h index 12133c2..6848d97 100644 --- a/ur_rtde_driver/include/ur_rtde_driver/primary/primary_package.h +++ b/ur_rtde_driver/include/ur_rtde_driver/primary/primary_package.h @@ -51,7 +51,21 @@ public: } virtual ~PrimaryPackage() = default; + /*! + * \brief Sets the attributes of the package by parsing a serialized representation of the + * package. + * + * \param bp A parser containing a serialized version of the package + * + * \returns True, if the package was parsed successfully, false otherwise + */ virtual bool parseWith(comm::BinParser& bp); + + /*! + * \brief Produces a human readable representation of the package object. + * + * \returns A string representing the object + */ virtual std::string toString() const; protected: diff --git a/ur_rtde_driver/include/ur_rtde_driver/primary/primary_parser.h b/ur_rtde_driver/include/ur_rtde_driver/primary/primary_parser.h index dc30591..285a999 100644 --- a/ur_rtde_driver/include/ur_rtde_driver/primary/primary_parser.h +++ b/ur_rtde_driver/include/ur_rtde_driver/primary/primary_parser.h @@ -35,12 +35,25 @@ namespace ur_driver { namespace primary_interface { + /*! + * \brief The primary specific parser. Interprets a given byte stream as serialized primary + * packages and parses it accordingly. + */ class PrimaryParser : public comm::Parser { public: PrimaryParser() = default; virtual ~PrimaryParser() = default; + /*! + * \brief Uses the given BinParser to create package objects from the contained serialization. + * + * \param bp A BinParser holding one or more serialized primary packages + * \param results A vector of pointers to created primary package objects + * + * \returns True, if the byte stream could successfully be parsed as primary packages, false + * otherwise + */ bool parse(comm::BinParser& bp, std::vector>>& results) { int32_t packet_size; diff --git a/ur_rtde_driver/include/ur_rtde_driver/primary/robot_message.h b/ur_rtde_driver/include/ur_rtde_driver/primary/robot_message.h index 59f84f1..249f086 100644 --- a/ur_rtde_driver/include/ur_rtde_driver/primary/robot_message.h +++ b/ur_rtde_driver/include/ur_rtde_driver/primary/robot_message.h @@ -46,16 +46,39 @@ enum class RobotMessagePackageType : uint8_t ROBOT_MESSAGE_REQUEST_VALUE = 9, ROBOT_MESSAGE_RUNTIME_EXCEPTION = 10 }; -class RobotMessage : public PrimaryPackage +/*! + * \brief The RobotMessage class is a parent class for the different received robot messages. + */ +class RobotMessage : public PrimaryPackage { public: + /*! + * \brief Creates a new RobotMessage object to be filled from a package. + * + * \param timestamp Timestamp of the package + * \param source The package's source + */ RobotMessage(const uint64_t timestamp, const uint8_t source) : timestamp_(timestamp), source_(source) { } virtual ~RobotMessage() = default; + /*! + * \brief Sets the attributes of the package by parsing a serialized representation of the + * package. + * + * \param bp A parser containing a serialized version of the package + * + * \returns True, if the package was parsed successfully, false otherwise + */ virtual bool parseWith(comm::BinParser& bp); + + /*! + * \brief Produces a human readable representation of the package object. + * + * \returns A string representing the object + */ virtual std::string toString() const; uint64_t timestamp_; diff --git a/ur_rtde_driver/include/ur_rtde_driver/primary/robot_message/version_message.h b/ur_rtde_driver/include/ur_rtde_driver/primary/robot_message/version_message.h index 19a789a..83a1024 100644 --- a/ur_rtde_driver/include/ur_rtde_driver/primary/robot_message/version_message.h +++ b/ur_rtde_driver/include/ur_rtde_driver/primary/robot_message/version_message.h @@ -34,17 +34,39 @@ namespace ur_driver { namespace primary_interface { + /*! + * \brief The VersionMessage class handles the version messages sent via the primary UR interface. + */ class VersionMessage : public RobotMessage { public: VersionMessage() = delete; + /*! + * \brief Creates a new VersionMessage object to be filled from a package. + * + * \param timestamp Timestamp of the package + * \param source The package's source + */ VersionMessage(uint64_t timestamp, uint8_t source) : RobotMessage(timestamp, source) { } virtual ~VersionMessage() = default; + /*! + * \brief Sets the attributes of the package by parsing a serialized representation of the + * package. + * + * \param bp A parser containing a serialized version of the package + * + * \returns True, if the package was parsed successfully, false otherwise + */ virtual bool parseWith(comm::BinParser& bp); + /*! + * \brief Produces a human readable representation of the package object. + * + * \returns A string representing the object + */ virtual std::string toString() const; int8_t project_name_length_; diff --git a/ur_rtde_driver/include/ur_rtde_driver/primary/robot_state.h b/ur_rtde_driver/include/ur_rtde_driver/primary/robot_state.h index 5cd812e..3c52fcf 100644 --- a/ur_rtde_driver/include/ur_rtde_driver/primary/robot_state.h +++ b/ur_rtde_driver/include/ur_rtde_driver/primary/robot_state.h @@ -58,15 +58,34 @@ class RobotState : public PrimaryPackage { public: RobotState() = delete; + /*! + * \brief Creates a new RobotState object, setting the type of state message. + * + * \param type The type of state message + */ RobotState(const RobotStateType type) : state_type_(type) { } virtual ~RobotState() = default; + /*! + * \brief Sets the attributes of the package by parsing a serialized representation of the + * package. + * + * \param bp A parser containing a serialized version of the package + * + * \returns True, if the package was parsed successfully, false otherwise + */ virtual bool parseWith(comm::BinParser& bp) { return PrimaryPackage::parseWith(bp); } + + /*! + * \brief Produces a human readable representation of the package object. + * + * \returns A string representing the object + */ virtual std::string toString() const { std::stringstream ss; diff --git a/ur_rtde_driver/include/ur_rtde_driver/primary/robot_state/kinematics_info.h b/ur_rtde_driver/include/ur_rtde_driver/primary/robot_state/kinematics_info.h index b6fb5ff..4f8c480 100644 --- a/ur_rtde_driver/include/ur_rtde_driver/primary/robot_state/kinematics_info.h +++ b/ur_rtde_driver/include/ur_rtde_driver/primary/robot_state/kinematics_info.h @@ -43,14 +43,38 @@ class KinematicsInfo : public RobotState { public: KinematicsInfo() = delete; + /*! + * \brief Creates a new KinematicsInfo object. + * + * \param type The type of RobotState message received + */ KinematicsInfo(const RobotStateType type) : RobotState(type) { } virtual ~KinematicsInfo() = default; + /*! + * \brief Sets the attributes of the package by parsing a serialized representation of the + * package. + * + * \param bp A parser containing a serialized version of the package + * + * \returns True, if the package was parsed successfully, false otherwise + */ virtual bool parseWith(comm::BinParser& bp); + + /*! + * \brief Produces a human readable representation of the package object. + * + * \returns A string representing the object + */ virtual std::string toString() const; + /*! + * \brief Calculates a hash value of the parameters to allow for identification of a calibration. + * + * \returns A hash value of the parameters + */ std::string toHash() const; vector6uint32_t checksum_;