This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
/
ur_test_move_command.cpp
71 lines (58 loc) · 2.64 KB
/
ur_test_move_command.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) 2019 Intel Corporation. All Rights Reserved
//
// 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.
/**
* @file ur_test.cpp
*/
#include <robot_interface/control_ur.hpp>
int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
std::shared_ptr<ArmControlBase> arm_control(new URControl("ur_test", rclcpp::NodeOptions()
.allow_undeclared_parameters(true)
.automatically_declare_parameters_from_overrides(true)));
arm_control->parseArgs();
arm_control->startLoop();
rclcpp::sleep_for(std::chrono::seconds(2));
while(rclcpp::ok())
{
geometry_msgs::msg::PoseStamped pose_stamped;
pose_stamped.header.frame_id = "base";
pose_stamped.header.stamp = arm_control->now();
pose_stamped.pose.position.x = -0.068673;
pose_stamped.pose.position.y = -0.595636;
pose_stamped.pose.position.z = 0.201606;
pose_stamped.pose.orientation.x = -0.311507;
pose_stamped.pose.orientation.y = 0.950216;
pose_stamped.pose.orientation.z = -0.004305;
pose_stamped.pose.orientation.w = 0.005879;
arm_control->moveToTcpPose(pose_stamped, 0.3, 0.3);
pose_stamped.header.frame_id = "base";
pose_stamped.header.stamp = arm_control->now();
pose_stamped.pose.position.x = -0.157402;
pose_stamped.pose.position.y = -0.679509;
pose_stamped.pose.position.z = 0.094437;
pose_stamped.pose.orientation.x = 0.190600;
pose_stamped.pose.orientation.y = 0.948295;
pose_stamped.pose.orientation.z = 0.239947;
pose_stamped.pose.orientation.w = 0.082662;
arm_control->pick(pose_stamped, 1.05, 1.4, 0.5, 0.1);
arm_control->place(pose_stamped, 1.05, 1.4, 0.5, 0.1);
arm_control->moveToTcpPose(-0.350, -0.296, 0.12, 3.14159, 0, 0, 0.3, 0.3);
arm_control->moveToJointValues(std::vector<double>{0.87, -1.44, 1.68, -1.81, -1.56, 0}, 1.05, 1.4);
arm_control->pick(-0.153, -0.433, 0.145, 2.8, -0.144, 0.0245, 1.05, 1.4, 0.5, 0.1);
arm_control->place(-0.350, -0.296, 0.145, 3.14159, 0, 0, 1.05, 1.4, 0.5, 0.1);
}
rclcpp::shutdown();
return 0;
}