-
Notifications
You must be signed in to change notification settings - Fork 128
Expose diagnostic error codes #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
urfeex
merged 22 commits into
UniversalRobots:master
from
jessica-chen-ocado:expose-diagnostic-error-codes
Feb 7, 2025
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
48de73f
Exposed error code messages
jessica-chen-ocado a227b37
Log all ReportLevel::DEVL_* as debug
jessica-chen-ocado b8c9b12
Changed data_type to uint32_t
jessica-chen-ocado 5252119
Added integration test
jessica-chen-ocado 3b0f964
Increased wait before clearing PStop
jessica-chen-ocado 262cb0c
Lint
jessica-chen-ocado be9fc61
Addressed PR comments
jessica-chen-ocado 4aaee74
Cleanup
jessica-chen-ocado c4c74d2
Minor cleanup
jessica-chen-ocado ab05161
Apply suggestions from code review
urfeex 0460982
Code formatting
urfeex 6224be6
Revert shorting the wait after clearing PSTOP
urfeex 9c1d40d
REVERT_ME: Add color to default log handler
urfeex f4cb10e
Sleep 6 seconds before unlocking PSTOP
urfeex 92608aa
Revert "REVERT_ME: Add color to default log handler"
urfeex ff60c08
Clang-tidy fixes
urfeex 1754484
Update license header for error_code_message
urfeex f98d86c
Added license headers
jessica-chen-ocado b8d59f0
Update test API
urfeex e24270b
formatting
urfeex d400328
Change link to error code documentation
urfeex 1abca39
Added integration test for primary client
urfeex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jessica-chen-ocado marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// -- BEGIN LICENSE BLOCK ---------------------------------------------- | ||
// Copyright © 2024-2025 Ocado Group | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// | ||
// * Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// * Neither the name of the {copyright_holder} nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
// -- END LICENSE BLOCK ------------------------------------------------ | ||
|
||
#ifndef UR_CLIENT_LIBRARY_PRIMARY_CLIENT_H_INCLUDED | ||
#define UR_CLIENT_LIBRARY_PRIMARY_CLIENT_H_INCLUDED | ||
|
||
#include <memory> | ||
#include <deque> | ||
|
||
#include <ur_client_library/comm/stream.h> | ||
#include <ur_client_library/comm/pipeline.h> | ||
#include <ur_client_library/comm/producer.h> | ||
#include <ur_client_library/primary/abstract_primary_consumer.h> | ||
#include <ur_client_library/primary/primary_consumer.h> | ||
#include <ur_client_library/primary/primary_package.h> | ||
#include <ur_client_library/primary/primary_parser.h> | ||
|
||
namespace urcl | ||
{ | ||
namespace primary_interface | ||
{ | ||
class PrimaryClient | ||
{ | ||
public: | ||
PrimaryClient() = delete; | ||
PrimaryClient(const std::string& robot_ip, comm::INotifier& notifier); | ||
~PrimaryClient(); | ||
|
||
/*! | ||
* \brief Adds a primary consumer to the list of consumers | ||
* | ||
* \param primary_consumer Primary consumer that should be added to the list | ||
*/ | ||
void addPrimaryConsumer(std::shared_ptr<comm::IConsumer<PrimaryPackage>> primary_consumer); | ||
|
||
/*! | ||
* \brief Remove a primary consumer from the list of consumers | ||
* | ||
* \param primary_consumer Primary consumer that should be removed from the list | ||
*/ | ||
void removePrimaryConsumer(std::shared_ptr<comm::IConsumer<PrimaryPackage>> primary_consumer); | ||
void start(); | ||
|
||
/*! | ||
* \brief Retrieves previously raised error codes from PrimaryClient. After calling this, recorded errors will be | ||
* deleted. | ||
*/ | ||
std::deque<ErrorCode> getErrorCodes(); | ||
urfeex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
private: | ||
// The function is called whenever an error code message is received | ||
void errorMessageCallback(ErrorCode& code); | ||
|
||
PrimaryParser parser_; | ||
std::shared_ptr<PrimaryConsumer> consumer_; | ||
std::unique_ptr<comm::MultiConsumer<PrimaryPackage>> multi_consumer_; | ||
|
||
comm::INotifier notifier_; | ||
|
||
comm::URStream<PrimaryPackage> stream_; | ||
std::unique_ptr<comm::URProducer<PrimaryPackage>> prod_; | ||
std::unique_ptr<comm::Pipeline<PrimaryPackage>> pipeline_; | ||
|
||
std::mutex error_code_queue_mutex_; | ||
std::deque<ErrorCode> error_code_queue_; | ||
}; | ||
|
||
} // namespace primary_interface | ||
} // namespace urcl | ||
|
||
#endif // ifndef UR_CLIENT_LIBRARY_PRIMARY_CLIENT_H_INCLUDED |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.