Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jessica-chen-ocado committed Jan 13, 2025
1 parent 8ba4d1b commit 93b0933
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 49 deletions.
2 changes: 1 addition & 1 deletion include/ur_client_library/primary/robot_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 ----------------------------------------------
Expand Down Expand Up @@ -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;
};

Expand Down Expand Up @@ -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_;
};
Expand Down
12 changes: 6 additions & 6 deletions include/ur_client_library/ur/error_code_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ namespace urcl
{
class ErrorCodeClient
{
public:
public:
ErrorCodeClient() = delete;
ErrorCodeClient(comm::URStream<primary_interface::PrimaryPackage>& stream, comm::INotifier& notifier,
primary_interface::PrimaryParser& parser);
ErrorCodeClient(comm::URStream<primary_interface::PrimaryPackage>& stream, comm::INotifier& notifier,
primary_interface::PrimaryParser& parser);
~ErrorCodeClient();

void start();
void start();

std::deque<urcl::primary_interface::ErrorCode> getErrorCodes();
std::deque<urcl::primary_interface::ErrorCode> getErrorCodes();

private:
comm::URStream<primary_interface::PrimaryPackage>& stream_;
Expand All @@ -27,4 +27,4 @@ std::deque<urcl::primary_interface::ErrorCode> getErrorCodes();
comm::URProducer<primary_interface::PrimaryPackage> prod_;
comm::Pipeline<primary_interface::PrimaryPackage> pipeline_;
};
}
} // namespace urcl
12 changes: 6 additions & 6 deletions include/ur_client_library/ur/error_code_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<primary_interface::PrimaryPackage>
{
Expand Down Expand Up @@ -53,15 +53,15 @@ class ErrorCodeReader : public comm::IConsumer<primary_interface::PrimaryPackage
virtual bool consume(std::shared_ptr<primary_interface::PrimaryPackage> 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<primary_interface::ErrorCode> getErrorCodesFromQueue();

private:
std::deque<primary_interface::ErrorCode> queue_;
std::mutex queue_mutex_;

};
} // namespace urcl

Expand Down
15 changes: 7 additions & 8 deletions include/ur_client_library/ur/ur_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,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<urcl::primary_interface::ErrorCode> getErrorCodes();

/*!
Expand Down Expand Up @@ -657,11 +657,10 @@ class UrDriver
double target_frequency = 0.0, bool ignore_unavailable_outputs = false);

/*!
* \brief Starts the error code client
*/
* \brief Starts the error code client
*/
void startErrorCodeClientCommunication();


private:
static std::string readScriptFile(const std::string& filename);
/*!
Expand Down
2 changes: 1 addition & 1 deletion src/primary/robot_message/error_code_message.cpp
Original file line number Diff line number Diff line change
@@ -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 ----------------------------------------------
Expand Down
24 changes: 12 additions & 12 deletions src/ur/error_code_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@

namespace urcl
{
ErrorCodeClient::ErrorCodeClient(comm::URStream<primary_interface::PrimaryPackage>& 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<primary_interface::PrimaryPackage>& 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<urcl::primary_interface::ErrorCode> ErrorCodeClient::getErrorCodes()
{
return consumer_.getErrorCodesFromQueue();
}
return consumer_.getErrorCodesFromQueue();
}
} // namespace urcl
12 changes: 7 additions & 5 deletions src/ur/error_code_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ bool ErrorCodeReader::consume(std::shared_ptr<primary_interface::PrimaryPackage>
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:
Expand All @@ -35,8 +37,8 @@ bool ErrorCodeReader::consume(std::shared_ptr<primary_interface::PrimaryPackage>
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;
}
Expand All @@ -47,7 +49,7 @@ bool ErrorCodeReader::consume(std::shared_ptr<primary_interface::PrimaryPackage>
return true;
}

std::deque<primary_interface::ErrorCode> ErrorCodeReader::getErrorCodesFromQueue()
std::deque<primary_interface::ErrorCode> ErrorCodeReader::getErrorCodesFromQueue()
{
std::lock_guard<std::mutex> lock_guard(queue_mutex_);
std::deque<primary_interface::ErrorCode> error_codes;
Expand Down

0 comments on commit 93b0933

Please sign in to comment.