From 5a65f3ed69388848f5531abff9ba5edb7f698680 Mon Sep 17 00:00:00 2001 From: Jessica Chen Date: Fri, 15 Nov 2024 10:35:27 -0500 Subject: [PATCH] Lint --- .../ur_client_library/primary/robot_message.h | 2 +- .../robot_message/error_code_message.h | 20 ++++++++-------- .../ur_client_library/ur/error_code_client.h | 12 +++++----- .../ur_client_library/ur/error_code_reader.h | 12 +++++----- include/ur_client_library/ur/ur_driver.h | 15 ++++++------ .../robot_message/error_code_message.cpp | 2 +- src/ur/error_code_client.cpp | 24 +++++++++---------- src/ur/error_code_reader.cpp | 12 ++++++---- 8 files changed, 50 insertions(+), 49 deletions(-) diff --git a/include/ur_client_library/primary/robot_message.h b/include/ur_client_library/primary/robot_message.h index c7b8701f..120a37e2 100644 --- a/include/ur_client_library/primary/robot_message.h +++ b/include/ur_client_library/primary/robot_message.h @@ -66,7 +66,7 @@ class RobotMessage : public PrimaryPackage RobotMessage(const uint64_t timestamp, const uint8_t source) : timestamp_(timestamp), source_(source) { } - /*! + /*! * \brief Creates a new RobotMessage object to be filled from a package. * * \param timestamp Timestamp of the package diff --git a/include/ur_client_library/primary/robot_message/error_code_message.h b/include/ur_client_library/primary/robot_message/error_code_message.h index 5e3825ef..27edb0ab 100644 --- a/include/ur_client_library/primary/robot_message/error_code_message.h +++ b/include/ur_client_library/primary/robot_message/error_code_message.h @@ -1,7 +1,7 @@ // Below code is copied from a branch on the Universal_Robot_Client_Library -// with some modification. Link to branch: +// with some modification. Link to branch: // https://github.com/UniversalRobots/Universal_Robots_Client_Library/tree/improve_primary_interface -// +// // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- // -- BEGIN LICENSE BLOCK ---------------------------------------------- @@ -52,15 +52,15 @@ enum class ReportLevel : int32_t DEVL_FAULT = 132 }; -struct ErrorCode +struct ErrorCode { - int32_t message_code{-1}; - int32_t message_argument{-1}; - ReportLevel report_level{ReportLevel::DEBUG}; - uint32_t data_type{0}; - uint32_t data{0}; + int32_t message_code{ -1 }; + int32_t message_argument{ -1 }; + ReportLevel report_level{ ReportLevel::DEBUG }; + uint32_t data_type{ 0 }; + uint32_t data{ 0 }; std::string text; - uint64_t timestamp{0}; + uint64_t timestamp{ 0 }; std::string to_string; }; @@ -112,7 +112,7 @@ class ErrorCodeMessage : public RobotMessage int32_t message_code_; int32_t message_argument_; ReportLevel report_level_; - uint8_t data_type_; + uint32_t data_type_; uint32_t data_; std::string text_; }; diff --git a/include/ur_client_library/ur/error_code_client.h b/include/ur_client_library/ur/error_code_client.h index 9d3c35ab..4e1e04f3 100644 --- a/include/ur_client_library/ur/error_code_client.h +++ b/include/ur_client_library/ur/error_code_client.h @@ -10,15 +10,15 @@ namespace urcl { class ErrorCodeClient { -public: +public: ErrorCodeClient() = delete; - ErrorCodeClient(comm::URStream& stream, comm::INotifier& notifier, - primary_interface::PrimaryParser& parser); + ErrorCodeClient(comm::URStream& stream, comm::INotifier& notifier, + primary_interface::PrimaryParser& parser); ~ErrorCodeClient(); -void start(); + void start(); -std::deque getErrorCodes(); + std::deque getErrorCodes(); private: comm::URStream& stream_; @@ -27,4 +27,4 @@ std::deque getErrorCodes(); comm::URProducer prod_; comm::Pipeline pipeline_; }; -} +} // namespace urcl diff --git a/include/ur_client_library/ur/error_code_reader.h b/include/ur_client_library/ur/error_code_reader.h index 83049e51..ca2ac818 100644 --- a/include/ur_client_library/ur/error_code_reader.h +++ b/include/ur_client_library/ur/error_code_reader.h @@ -11,7 +11,7 @@ namespace urcl { /*! * \brief The ErrorCodeReader class consumes primary packages ignoring all but RobotCommMessage - * packages to retrieve the latest code reported by the robot. + * packages to retrieve the latest code reported by the robot. */ class ErrorCodeReader : public comm::IConsumer { @@ -53,15 +53,15 @@ class ErrorCodeReader : public comm::IConsumer product); /*! - * \brief Retrieves a list of error codes from the queue if there are any. - * - * \return A list of error codes - */ + * \brief Retrieves a list of error codes from the queue if there are any. + * + * \return A list of error codes + */ std::deque getErrorCodesFromQueue(); + private: std::deque queue_; std::mutex queue_mutex_; - }; } // namespace urcl diff --git a/include/ur_client_library/ur/ur_driver.h b/include/ur_client_library/ur/ur_driver.h index fd24bce4..c7c891cc 100644 --- a/include/ur_client_library/ur/ur_driver.h +++ b/include/ur_client_library/ur/ur_driver.h @@ -411,11 +411,11 @@ class UrDriver bool checkCalibration(const std::string& checksum); /*! - * \brief Retrieves error codes ErrorCodeClient. - * - * \returns list of error codes - * - */ + * \brief Retrieves error codes ErrorCodeClient. + * + * \returns list of error codes + * + */ std::deque getErrorCodes(); /*! @@ -527,11 +527,10 @@ class UrDriver double target_frequency = 0.0); /*! - * \brief Starts the error code client - */ + * \brief Starts the error code client + */ void startErrorCodeClientCommunication(); - private: static std::string readScriptFile(const std::string& filename); /*! diff --git a/src/primary/robot_message/error_code_message.cpp b/src/primary/robot_message/error_code_message.cpp index f571e7aa..6524f555 100644 --- a/src/primary/robot_message/error_code_message.cpp +++ b/src/primary/robot_message/error_code_message.cpp @@ -1,7 +1,7 @@ // Below code is copied from a branch on the Universal_Robot_Client_Library // with some modification. Link to branch: // https://github.com/UniversalRobots/Universal_Robots_Client_Library/tree/improve_primary_interface -// +// // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- // -- BEGIN LICENSE BLOCK ---------------------------------------------- diff --git a/src/ur/error_code_client.cpp b/src/ur/error_code_client.cpp index 8b712033..73f6a5a3 100644 --- a/src/ur/error_code_client.cpp +++ b/src/ur/error_code_client.cpp @@ -4,29 +4,29 @@ namespace urcl { -ErrorCodeClient::ErrorCodeClient(comm::URStream& stream, comm::INotifier& notifier, - primary_interface::PrimaryParser& parser) -: stream_(stream) -, parser_(parser) -, prod_(stream_, parser_) -, pipeline_(prod_, &consumer_, "ErrorCodeClient Pipeline", notifier) +ErrorCodeClient::ErrorCodeClient(comm::URStream& stream, comm::INotifier& notifier, + primary_interface::PrimaryParser& parser) + : stream_(stream) + , parser_(parser) + , prod_(stream_, parser_) + , pipeline_(prod_, &consumer_, "ErrorCodeClient Pipeline", notifier) { } ErrorCodeClient::~ErrorCodeClient() { - URCL_LOG_INFO("Stopping error code client pipeline"); - pipeline_.stop(); + URCL_LOG_INFO("Stopping error code client pipeline"); + pipeline_.stop(); } void ErrorCodeClient::start() { - URCL_LOG_INFO("Starting error code client pipeline"); - pipeline_.run(); + URCL_LOG_INFO("Starting error code client pipeline"); + pipeline_.run(); } std::deque ErrorCodeClient::getErrorCodes() { - return consumer_.getErrorCodesFromQueue(); -} + return consumer_.getErrorCodesFromQueue(); } +} // namespace urcl diff --git a/src/ur/error_code_reader.cpp b/src/ur/error_code_reader.cpp index 12208c44..220987ef 100644 --- a/src/ur/error_code_reader.cpp +++ b/src/ur/error_code_reader.cpp @@ -17,9 +17,11 @@ bool ErrorCodeReader::consume(std::shared_ptr code.timestamp = error_code_message->timestamp_; code.to_string = error_code_message->toString(); - const auto logContents = "Logging an ErrorCodeMessage from the UR Controller Box: " + error_code_message->toString(); + const auto logContents = + "Logging an ErrorCodeMessage from the UR Controller Box: " + error_code_message->toString(); - switch(code.report_level) { + switch (code.report_level) + { case urcl::primary_interface::ReportLevel::DEBUG: case urcl::primary_interface::ReportLevel::DEVL_DEBUG: case urcl::primary_interface::ReportLevel::DEVL_INFO: @@ -35,8 +37,8 @@ bool ErrorCodeReader::consume(std::shared_ptr URCL_LOG_WARN(logContents.c_str()); break; default: - //urcl::primary_interface::ReportLevel::VIOLATION: - //urcl::primary_interface::ReportLevel::FAULT: + // urcl::primary_interface::ReportLevel::VIOLATION: + // urcl::primary_interface::ReportLevel::FAULT: URCL_LOG_ERROR(logContents.c_str()); break; } @@ -47,7 +49,7 @@ bool ErrorCodeReader::consume(std::shared_ptr return true; } -std::deque ErrorCodeReader::getErrorCodesFromQueue() +std::deque ErrorCodeReader::getErrorCodesFromQueue() { std::lock_guard lock_guard(queue_mutex_); std::deque error_codes;