21 #include <rclcpp/rclcpp.hpp> 24 #include "ur_modern_driver/log.h" 25 #include "ur_modern_driver/pipeline.h" 26 #include "ur_modern_driver/ur/commander.h" 27 #include "ur_modern_driver/ur/factory.h" 28 #include "ur_modern_driver/ur/messages.h" 29 #include "ur_modern_driver/ur/parser.h" 30 #include "ur_modern_driver/ur/producer.h" 31 #include "ur_modern_driver/ur/rt_state.h" 32 #include "ur_modern_driver/ur/state.h" 34 static const std::vector<std::string> JOINTS = {
"shoulder_pan_joint",
"shoulder_lift_joint",
"elbow_joint",
35 "wrist_1_joint",
"wrist_2_joint",
"wrist_3_joint" };
36 static const std::string HOST =
"192.168.0.5";
37 static const bool SHUTDOWN_ON_DISCONNECT =
true;
38 static const int UR_SECONDARY_PORT = 30002;
39 static const int UR_RT_PORT = 30003;
45 std::vector<std::string> joint_names;
46 bool shutdown_on_disconnect;
52 void started(std::string name)
54 LOG_INFO(
"Starting pipeline %s", name.c_str());
56 void stopped(std::string name)
58 LOG_INFO(
"Stopping pipeline %s", name.c_str());
65 void started(std::string name)
67 LOG_INFO(
"Starting pipeline %s", name.c_str());
69 void stopped(std::string name)
71 LOG_INFO(
"Shutting down on stopped pipeline %s", name.c_str());
80 URControl(
const std::string node_name,
const rclcpp::NodeOptions & options = rclcpp::NodeOptions())
83 for (
auto const& joint : JOINTS)
85 joint_names_.push_back(joint);
93 factory_.reset(
nullptr);
95 LOG_INFO(
"UR control interface shut down.");
99 virtual bool moveToTcpPose(
double x,
double y,
double z,
100 double alpha,
double beta,
double gamma,
101 double vel,
double acc);
103 virtual bool open(
const double distance = 0);
105 virtual bool close(
const double distance = 0);
108 bool urscriptInterface(
const std::string command_script);
114 virtual bool consume(RTState_V1_6__7& state);
115 virtual bool consume(RTState_V1_8& state);
116 virtual bool consume(RTState_V3_0__1& state);
117 virtual bool consume(RTState_V3_2__3& state);
119 virtual void setupConsumer()
122 virtual void teardownConsumer()
125 virtual void stopConsumer()
130 bool publishJoints(RTShared& packet, rclcpp::Time t);
131 bool publish(RTShared& packet);
134 bool getTcpPose(RTShared& packet);
142 std::string local_ip_;
143 std::unique_ptr<URFactory> factory_;
146 std::unique_ptr<URParser<RTPacket>> rt_parser_;
147 std::unique_ptr<URStream> rt_stream_;
148 std::unique_ptr<URProducer<RTPacket>> rt_prod_;
149 std::unique_ptr<URCommander> rt_commander_;
150 vector<IConsumer<RTPacket> *> rt_vec_;
151 std::unique_ptr<MultiConsumer<RTPacket>> rt_cons_;
152 std::unique_ptr<Pipeline<RTPacket>> rt_pl_;
154 INotifier *notifier_;
157 std::unique_ptr<URParser<StatePacket>> state_parser_;
158 std::unique_ptr<URStream> state_stream_;
159 std::unique_ptr<URProducer<StatePacket>> state_prod_;
160 vector<IConsumer<StatePacket> *> state_vec_;
161 std::unique_ptr<MultiConsumer<StatePacket>> state_cons_;
162 std::unique_ptr<Pipeline<StatePacket>> state_pl_;
164 bool gripper_powered_up_;
Definition: control_ur.hpp:62
Definition: control_ur.hpp:41
Robot arm control interface.
Definition: control_base.hpp:55
Definition: control_ur.hpp:49
Native robot control interface for visual manipulation.
Definition: control_ur.hpp:77