-
Notifications
You must be signed in to change notification settings - Fork 128
Dashboard commands, Docker Image and CI step for running the examples #127
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
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1f080c0
Add example for receiving the calibration status
urrsk f43c618
Change to URSim docker image
urrsk db5a2d0
Adding function to interact with the robot through the dashboard
urrsk 7a75157
Add CI step for running the examples
urrsk b7117ed
Remove Dockerfile
urrsk d2d083c
Fix spell error in Brake Release dashboard command
urrsk f146074
Minor code style fixes and cleanup
fmauch 607eeeb
Modernize timeout interface
8cf6f5c
Added commands, version check and now throws exception
urmarp 98ceaa0
Added more capabilities to VersionInformation
d230be3
Use VersionInformation for version checking inside dashboard calls
89423b3
Remove requirement to manually add line termination to the dashboard …
56345db
Explicitly use this->major to avoid name clashes from old c headers
92f535d
Adapt dashboard_client test to changed version API
a856423
Update comments
14ace41
Use external IP address of test container
4fa8eac
Set default IP in examples to external IP address of container
d5fa901
Added port forwarding to start_ursim.sh
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- | ||
|
||
// -- BEGIN LICENSE BLOCK ---------------------------------------------- | ||
// Copyright 2022 Universal Robots A/S | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// -- END LICENSE BLOCK ------------------------------------------------ | ||
|
||
#include <ur_client_library/log.h> | ||
#include <ur_client_library/ur/dashboard_client.h> | ||
|
||
#include <iostream> | ||
#include <memory> | ||
#include <thread> | ||
|
||
using namespace urcl; | ||
|
||
// In a real-world example it would be better to get those values from command line parameters / a | ||
// better configuration system such as Boost.Program_options | ||
const std::string DEFAULT_ROBOT_IP = "192.168.56.101"; | ||
|
||
// We need a callback function to register. See UrDriver's parameters for details. | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
urcl::setLogLevel(urcl::LogLevel::DEBUG); | ||
|
||
// Parse the ip arguments if given | ||
std::string robot_ip = DEFAULT_ROBOT_IP; | ||
if (argc > 1) | ||
{ | ||
robot_ip = std::string(argv[1]); | ||
} | ||
|
||
// Making the robot ready for the program by: | ||
// Connect the the robot Dashboard | ||
std::unique_ptr<DashboardClient> my_dashboard; | ||
my_dashboard.reset(new DashboardClient(robot_ip)); | ||
if (!my_dashboard->connect()) | ||
{ | ||
URCL_LOG_ERROR("Could not connect to dashboard"); | ||
return 1; | ||
} | ||
|
||
if (!my_dashboard->commandPowerOff()) | ||
{ | ||
URCL_LOG_ERROR("Could not send power off"); | ||
return 1; | ||
} | ||
|
||
my_dashboard->commandCloseSafetyPopup(); | ||
|
||
// Power it on | ||
if (!my_dashboard->commandPowerOn()) | ||
{ | ||
URCL_LOG_ERROR("Could not send Power on command"); | ||
return 1; | ||
} | ||
|
||
// Release the brakes | ||
if (!my_dashboard->commandBrakeRelease()) | ||
{ | ||
URCL_LOG_ERROR("Could not send BrakeRelease command"); | ||
return 1; | ||
} | ||
|
||
// Load existing program | ||
const std::string program_file_name_to_be_loaded("wait_program.urp"); | ||
if (!my_dashboard->commandLoadProgram(program_file_name_to_be_loaded)) | ||
{ | ||
URCL_LOG_ERROR("Could not load %s program", program_file_name_to_be_loaded.c_str()); | ||
urrsk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return 1; | ||
} | ||
|
||
// Play loaded program | ||
if (!my_dashboard->commandPlay()) | ||
{ | ||
URCL_LOG_ERROR("Could not play program"); | ||
return 1; | ||
} | ||
|
||
// Pause running program | ||
if (!my_dashboard->commandPause()) | ||
{ | ||
URCL_LOG_ERROR("Could not pause program"); | ||
return 1; | ||
} | ||
|
||
// Play loaded program | ||
if (!my_dashboard->commandPlay()) | ||
{ | ||
URCL_LOG_ERROR("Could not play program"); | ||
return 1; | ||
} | ||
|
||
// Stop program | ||
if (!my_dashboard->commandStop()) | ||
{ | ||
URCL_LOG_ERROR("Could not stop program"); | ||
return 1; | ||
} | ||
|
||
// Power it off | ||
if (!my_dashboard->commandPowerOff()) | ||
{ | ||
URCL_LOG_ERROR("Could not send Power off command"); | ||
return 1; | ||
} | ||
|
||
// Now the robot is ready to receive a program | ||
|
||
return 0; | ||
} |
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.